function popUp(URL,width,height){day=new Date();id=day.getTime();eval("page"+id+"=window.open(URL,'"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width="+width+",height="+height+",left=126,top= 0');");}function popUpforuploader(URL,id,width,height){eval("page"+id+"=window.open(URL,'"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=550,height=800,left = 126,top = 0');");}
function showdivs(divid){var element=document.getElementById(divid).style.display;if(element=='block')document.getElementById(divid).style.display='none';else document.getElementById(divid).style.display='block';}function taketootherpage(page){document.location=page;}function createCookie(name,value,days){if(days){var date=new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires=";expires="+date.toGMTString();}else var expires="";document.cookie=name+"="+value+expires+";path=/";}function readCookie(name){var nameEQ=name+"=";var ca=document.cookie.split(';');
for(var i=0;i<ca.length;i++){var c = ca[i];while(c.charAt(0)==' ')c=c.substring(1,c.length);if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length);}return null;}function eraseCookie(name){createCookie(name,"",-1);}
function IsNumeric(sText){var ValidChars = "0123456789.";var IsNumber=true;var Char;for(i=0;i<sText.length&&IsNumber== true;i++){Char=sText.charAt(i);if(ValidChars.indexOf(Char)==-1){IsNumber=false;}}return IsNumber;}function trimAll( strValue){var objRegExp=/^(\s*)$/;if(objRegExp.test(strValue)){strValue=strValue.replace(objRegExp,'');if( strValue.length==0)return strValue;}objRegExp=/^(\s*)([\W\w]*)(\b\s*$)/;if(objRegExp.test(strValue)){strValue=strValue.replace(objRegExp,'$2');}return strValue;}function validateNotEmpty(strValue){var strTemp=strValue;strTemp=trimAll(strTemp);if(strTemp.length>0){return true;}return false;}function get_cookie(Name){var search=Name+"=";var returnvalue="";if(document.cookie.length>0){offset=document.cookie.indexOf(search);if(offset!=-1){offset+=search.length;end=document.cookie.indexOf(";", offset);if(end==-1)end=document.cookie.length;returnvalue=unescape(document.cookie.substring(offset,end))}}return returnvalue;}function pad_with_zeros(rounded_value,decimal_places){var value_string=rounded_value.toString();var decimal_location = value_string.indexOf(".");if(decimal_location==-1){decimal_part_length=0;value_string+=decimal_places >0?".":"";}else{decimal_part_length=value_string.length-decimal_location-1;}var pad_total=decimal_places- decimal_part_length;if(pad_total>0){for(var counter=1;counter<=pad_total;counter++) value_string += "0";}return value_string;}function round_decimals(original_number,decimals){var result1=original_number*Math.pow(10,decimals);
var result2=Math.round(result1);var result3=result2/Math.pow(10,decimals);return pad_with_zeros(result3,decimals);}
function showblocks(mydiv){document.getElementById('accountinfo').style.display='none';document.getElementById('shipnbill').style.display='none';document.getElementById('ordhistory').style.display='none';document.getElementById('mywishlist').style.display='none';document.getElementById(mydiv).style.display='block';}function showdescorreview(nam){document.getElementById('mydesc').style.display='none';document.getElementById('myreview').style.display='none';document.getElementById(nam).style.display='block';}function emptybox(name){document.getElementById(name).innerHTML='';}function cleanup(){document.getElementById('search-box-style').value="";}function showup(){var val=trimAll(document.getElementById('search-box-style').value);if(val==''){document.getElementById('search-box-style').value="Search";}}function checkifdeliveryopt(){if(document.getElementById('cost').value==''){alert("Select Delivery Option");return false;}}
function showdeliverycost(){if(document.getElementById('costopt').style.display=='none')document.getElementById('costopt').style.display='block';else if  (document.getElementById('costopt').style.display=='block'){document.getElementById('costopt').style.display='none';}}function showshowaddress(){document.getElementById('showaddress').style.display='block';}function validatebillingddress(frm){

	var ischecked=false;if(document.getElementById('radiobuttonsame').checked==true)  {
checkputvalue(frm);

	ischecked=true;
}
else if(document.getElementById('radiobuttondiff').checked==true)ischecked=true;if(ischecked==false){alert("Select Billing Option");return false;}else {
/*checkzips();*/
/*checkcities();*/
checkfields();
/*checkzipsbilling();*/
/*checkcitiesbilling();*/
}}
function popUpforuploader(URL,id,width,height){eval("page"+id+"=window.open(URL,'"+id+"', 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=550,height=800,left = 126,top = 0');");}
function showopts(){
document.getElementById('subsopts').style.display='block';
}
function hideopts(){
document.getElementById('subsopts').style.display='none';
}
/*function resetcost(){
 	document.getElementById("costid").value='';
	document.getElementById("cost").value='';
	document.getElementById("cost").value='';
	document.getElementById('resettext').style.display='none';
	document.getElementById('radio').checked=false;
 }*/
 

