<!--
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function check_No(obj)
{
	if(obj.contactus_fname.value==''){
		alert("Please enter your value for \"First Name\" field.");
		obj.contactus_fname.focus();
		return false; 
	}
	if(obj.contactus_lname.value==''){
		alert("Please enter your value for \"Last Name\" field.")
		obj.contactus_lname.focus();
		return false; 
	}
	if(obj.contactus_email.value==''){
		alert("Please enter your value for \"Email address\" field.");
		obj.contactus_email.focus();
		return false; 

	} else if(!validEmail(obj.contactus_email.value)){
		alert("Please enter your valid value for \"Email address\" field.");
		obj.contactus_email.focus();
		return false;
	}

	if(obj.contactus_message.value==''){
		alert("Please enter your value for \"Message\" field.");
		obj.contactus_message.focus();
		return false;
	}
	if(obj.scode.value==''){
		alert("Please enter your value for \"Security Code\" field.");
		obj.scode.focus();
		return false;
	}
}
function validEmail(value){
		var pattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
		return pattern.test(value);
}
function chk_form()
{
	if(document.contactus.subject.value == "")
	{
		alert("Subject is a reqired field!");
		document.contactus.subject.focus();
		return false;
		}
	if(document.contactus.name.value == "")
	{
		alert("Name is a reqired field!");
		document.contactus.name.focus();
		return false;
		}
	if(document.contactus.email.value == "")
	{
		alert("Email Address is a reqired field!");
		document.contactus.email.focus();
		return false;
		}
	if(!validateEmail(document.contactus.email.value))
	{
		alert("Email Address is a valid format!");
		document.contactus.email.focus();
		return false;
		}
}
function showPrdImage(imgType,prdID)
{
	if(imgType == 1)
	{
		if(document.getElementById("characterImage"+prdID+"")!= null)
		{
			document.getElementById("characterImage"+prdID+"").style.display = "inline";
		}
		if(document.getElementById("A2Image"+prdID+"")!= null)
		{
			document.getElementById("A2Image"+prdID+"").style.display = "none";
		}
		if(document.getElementById("A7Image"+prdID+"")!= null)
		{
			document.getElementById("A7Image"+prdID+"").style.display = "none";
		}
		if(document.getElementById("GiftImage"+prdID+"")!= null)
		{
			document.getElementById("GiftImage"+prdID+"").style.display = "none";
		}
	}
	else
	if(imgType == 2)
	{
		if(document.getElementById("characterImage"+prdID+"")!= null)
		{
			document.getElementById("characterImage"+prdID+"").style.display = "none";
		}
		if(document.getElementById("A2Image"+prdID+"")!= null)
		{
			document.getElementById("A2Image"+prdID+"").style.display = "inline";
		}
		if(document.getElementById("A7Image"+prdID+"")!= null)
		{
			document.getElementById("A7Image"+prdID+"").style.display = "none";
		}
		if(document.getElementById("GiftImage"+prdID+"")!= null)
		{
			document.getElementById("GiftImage"+prdID+"").style.display = "none";
		}
	}
	else
	if(imgType == 3)
	{
		if(document.getElementById("characterImage"+prdID+"")!= null)
		{
			document.getElementById("characterImage"+prdID+"").style.display = "none";
		}
		if(document.getElementById("A2Image"+prdID+"")!= null)
		{
			document.getElementById("A2Image"+prdID+"").style.display = "none";
		}
		if(document.getElementById("A7Image"+prdID+"")!= null)
		{
			document.getElementById("A7Image"+prdID+"").style.display = "inline";
		}
		if(document.getElementById("GiftImage"+prdID+"")!= null)
		{
			document.getElementById("GiftImage"+prdID+"").style.display = "none";
		}
	}
	else
	if(imgType == 4)
	{
		if(document.getElementById("characterImage"+prdID+"")!= null)
		{
			document.getElementById("characterImage"+prdID+"").style.display = "none";
		}
		if(document.getElementById("A2Image"+prdID+"")!= null)
		{
			document.getElementById("A2Image"+prdID+"").style.display = "none";
		}
		if(document.getElementById("A7Image"+prdID+"")!= null)
		{
			document.getElementById("A7Image"+prdID+"").style.display = "none";
		}
		if(document.getElementById("GiftImage"+prdID+"")!= null)
		{
			document.getElementById("GiftImage"+prdID+"").style.display = "inline";
		}
	}
}
function showPrices(packageType,prdID)
{
	//alert(packageType);
	ajaxpagePOST('../content/showPrices.php',"packageType="+packageType+"&prdID="+prdID+"&showType=price", "prdPrice"+prdID+"","");
	ajaxpagePOST('../content/showPrices.php',"packageType="+packageType+"&prdID="+prdID+"&showType=optgift", "prdOptGift"+prdID+"","");
	ajaxpagePOST('../content/showPrices.php',"packageType="+packageType+"&prdID="+prdID+"&showType=shippingprice", "prdShipPrice"+prdID+"","");
}
function fast_add_to_cart(prd_id,div_id)
{
	ajaxpage('../content/process_cart.php?sb_prd_id='+prd_id+'&sb_prd_qty='+document.getElementById('Qty'+prd_id+'').value+'&sb_prd_size='+document.getElementById('packageType'+prd_id+'').value+'', div_id,'');
	setTimeout("alert('"+document.getElementById('Qty'+prd_id+'').value+" Item(s) added to your cart.');",1000);
}
function checkOGWrappingForm(pID,psID,prID)
{
	if(document.OGWrappingForm.optGreeting.value == "" || document.OGWrappingForm.optGreeting.value == "Please enter your greeting...")
	{
		alert("Please enter a value for the \"Greeting\" field.");
		document.OGWrappingForm.optGreeting.value= "";
		document.OGWrappingForm.optGreeting.focus();
		return false;
	}
	else
	if(document.OGWrappingForm.optGreetingType.value == "")
	{
		alert("Please select a value for the \"Option\" field.");
		document.OGWrappingForm.optGreetingType.focus();
		return false;
	}
	/*else
	{
		var new_embed_code = '';
		if(document.OGWrappingForm.optGreeting.value != "")
		{
			new_embed_code = document.OGWrappingForm.optGreeting.value.replace(/&/gi,"@_@");
		}
		var myArray = document.OGWrappingForm.optGreetingType.value.split('_');
		
		//ajaxpage('content/checkOGWrappingForm.php?prdID='+myArray[0]+'&prdsizeID='+myArray[1]+'&prdPrice='+prID+'&optGreeting='+new_embed_code+'', 'prdOptGift','');
		//setTimeout("jQuery(document).trigger('close.facebox');", 1000);
	}*/
}
function chk_newsletter_signup_form()
{
	if(document.news_letter_signup.news_name.value == "" || document.news_letter_signup.news_name.value == "Enter your full name")
	{
		alert("Please enter a value for the \"Name\" field.");
		document.news_letter_signup.news_name.focus();
		return false;
		}
	if(document.news_letter_signup.news_email.value == "" || document.news_letter_signup.news_email.value == "Enter your email address")
	{
		alert("Please enter a value for the \"Email\" field.");
		document.news_letter_signup.news_email.focus();
		return false;
		}
	if(!validateEmail(document.news_letter_signup.news_email.value))
	{
		alert("Please enter a valid value for the \"Email\" field.");
		document.news_letter_signup.news_email.focus();
		return false;
		}
	document.news_letter_signup.submit();	
}
function chk_retailer_signin_form()
{
	if(document.LoginForm.m_username.value == "" || document.LoginForm.m_username.value == "E-mail Address")
	{
		alert("Please enter a value for the \"E-mail Address\" field.");
		document.LoginForm.m_username.focus();
		return false;
		}
	if(!validateEmail(document.LoginForm.m_username.value))
	{
		alert("Please enter a valid value for the \"Email\" field.");
		document.LoginForm.m_username.focus();
		return false;
		}
	if(document.LoginForm.m_password.value == "" || document.LoginForm.m_password.value == "Password")
	{
		alert("Please enter a value for the \"Password\" field.");
		document.LoginForm.m_password.focus();
		return false;
		}
}
function chk_mouseover_value(typ,val)
{
	if(document.getElementById(typ).value == val)
	{
		document.getElementById(typ).value = '';
	}
}
function chk_mouseout_value(typ,val)
{
	if(document.getElementById(typ).value == '')
	{
		document.getElementById(typ).value = val;
		document.getElementById(typ).style.color="#C0C0C0";
	}
}
function style_input(typ)
{
	document.getElementById(typ).style.color="#000000";
}
function chk_availability_form()
{
	if(document.chk_availability.avl_name.value == "")
	{
		alert("Please enter a value for the \"Name\" field.");
		document.chk_availability.avl_name.focus();
		return false;
		}
	if(document.chk_availability.avl_organization.value == "")
	{
		alert("Please enter a value for the \"Organization\" field.");
		document.chk_availability.avl_organization.focus();
		return false;
		}
	if(document.chk_availability.avl_phone.value == "")
	{
		alert("Please enter a value for the \"Phone\" field.");
		document.chk_availability.avl_phone.focus();
		return false;
		}
	if(document.chk_availability.avl_email.value == "")
	{
		alert("Please enter a value for the \"Email\" field.");
		document.chk_availability.avl_email.focus();
		return false;
		}
	if(!validateEmail(document.chk_availability.avl_email.value))
	{
		alert("Please enter a valid value for the \"Email\" field.");
		document.chk_availability.avl_email.focus();
		return false;
		}
}
function chk_availability_form2()
{
	document.chk_availability.avl_name.value ='';
	document.chk_availability.avl_organization.value = '';
	document.chk_availability.avl_phone.value = '';
	document.chk_availability.avl_email.value = '';
	document.chk_availability.avl_name.focus();
	return false;
}
function chk_form_quote()
{
	
	if(document.quote.name.value == "")
	{
		alert("Name is a reqired field!");
		document.quote.name.focus();
		return false;
		}
	if(document.quote.email.value == "")
	{
		alert("Email Address is a reqired field!");
		document.quote.email.focus();
		return false;
		}
	if(!validateEmail(document.quote.email.value))
	{
		alert("Email Address is a valid format!");
		document.quote.email.focus();
		return false;
		}
	if(document.quote.phone.value == "")
	{
		alert("Phone is a reqired field!");
		document.quote.phone.focus();
		return false;
		}
	if(document.quote.description.value == "")
	{
		alert("Description is a reqired field!");
		document.description.phone.focus();
		return false;
		}
}

