Cufon.replace('#featured-area h1, #pagetop h1', { color: '-linear-gradient(white,white, #93b8cc)'
, textShadow: '#133d9f 2px 2px 2px'});
Cufon.replace('#featured-area-wp h1', { color: '-linear-gradient(white,white, #93b8cc)'
, textShadow: '#ff6600 2px 2px 2px'});
		
	Cufon.replace('#footer .block h3', { textShadow: '#0A0A0A  1px 1px 2px' });
	
	Cufon.replace(', .sub-content h2, .theme-post h3, .theme-gallery h4,#sidebar-theme-options h3, #theme-features h3', { hover: true
 });
	
	Cufon.replace('#sidebar-theme-options h3');	

// iPhone Slider


    jQuery('#iphone-slider').cycle({
		fx: 'fade' // choose your transition type, ex: fade, scrollUp, shuffle, etc...
	});
	
	// Image Preview
	
	this.screenshotPreview = function(){	
	/* CONFIG */
		
		xOffset = 20;
		yOffset = 30;
		
		// these 2 variable determine popup's distance from the cursor
		// you might want to adjust to get the right result
		
	/* END CONFIG */
	jQuery("a.preview").hover(function(e){
		this.t = this.title;
		this.title = "";	
		var c = (this.t != "") ? "<br/>" + this.t : "";
		jQuery("body").append("<div id='preview'><img src='"+ this.rel +"' alt='Loading' />"+ c +"</div>");								 
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px")
			.fadeIn("slow");						
    },
	function(){
		this.title = this.t;	
		jQuery("#preview").remove();
    });	
	jQuery("a.preview").mousemove(function(e){
		jQuery("#preview")
			.css("top",(e.pageY - xOffset) + "px")
			.css("left",(e.pageX + yOffset) + "px");
	});			
};


// starting the script on page load
jQuery(document).ready(function(){
	screenshotPreview();
});
	
		jQuery.noConflict();
		
		  //Back to top slider
		  
		  	//ToolTip

    
    jQuery('.north').tipsy({gravity: 'n', fade: true});
    jQuery('.south').tipsy({gravity: 's', fade: true});
    jQuery('.east').tipsy({gravity: 'e', fade: true});
    jQuery('.west').tipsy({gravity: 'w', fade: true});
    
    jQuery('.auto-gravity').tipsy({gravity: jQuery.fn.tipsy.autoNS});
    
    jQuery('.example-fade').tipsy({fade: true});
    
    jQuery('.example-custom-attribute').tipsy({title: 'id'});
    jQuery('.example-callback').tipsy({title: function() { return this.getAttribute('title').toUpperCase(); } });
    jQuery('.example-fallback').tipsy({fallback: "Where's my tooltip yo'?" });

jQuery(document).ready(function() {
   
    jQuery('a[href=#top]').click(function(){
        jQuery('html, body').animate({scrollTop:0}, 600);
        return false;
    });

});
		
			// Fancybox
jQuery(document).ready(function() {
	
	jQuery("a.group").fancybox({
		'hideOnContentClick': false
	});

});
	
		
		
		// Facebox