function WordCountDesc(fld) {
      var msgStr = "The maximum amount of words of 50 has been reached";
      var words = fld.value.split (/[\s{1,}]/);
      document.getElementById('wordcntdesc').innerHTML = 'Count of words ' + words.length;
      if (words.length >= 50) { alert (msgStr); }
}
function WordCountKey(fld) {
      var msgStr = "The maximum amount of words of 50 has been reached";
      var words = fld.value.split (/[\s{1,}]/);
      document.getElementById('wordcntkey').innerHTML = 'Count of words ' + words.length;
      if (words.length >= 50) { alert (msgStr); }
}
    function CharactercountCount(fld) {
               var msgStr = "The maximum amount of characters of 255 has been reached";
               var letters = fld.value;
			    document.getElementById('titlecntchar').innerHTML = 'Count of characters ' + letters.length;
               if (letters.length == 255) { alert (msgStr); }
}

function DisplayFormValues(formname)
{

var str = '';

var elem = document.getElementById(formname).elements;

	for(var i = 0; i < elem.length; i++)
	{
		//var formname='form1';
		var elemname=elem[i];
		var thisvalue=elem[i].value
		if (thisvalue!=''){
			forminput=myfunc(thisvalue);
			if (forminput==false)
			return forminput;
		}
	}
	return forminput;
}
function strtolower( str ) {


var returnvar=str.toLowerCase();

    return returnvar;
	
}

function myfunc(myval)
{
	var iChars = "%#^&+=[]\';/{}\":<>?";
	var scriptcarstart="<script>";
	var scriptcar="</script>";
	var objectcarstart="<object>";
	var objectcarend="</object>";
	var embedstart="<embed>";
	var embedend="</embed>";
	var alertvar="alert";


    for (var i = 0; i < myval.length; i++) {
  		if (iChars.indexOf(myval.charAt(i)) != -1) 
  		{
  			alert("Containts special characters. \n These are not allowed.\n Please remove them and try again.");
			 inputstate=false;
			 return false;
  		}
	 }	
	 var lowermyval=strtolower( myval );

	 if (lowermyval.indexOf(scriptcar) != -1) 
  		{
  			alert("Wrong Type input");
			 inputstate=false;
			 return false;
  		}
	 if (lowermyval.indexOf(scriptcar) != -1) 
  		{
  			alert("Wrong Type input");
			 inputstate=false;
			 return false;
  		}
	 if (lowermyval.indexOf(objectcarstart)  != -1) 
  		{
  			alert("Wrong Type input");
			 inputstate=false;
			 return false;
  		}
	 if (lowermyval.indexOf(objectcarend) != -1) 
  		{
  			alert("Wrong Type input");
			 inputstate=false;
			 return false;
  		}
		
	 if (lowermyval.indexOf(embedstart) != -1) 
  		{
  			alert("Wrong Type input");
			 inputstate=false;
			 return false;
  		}
	 if (lowermyval.indexOf(embedend) != -1) 
  		{
  			alert("Wrong Type input");
			 inputstate=false;
			 return false;
  		}

/*var aPosition = lowermyval.indexOf(alertvar);
alert(aPosition);*/

	 if (lowermyval.indexOf(alertvar) != -1) 
  		{
  			alert("Wrong Type input");
			 inputstate=false;
			 return false;
  		}
	 return true;
 }

