//Cufon Replace
/*Cufon.replace('h1', { fontFamily: 'Lobster',textShadow:'1px 1px 3px rgba(0,0,0,0.5)'});
Cufon.replace('h1 .desc', { fontFamily: 'Myriad Pro',textShadow:'1px 1px 3px rgba(0,0,0,0.5)'});
Cufon.replace('footer .privacy', { fontFamily: 'Myriad Pro',textShadow:'1px 1px 3px rgba(0,0,0,.43)',hover:{}});
Cufon.replace('h2', { fontFamily: 'Myriad Pro',textShadow:'1px 1px 2px #rgba(0,0,0,.4)'});
Cufon.replace('b', { fontFamily: 'Myriad Pro', color:'-linear-gradient(#ad0800, #800000)'});
Cufon.replace('#form1 .btns a,.address .email,#privacy .link', { fontFamily: 'Myriad Pro',color:'-linear-gradient(#d35800, #6b0b00)',hover:{color:'#151410'}});
Cufon.replace('.cat-tabs li:not(.curr) a', { fontFamily: 'Myriad Pro',textShadow:'1px 1px 3px rgba(0,0,0,0.5)',hover:{color:'-linear-gradient(#d35800,#610400)'}});
Cufon.replace('.cat-tabs li.curr a', { fontFamily: 'Myriad Pro',textShadow:'1px 1px 3px rgba(0,0,0,0.5)',color:'-linear-gradient(#d35800,#610400)',hover:false});
*/
Cufon.replace('#nav li a, #products-slider #title h2, #products-slider #title h3,#content .socialBtn a,.container .history .info .links li a',  { fontFamily: 'Fontin Sans Rg', hover:true} );

//Clear Input Function
function clearInput(el){
	if(el instanceof Array)
		for(var i=0;i<el.length;i++)
			clearInput(el[i])
	el=document.getElementById(el)
	if(el&&el.tagName.toLowerCase()=='form'){
		var a=el.getElementsByTagName('*')
		for(var i in a){
			if(a[i].value){
				if(!a[i].defaultValue)a[i].defaultValue=a[i].value
				a[i].onfocus=function(){if(this.value==this.defaultValue)this.value=''}
				a[i].onblur=function(){if(this.value=='')this.value=this.defaultValue}
			}			
			if((a[i].rel)&&(/(reset)/.test(a[i].rel)))a[i].onclick=function(){el[this.rel]();return false}
			if((a[i].rel)&&(/(submit)/.test(a[i].rel)))a[i].onclick=function(){sendContact();return false}
		}
	}
}
function fanFacebook(){
		window.open("http://www.facebook.com");
}
function fanTwitter(){
		window.open("http://www.twitter.com");		
}
/*jQuery(".header ul li#last,#footer #contactus").live("click",function(){
	jQuery(".header #contact-bubble").slideToggle(500);
	jQuery("body").scrollTo(".header #contact-bubble",500);
	return false;
});*/
jQuery(document).ready(function(){
	var config = {    
	 sensitivity: 2, // number = sensitivity threshold (must be 1 or higher)    
	 interval: 0, // number = milliseconds for onMouseOver polling interval    
	 over: megaHoverOver, // function = onMouseOver callback (REQUIRED)    
	 timeout: 250, // number = milliseconds delay before onMouseOut    
	 out: megaHoverOut // function = onMouseOut callback (REQUIRED)    
	};
	//jQuery("#nav li .sub").css({'opacity':'0'});
	jQuery("#nav li").hoverIntent(config);
	jQuery("#arabicBtn").live("click",function(){
		loadPopup("arabic_popup","arabic_background")
	});
	Cufon.now();
});

var popupStatus = 0;  
//loading popup with jQuery magic!  
function loadPopup(id,backid){  
	//begin centering the popup 
	var windowWidth = document.documentElement.clientWidth;
	var windowHeight = document.documentElement.clientHeight;
	var popupHeight = jQuery("#"+id).height();
	var popupWidth = jQuery("#"+id).width();
	//centering
	jQuery("#"+id).css({
		"position": "fixed",
		"top": windowHeight/2-popupHeight/2,
		"left": windowWidth/2-popupWidth/2
	});
	//only need force for IE6	
	jQuery("#"+backid).css({"height": windowHeight});
	if(popupStatus==0){  			
	  jQuery("#"+backid).css({"opacity": "0.80"});  
	  jQuery("#"+backid).fadeIn("slow");  
	  jQuery("#"+id).fadeIn("slow");	
	  jQuery("#"+id+" #closeBtn,#"+backid+"").unbind('click');  
	  jQuery("#"+id+" #closeBtn,#"+backid+"").click(function(){
		disablePopup(id,backid);
	  });
	  popupStatus = 1;  
	}  
}  
//disabling popup with jQuery magic!
function disablePopup(id,backid){
	//disables popup only if it is enabled
	if(popupStatus==1){
		jQuery("#"+backid).fadeOut("slow");
		jQuery("#"+id).fadeOut("slow");		
		popupStatus = 0;
	}
}