jQuery(document).ready(function(jQuery) {
	jQuery('a[rel*=openbox]').facebox()
	jQuery('a.ithumbs').fancybox({
		'transitionIn'	:	'elastic',
		'transitionOut'	:	'elastic',
		'speedIn'		:	600, 
		'speedOut'		:	200, 
		'overlayShow'	:	false,
		'titleShow'		: 	false,
		'overlayOpacity': 	0.7
	});
})
 
		 jQuery(".signin").click(function(e) {
                e.preventDefault();
                jQuery("fieldset#signin_menu").toggle(0);
				jQuery("div#signin_menu").toggle(0);
                jQuery(".signin").toggleClass("menu-open");
            });

            jQuery("fieldset#signin_menu").mouseup(function() {
                return false
            });
            jQuery("div#signin_menu").mouseup(function() {
                return false
            });
            jQuery(document).mouseup(function(e) {
                if(jQuery(e.target).parent("a.signin").length==0) {
                    jQuery(".signin").removeClass("menu-open");
                    jQuery("fieldset#signin_menu").hide();
					jQuery("div#signin_menu").hide();
                }
            });            
		
	            //hide the all of the element with class msg_body
            jQuery(".faq-body").hide();
            //toggle the componenet with class msg_body
            jQuery(".faq-head").click(function(){
                jQuery(this).next(".faq-body").slideToggle(200);
            });	
			
		


			
	//When page loads...
	jQuery(".tab_content").hide(); //Hide all content
	jQuery("ul.tabs li:first").addClass("active").show(); //Activate first tab
	jQuery(".tab_content:first").show(); //Show first tab content

	//On Click Event
	jQuery("ul.tabs li").click(function() {

		jQuery("ul.tabs li").removeClass("active"); //Remove any "active" class
		jQuery(this).addClass("active"); //Add "active" class to selected tab
		jQuery(".tab_content").hide(); //Hide all tab content

		var activeTab = jQuery(this).find("a").attr("href"); //Find the href attribute value to identify the active tab + content
		jQuery(activeTab).fadeIn(300); //Fade in the active ID content
			return false;

	});
	
		jQuery('ul.superfish').superfish({ 
			delay:       200,                            // one second delay on mouseout 
			animation:   {'marginLeft':'0px',opacity:'show',height:'show'},  // fade-in and slide-down animation 
			speed:       'fast',                          // faster animation speed 
			autoArrows:  true,                           // disable generation of arrow mark-up 
			onBeforeShow: function(){ this.css('marginLeft','0px'); },
			dropShadows: false                            // disable drop shadows 
		});
		
		jQuery('ul.menu > li > a.sf-with-ul').parent('li').addClass('sf-ul');
		
		//jQuery("ul.nav > li > ul").prev("a").attr("href","#");
		
		/* search form */
		
		var jQuerysearchform = jQuery('#header div#search-form');
		var jQuerysearchinput = jQuerysearchform.find("input#searchinput");
		var jQuerysearchvalue = jQuerysearchinput.val();
		
		jQuerysearchform.css("right","25px");
		
		jQuery("#header a#search-icon").click(function(){
			if (jQuerysearchform.filter(':hidden').length == 1)	
				jQuerysearchform.animate({"right": "-1", "opacity": "toggle"}, "slow")
			else
				jQuerysearchform.animate({"right": "25", "opacity": "toggle"}, "slow");
			return false;
		});
			
		jQuerysearchinput.focus(function(){
			if (jQuery(this).val() == jQuerysearchvalue) jQuery(this).val("");
		}).blur(function(){
			if (jQuery(this).val() == "") jQuery(this).val(jQuerysearchvalue);
		});
		
		
		/* footer widgets improvements */
		
		var jQueryfooter_widget = jQuery("#footer .widget");
		
		if (!(jQueryfooter_widget.length == 0)) {
			jQueryfooter_widget.each(function (index, domEle) {
				// domEle == this
				if ((index+1)%3 == 0) jQuery(domEle).addClass("last").after("<div class='clear'></div>");
			});
		};
	
		

		
			/* featured slider */
		
			var jQueryfeatured_area = jQuery('#featured-slider'),
				jQueryfeature_thumb = jQuery('#featured-thumbs img'),
				jQueryactive_arrow = jQuery('div#active_item');
				ordernum = 1,
				pause_scroll = false,
				jQueryslider_control = jQuery('#featured-thumbs'), //div#featured-thumbs
				jQueryslider_control_tab = jQueryfeature_thumb.parent('a');
			
			if (!(jQueryfeatured_area.length == 0)) {
				jQueryfeatured_area.cycle({
					timeout: 0,
					speed: 300,
					cleartypeNoBg: true
					
				});
			};
			
			

			function gonext(this_element){
				jQueryslider_control.find("img.active").removeClass('active');
				this_element.find("img").addClass('active');
							
				jQueryactive_arrow.animate({"left": this_element.find("img").position().left+25}, "slow");
				
				ordernum = this_element.prevAll('a').length+1;
				jQueryfeatured_area.cycle(ordernum - 1);
			};
			
			
			jQueryslider_control_tab.click(function() {
				clearInterval(interval);
				gonext(jQuery(this));
				return false;
			});
			
			jQuery('a#prevlink, a#nextlink').click(function() {
				clearInterval(interval);
				
				if (jQuery(this).attr("id") === 'nextlink') {
								
					auto_number = jQueryslider_control.find("img.active").parent().prevAll('a').length+1;
					if (auto_number === jQueryslider_control_tab.length) auto_number = 0;
					
				} else {
					auto_number = jQueryslider_control.find("img.active").parent().prevAll('a').length-1;
					if (auto_number === -1) auto_number = jQueryslider_control_tab.length-1;
				};
				
				gonext(jQueryslider_control_tab.eq(auto_number));
				return false;
			});
			
			jQueryfeature_thumb.hover(function(){			
				jQuerynext_div = jQuery(this).parent('a').next('div');
				

				jQuerynext_div.css({'left':jQuery(this).position().left-10});
				
				jQuery(this).addClass('hover').fadeTo('fast',0.5);
	
				
			},function(){
				jQuery(this).removeClass('hover').fadeTo('fast',1);

			});
			
			
			var auto_number;
			var interval;
			
			jQueryslider_control_tab.bind('autonext', function autonext(){
				if (!pause_scroll) gonext(jQuery(this)); 
				return false;
			});

jQuery(document).ready(function(){
	jQuery(".getintouch").click(function(){
		jQuery(".custom-contact").slideToggle("slow");
	});
	jQuery(".readmore").click(function(){
		jQuery(".custom-contact").slideToggle("slow");
	});
	jQuery("#custom-form").submit(function() {
		panelAjax("#custom-form",'action','offer','infoResponseLogin');
		return false;
	});
});
function panelAjax(action,at,divresponse,msgresponse){
	try {
		jQuery.ajax({
			url: jQuery(action).attr(at),
			type: "POST",
			data: jQuery(action).serialize(),
			dataType: "json",
/*				beforeSend: function(){
				$('#load').fadeIn(50);
				$('#load').html('<img src="/resources/img/load-ajax.gif">');
			},
*/
			// Mostramos un mensaje con la respuesta del Controlador
			success: function(data) {
//				jQuery('#load').fadeOut(500);
				if(!data.error){
					jQuery(".offer").fadeOut("0");
					jQuery("#custom-form").html(data.msj);
				}else{
					jQuery(".offer").fadeIn("500");
					jQuery(".offer").html(data.msj);
				}
			}
		});
	} catch (e){
		alert(e.message);
	}
}