function ppc_checkform()
{
		if (document.ppc_Registerform.ppc_Name.value == "")
		{
			alert("Please Enter Your Name");
			document.ppc_Registerform.ppc_Name.focus();
			return (false);
		}
 		if (document.ppc_Registerform.ppc_Email.value == "")
		{
			alert("Please Enter Your E-Mail");
			document.ppc_Registerform.ppc_Email.focus();
			return (false);
		}
		else
		if(!validateEmail(document.ppc_Registerform.ppc_Email.value))
		{
			alert("Please enter a valid value for the \"Email\" field.");
			document.ppc_Registerform.ppc_Email.focus();
			return false;
		}
		if (document.ppc_Registerform.ppc_PhoneNumber.value == "")
		{
			alert("Please Enter Your Phone Number");
			document.ppc_Registerform.ppc_PhoneNumber.focus();
			return (false);
		}
		
		//document.ppc_Registerform.ppc_submit();
		//return(true);
}
function checkshorRFQ()
{
	if(document.formrfq.namerfq.value == "")
	{
		alert("Please enter a value for the \"Your Name\" field.");
		document.formrfq.namerfq.focus();
		return false;
		}
	/*if(document.formrfq.companyrfq.value == "")
	{
		alert("Please enter a value for the \"Business Name\" field.");
		document.formrfq.companyrfq.focus();
		return false;
		}
	if(document.formrfq.emailrfq.value == "")
	{
		alert("Please enter a value for the \"Email\" field.");
		document.formrfq.emailrfq.focus();
		return false;
		}
	if(!validateEmail(document.formrfq.emailrfq.value))
	{
		alert("Please enter a valid value for the \"Email\" field.");
		document.formrfq.emailrfq.focus();
		return false;
		}*/
	if(document.formrfq.phonerfq.value == "")
	{
		alert("Please enter a value for the \"Phone Number\" field.");
		document.formrfq.phonerfq.focus();
		return false;
		}
	if(document.formrfq.areasrfq.value == "")
	{
		alert("Please select a value for the \"Location\" field.");
		document.formrfq.areasrfq.focus();
		return false;
		}
}
function validateEmail(elementValue)
{
	var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;
 	return emailPattern.test(elementValue); 
}
//////////////////Text area counter check////////
function textCounter(field,counter,maxlimit,linecounter) {
		// text width//
		var fieldWidth =  parseInt(field.offsetWidth);
		var charcnt = field.value.length;        
	
		// trim the extra text
		if (charcnt > maxlimit) { 
			field.value = field.value.substring(0, maxlimit);
		}
	
		else { 
		// progress bar percentage
		var percentage = parseInt(100 - (( maxlimit - charcnt) * 100)/maxlimit) ;
		document.getElementById(counter).style.width =  parseInt((fieldWidth*percentage)/100)+"px";
		document.getElementById(counter).innerHTML="Limit: "+percentage+"%"
		// color correction on style from CCFFF -> CC0000
		setcolor(document.getElementById(counter),percentage,"background-color");
		}
	}
	
	function setcolor(obj,percentage,prop){
		obj.style[prop] = "rgb(80%,"+(100-percentage)+"%,"+(100-percentage)+"%)";
	}
