
function trim(str){
	return str.replace(/^\s*|\s*$/g,"");
}

function isEmail(email, msg){
	if(!(/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(trim(email.value)))){
	 alert(msg);
	 email.focus();
	 return false;
	 } else return true;
}

function isValid(ctrl, chkval, msg){
	if(trim(ctrl.value)== trim(chkval)){
		alert(msg);
		ctrl.focus();
		return false;
	} else return true;
}

function chkSelection(frm){
	flag = 0;
	for(i=0; i < frm.elements.length; i++){
		if(frm.elements[i].type == "checkbox"){
			if(frm.elements[i].checked){
				flag = 1;
			}
		}
	}
	if(flag == 0) return false; else return true;
}

Array.prototype.in_array = function(p_val) {
	for(var i = 0, l = this.length; i < l; i++) {
		if(this[i] == p_val) {
			return true;
		}
	}
	return false;
}

function isUrl(s, msg) {
  	var regexp = /(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/ 
  	if(!regexp.test(s.value)) {
		alert(msg);
		s.focus();
		return false;
	} else return true;
}

/****************/

function isValidEmail(emailField){ 
   // var emailregex=/^[\w]+\+?\w*@[\w]+\.[\w.]+\w$/; 
   var emailregex=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
    var match=emailField.match(emailregex); 
    if ( !match ) { 
       return false; 
    } else{
       return true; 
    }
}


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 contactusValidate(){
   var objFrm=document.form_contactus
   if(trim(objFrm.name.value)==""){
     alert("Please enter name.");
	 objFrm.name.focus();
	 return false;
   }
   if(trim(objFrm.email.value)==""){
     alert("Please enter an email address.");
	 objFrm.email.focus();
	 return false;
   }
    if(!isValidEmail(objFrm.email.value)){
		alert("Please enter valid email address.");
		objFrm.email.focus();
		return false;
	}
    if(trim(objFrm.phone.value)==""){
     alert("Please enter phone number.");
	 objFrm.phone.focus();
	 return false;
   }
   
    if(trim(objFrm.comments.value)==""){
     alert("Please enter comments.");
	 objFrm.comments.focus();
	 return false;
   }
	if(trim(objFrm.private_key.value)==""){
     alert("Please enter security code.");
	 objFrm.private_key.focus();
	 return false;
   }
   return true;
}

function resellerValidate(){
   var objFrm=document.form_reseller;
   if(trim(objFrm.realname.value)=="")
   {
     alert("Please enter name.");
	 objFrm.realname.focus();
	 return false;
   }
   if(trim(objFrm.companyname.value)=="")
   {
     alert("Please enter company name.");
	 objFrm.companyname.focus();
	 return false;
   }
   if(trim(objFrm.email.value)=="")
   {
     alert("Please enter an email address.");
	 objFrm.email.focus();
	 return false;
   }
   if(!isValidEmail(objFrm.email.value))
	{
		alert("Please enter valid email address.");
		objFrm.email.focus();
		return false;
	}
    if(trim(objFrm.telephone.value)=="")
   {
     alert("Please enter telephone number.");
	 objFrm.telephone.focus();
	 return false;
   }
   
   if(trim(objFrm.address1.value)=="")
   {
     alert("Please enter address.");
	 objFrm.address1.focus();
	 return false;
   }
   if(trim(objFrm.city.value)=="")
   {
     alert("Please enter city.");
	 objFrm.city.focus();
	 return false;
   }
   if(trim(objFrm.country.value)=="")
   {
     alert("Please enter country.");
	 objFrm.country.focus();
	 return false;
   }
   if(trim(objFrm.signedby.value)=="")
   {
     alert("Please enter name.");
	 objFrm.signedby.focus();
	 return false;
   }
   
	if(trim(objFrm.private_key.value)=="")
   {
     alert("Please enter security code.");
	 objFrm.private_key.focus();
	 return false;
   }
   return true;
    
}	

function addTempCart(pId){
	location.href="viewCart/index.php?addpId="+pId;
}

function addToCart(pId){
	location.href="vibration_exercise_accessories.php?addpId="+pId;
}


//billing js
function billValidate(){
  var objFrm=document.frmbilling
  if(trim(objFrm.txtBillingFirstName.value)=="")
   {
     alert("Please enter billing first name.");
	 objFrm.txtBillingFirstName.focus();
	 return false;
   }
    if(trim(objFrm.txtBillingLastName.value)=="")
   {
     alert("Please enter billing last name.");
	 objFrm.txtBillingLastName.focus();
	 return false;
   }
    if(trim(objFrm.txtBillingEmail.value)=="")
   {
     alert("Please enter billing email address.");
	 objFrm.txtBillingEmail.focus();
	 return false;
   }
	
	 if(!isValidEmail(objFrm.txtBillingEmail.value))
	{
		alert("Please enter valid billing email address.");
		objFrm.txtBillingEmail.focus();
		return false;
	}
	
	 if(trim(objFrm.txtBillingAddress.value)=="")
   {
     alert("Please enter billing address line 1.");
	 objFrm.txtBillingAddress.focus();
	 return false;
   }
	
	 if(trim(objFrm.txtBillingCity.value)=="")
   {
     alert("Please enter billing town/city.");
	 objFrm.txtBillingCity.focus();
	 return false;
   }
	
	
	 
	 if(trim(objFrm.txtBillingState.value)=="")
   {
     alert("Please enter billing state.");
	 objFrm.txtBillingState.focus();
	 return false;
   }
   
  
   
    if(trim(objFrm.txtBillingPostalCode.value)=="")
   {
     alert("Please enter billing postcode.");
	 objFrm.txtBillingPostalCode.focus();
	 return false;
   }
      
    if(trim(objFrm.selBillingCountry.value)=="")
   {
     alert("Please select billing country.");
	 objFrm.selBillingCountry.focus();
	 return false;
   }
   
   
   if(trim(objFrm.selProvince.value)=="")
   {
     alert("Please select billing province.");
	 objFrm.selProvince.focus();
	 return false;
   }
   
    if(trim(objFrm.txtBillingPhone.value)=="")
   {
     alert("Please enter billing phone no.");
	 objFrm.txtBillingPhone.focus();
	 return false;
   }else{
   		phone = objFrm.txtBillingPhone;
		var iChars = "!@$%^&=[]~`\\\';,./{}|\":<>?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		for (var i = 0; i < phone.value.length; i++)
		{ 
			if (iChars.indexOf(phone.value.charAt(i)) != -1)
			{
				alert ("Please enter valid billing phone no. Allowed numeric and symbols like:  -, (, ) only.");
				phone.focus();
				return false;
			}
		}
   }
	
     if(trim(objFrm.txtShippingFirstName.value)=="")
   {
     alert("Please enter shipping first name.");
	 objFrm.txtShippingFirstName.focus();
	 return false;
   }
    if(trim(objFrm.txtShippingLastName.value)=="")
   {
     alert("Please enter shipping last name.");
	 objFrm.txtShippingLastName.focus();
	 return false;
   }
    if(trim(objFrm.txtShippingEmail.value)=="")
   {
     alert("Please enter shipping email address.");
	 objFrm.txtShippingEmail.focus();
	 return false;
   }
	
	 if(!isValidEmail(objFrm.txtShippingEmail.value))
	{
		alert("Please enter valid shipping email address.");
		objFrm.txtShippingEmail.focus();
		return false;
	}
	
	 if(trim(objFrm.txtShippingAddress.value)=="")
   {
     alert("Please enter shipping address line 1.");
	 objFrm.txtShippingAddress.focus();
	 return false;
   }
	
	 if(trim(objFrm.txtShippingCity.value)=="")
   {
     alert("Please enter shipping town/city.");
	 objFrm.txtShippingCity.focus();
	 return false;
   }
	
	
	 if(trim(objFrm.txtShippingState.value)=="")
   {
     alert("Please enter shipping state.");
	 objFrm.txtShippingState.focus();
	 return false;
   }
   
   
    if(trim(objFrm.txtShippingPostalCode.value)=="")
   {
     alert("Please enter shipping postcode.");
	 objFrm.txtShippingPostalCode.focus();
	 return false;
   }
      
   if(trim(objFrm.txtShippingPostalCode.value)!=""){
   		var postcode = objFrm.txtShippingPostalCode.value;
		postcode = postcode.toString();
		var state = zip2st(postcode);
		if (state) {
			result = ''+rate[st2rate[state]];
			posPoint = result.indexOf('.');
			if (posPoint==-1) {
				result = "$" + result + ".00";
			} else{
				if((result.toString().length-posPoint)==2) {
					result = "$" + result + "0";
				} else {
					result = "$" + result;
				}
			}
		} else {
			result = "Please enter valid shipping postcode/zipcode.";
			alert(result);
			objFrm.txtShippingPostalCode.focus();
			return false;
		}
		document.frmbilling.ship_code.value=state;
   }
    if(trim(objFrm.selShippingCountry.value)==""){
     alert("Please enter shipping country.");
	 objFrm.selShippingCountry.focus();
	 return false;
   }
    if(trim(objFrm.txtShippingPhone.value)==""){
     alert("Please enter shipping phone no.");
	 objFrm.txtShippingPhone.focus();
	 return false;
   }else{
   		phone = objFrm.txtShippingPhone;
		var iChars = "!@$%^&=[]~`\\\';,./{}|\":<>?abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ";
		for (var i = 0; i < phone.value.length; i++)
		{ 
			if (iChars.indexOf(phone.value.charAt(i)) != -1)
			{
				alert ("Please enter valid shipping phone no. Allowed numeric and symbols like:  -, (, ) only.");
				phone.focus();
				return false;
			}
		}
   }
}

var rate = new Array;
rate[1] = 55;
rate[2] = 65;
rate[3] = 70;
rate[4] = 95;
rate[5] = 120;
rate[6] = 190;
// Please set Domestic Rate
var st2rate = new Array;
st2rate['SYD'] = 2;
st2rate['ACT'] = 3;
st2rate['NSW'] = 2;
st2rate['BNE'] = 1;
st2rate['QLS'] = 2;
st2rate['QLN'] = 4;
st2rate['QLC'] = 3;
st2rate['MEL'] = 3;
st2rate['VIC'] = 4;
st2rate['TAS'] = 6;
st2rate['ADL'] = 3;
st2rate['SA'] = 4;
st2rate['DWN'] = 6;
st2rate['NT'] = 6;
st2rate['PTH'] = 5;
st2rate['WAS'] = 6;
st2rate['WAN'] = 6;
// select ST by PostCode
function zip2st(postcode) {
/*
var ST = new Array("ACT","DWN","NT","SYD","NSW","BNE","QLS","VIC","SA","MEL","QLN","QLC","ADL","PTH","WAS","WAN","TAS");
if (postcode > 10000) {
return '';
}
var ST_ZIP = new Array;
ST_ZIP[0] = new Array("0200","2580","2582", "2600-2620","2630","2640-2643","2646-2647","2900-2914","3685-3687","3690-3694","3730","3747-3749");
ST_ZIP[1] = new Array("0800-0821","0828-0836","0870-0871","0900-0909");
ST_ZIP[2] = new Array("0822","0837-0862","0872-0886");
ST_ZIP[3] = new Array("1000-2310","2314-2320","2322-2328","2333","2335","2500-2530","2533","2558-2570","2740-2756","2759-2770","2775","2890-2891");
ST_ZIP[4] = new Array("2311-2312","2321","2329-2331","2334","2336-2484","2487-2488","2490","2532","2534-2551","2571-2579","2581","2583-2594","2621-2628","2631-2633","2645","2648","2650-2652","2655-2656","2661-2707","2710-2711","2713-2739","2757-2758","2773-2774","2776-2879","2898");
ST_ZIP[5] = new Array("2485-2486","4000-4132","4151-4179","4184-4230","4300-4305","4350","4500-4504","4508","4550-4553","4555-4569","4571-4575","9000-9729");
ST_ZIP[6] = new Array("2489","4133","4183","4270-4287","4306-4347","4352-4467","4471","4474","4479","4487","4494-4498","4505-4507","4509-4521","4554","4570","4580-4680","4700-4701","4703","4716");
ST_ZIP[7] = new Array("2644","2649","2653","2658-2660","2708","2712","3024","3222-3336","3338-3683","3688-3689","3695-3729","3731-3746","3753","3756-3758","3760-3764","3770-3781","3783","3797-3799","3811-3909","3922-3925","3927","3938","3945-3971","3979","3981-3988","3990-3991","3995-3996");
ST_ZIP[8] = new Array("2880","5118-5120","5131-5157","5170-5734");
ST_ZIP[9] = new Array("3000-3023","3025-3221","3337","3750-3752","3754-3755","3759","3765-3767","3782","3785-3796","3800-3810","3910-3921","3926","3928-3937","3939-3944","3975-3987","3980","3989","3992","8001-8659");
ST_ZIP[10] = new Array("4468-4470","4472","4475-4478","4480-4486","4488-4493","4694-4699","4702","4704-4715","4717-4739","4741-4746","4751-4809","4816","4820-4824","4828-4865","4871-4876","4880-4891");
ST_ZIP[11] = new Array("4740","4750","4810-4815","4817-4819","4825","4868-4870","4878-4879");
ST_ZIP[12] = new Array("5000-5117","5121-5127","5158-5169","5800-5950");
ST_ZIP[13] = new Array("6000-6032","6050-6083","6090-6112","6147-6160","6162-6172","6803-6997");
ST_ZIP[14] = new Array("6033-6044","6084","6113-6126","6161","6173-6428","6430","6432-6433","6438","6441","6443","6445-6532","6553-6628","6631-6632");
ST_ZIP[15] = new Array("6429","6431","6434-6437","6439-3440","6442","64444","6535-6537","6630","6635-6770");
ST_ZIP[16] = new Array("7000-7901");

var tempZC1,tempZC2;

for ( var row = 0; row < ST_ZIP.length; ++row ) {
for ( var column = 0; column < ST_ZIP[row].length; ++column ) 
{
	
	if ( ST_ZIP[row][column].substr(4, 1) == "-" ) 
	{
		tempZC1 = ST_ZIP[row][column].substr(0, 4);
		tempZC2 = ST_ZIP[row][column].substr(5, 4);
		
		tempZC1 = tempZC1.toString();
		tempZC2 = tempZC2.toString();
				
		if ( postcode >= tempZC1 && postcode <= tempZC2 ) 
		{			
			return ST[row];
		}
	}else if ( ST_ZIP[row][column].substr(3, 1) == "." 	)
	{
		tempZC1 = ST_ZIP[row][column].substr(0, 3);
		tempZC2 = ST_ZIP[row][column].substr(4, 3);
		
		tempZC1 = tempZC1.toString();
		tempZC2 = tempZC2.toString();
		
		if ( postcode >= tempZC1 && postcode <= tempZC2 ) 
		{
			return ST[row];
		}
	}else
	{
		tempZC1 = ST_ZIP[row][column];
		tempZC1 = tempZC1.toString();
		if ( postcode == tempZC1) 
		{
			return ST[row];
		}
	}
}
}
return '';
*/
return true;
}
// Calculate
function buttonPressed(){
	alert(document.frmbilling.txtShippingPostalCode.value);
	var postcode = parseInt(document.frmbilling.txtShippingPostalCode.value);
	var state = zip2st(postcode);
if(state) {
	alert(state);
	result = ''+rate[st2rate[state]];
	posPoint = result.indexOf('.');
	if (posPoint==-1) {
		result = "$" + result + ".00";
		alert(result);
	} else {
	if((result.toString().length-posPoint)==2) {
		result = "$" + result + "0";
		alert(result);
	}else{
		result = "$" + result;
		alert(result);
	}
}
} else {
	result = "postcode entered is not valid";
	alert(result);
	return false;
}
	postageForm.postageFee.value = result;
	alert(postageForm.postageFee.value);
}

function fillValue(opt){
	if(opt == true)
	{
		document.frmbilling.txtShippingFirstName.value=document.frmbilling.txtBillingFirstName.value;
		document.frmbilling.txtShippingLastName.value=document.frmbilling.txtBillingLastName.value;
		document.frmbilling.txtShippingEmail.value=document.frmbilling.txtBillingEmail.value;
		document.frmbilling.txtShippingAddress.value=document.frmbilling.txtBillingAddress.value;
		document.frmbilling.txtShippingCity.value=document.frmbilling.txtBillingCity.value;
		document.frmbilling.txtShippingState.value=document.frmbilling.txtBillingState.value;
		document.frmbilling.txtShippingPostalCode.value=document.frmbilling.txtBillingPostalCode.value;
		document.frmbilling.selShippingCountry.value=document.frmbilling.selBillingCountry.value;
		document.frmbilling.txtShippingPhone.value=document.frmbilling.txtBillingPhone.value;
		document.frmbilling.txtShippingPhone2.value=document.frmbilling.txtBillingPhone2.value;	
		document.frmbilling.txtShippingAddress2.value=document.frmbilling.txtBillingAddress2.value;	
	} 
	else 
	{
		document.frmbilling.txtShippingFirstName.value='';
		document.frmbilling.txtShippingLastName.value='';
		document.frmbilling.txtShippingEmail.value='';
		document.frmbilling.txtShippingAddress.value='';
		document.frmbilling.txtShippingAddress2.value='';
		document.frmbilling.txtShippingPhone.value='';
		document.frmbilling.txtShippingPhone2.value='';
		document.frmbilling.txtShippingState.value='';
		document.frmbilling.txtShippingCity.value='';
		document.frmbilling.txtShippingPostalCode.value='';
		document.frmbilling.selShippingCountry.value='';
	}
}

function fillValue_userend(opt){
	if(opt == true)
	{
		document.frmbilling.txtShippingFirstName.value=document.frmbilling.txtBillingFirstName.value;
		document.frmbilling.txtShippingLastName.value=document.frmbilling.txtBillingLastName.value;
		document.frmbilling.txtShippingEmail.value=document.frmbilling.txtBillingEmail.value;
		document.frmbilling.txtShippingAddress.value=document.frmbilling.txtBillingAddress.value;
		document.frmbilling.txtShippingCity.value=document.frmbilling.txtBillingCity.value;
		document.frmbilling.txtShippingState.value=document.frmbilling.txtBillingState.value;
		document.frmbilling.txtShippingPostalCode.value=document.frmbilling.txtBillingPostalCode.value;
		document.frmbilling.selShippingCountry.value=document.frmbilling.selBillingCountry.value;
		document.frmbilling.txtShippingPhone.value=document.frmbilling.txtBillingPhone.value;
		document.frmbilling.txtShippingPhone2.value=document.frmbilling.txtBillingPhone2.value;			
	} 
	else 
	{
		document.frmbilling.txtShippingFirstName.value='';
		document.frmbilling.txtShippingLastName.value='';
		document.frmbilling.txtShippingEmail.value='';
		document.frmbilling.txtShippingAddress.value='';		
		document.frmbilling.txtShippingPhone.value='';
		document.frmbilling.txtShippingPhone2.value='';
		document.frmbilling.txtShippingState.value='';
		document.frmbilling.txtShippingCity.value='';
		document.frmbilling.txtShippingPostalCode.value='';
		document.frmbilling.selShippingCountry.value='';
	}
}

function goToShop(url){
	location.href = url;
}

function goTobilling(){
	var test;
	if(validate()){	
		if(document.getElementById("refcode"))
		document.form1.refer_code.value=document.frmViewCart.refcode.value;
		document.form1.submit();
	} else return false;
}

function validate(){
	var i;
	if(document.frmViewCart.elements.length >2){
		ctrl = document.getElementsByName('txtQty[]');
		elmlen = ctrl.length;
		if(ctrl.length){
			for(i=0; i < elmlen; i++){
				getValue = ctrl[i].value;
				if(getValue == ''){	
					alert("Please enter quantity.");
					ctrl[i].focus();
					return false;
				}	
				if(getValue <= 0){	
					alert("Please enter quantity greater than 0.");
					ctrl[i].focus();
					return false;
				}		
				if(parseInt(getValue) != getValue){
					alert("Quantity should be numeric.");
					ctrl[i].focus();
					return false;
				}	
			}
		}
		ctrl = document.getElementsByName('txtPrice[]');
		elmlen = ctrl.length;
		if(ctrl.length){
			for(i=0; i < elmlen; i++){
				getValue = ctrl[i].value;
				if(getValue == ''){	
					alert("Please enter price.");
					ctrl[i].focus();
					return false;
				}	
				if(getValue < 1){	
					alert("Price should not be less than 1.");
					ctrl[i].focus();
					return false;
				}		
				if(parseInt(getValue) != getValue){
					alert("Price should be numeric.");
					ctrl[i].focus();
					return false;
				}	
			}
		}
	} else if((document.frmViewCart.elements.length <=2) && (document.frmViewCart.elements.length > 0)){
			alert("Please add product in your cart.");
			return false;
	}
	return true;
}

function productDelete(id){
	location.href='http://www.hypervibe.ca/viewCart/index.php?mode=del&pId=' + id;
}

function swfvibe(){ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="274" height="163">\n'); 
document.write('<param name="movie" value="http://www.hypervibe.ca/flashplayer.swf?autostart=true" />\n'); 
document.write('<param name="quality" value="high">\n'); 
document.write('<param name="wmode" value="transparent">\n'); 
document.write('<param name="flashvars" value="file=flv/animation.flv">\n'); 
document.write('<param name="autostart" value="true">\n'); 
document.write('<embed src="http://www.hypervibe.ca/flashplayer.swf?autostart=true" quality="high" wmode="transparent" width="274" height="163" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" flashvars="file=flv/adro_VP6_256K_Stream.flv"></embed>\n'); 
document.write('</object>\n'); 
} 
function swfhead(){ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="916" height="171">'); 
document.write('<param name="movie" value="http://www.hypervibe.ca/images/header2504.swf" />'); 
document.write('<param name="quality" value="high" />'); 
document.write('<param name="wmode" value="transparent" />'); 
document.write('<embed src="http://www.hypervibe.ca/images/header2504.swf" wmode="transparent" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="916" height="171"></embed>'); 
document.write('</object>'); 
} 

function swfvideo(){ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0" width="425" height="344">\n'); 
document.write('<param name="movie" value="http://www.youtube.com/v/h789q2943F0&amp;hl=en&amp;fs=1" />\n'); 
document.write('<param name="allowfullscreen" value="true">\n'); 
document.write('<embed src="http://www.youtube.com/v/h789q2943F0&amp;hl=en&amp;fs=1" width="425" height="344" allowfullscreen="true" type="application/x-shockwave-flash"></embed>\n'); 
document.write('</object>\n'); 
} 

function mmLoadMenus() {
  if (window.mm_menu_1202180622_0) return;
  window.mm_menu_1202180622_0 = new Menu("root",92,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  //mm_menu_1202180622_0.addMenuItem("Rejuvenate","window.open('http://www.hypervibe.ca/rejuvenate_vibration_machine.php', '_self');");
  mm_menu_1202180622_0.addMenuItem("Performance","window.open('http://www.hypervibe.ca/whole_body_vibration_machine.php', '_self');");
  mm_menu_1202180622_0.addMenuItem("Commercial","window.open('http://www.hypervibe.ca/commercial_vibration_machine.php', '_self');");
  mm_menu_1202180622_0.addMenuItem("Accessories","window.open('http://www.hypervibe.ca/vibration_exercise_accessories.php', '_self');");
   mm_menu_1202180622_0.hideOnMouseOut=true;
   mm_menu_1202180622_0.bgColor='#1C6200';
   mm_menu_1202180622_0.menuBorder=1;
   mm_menu_1202180622_0.menuLiteBgColor='';
   mm_menu_1202180622_0.menuBorderBgColor='#EAEAEA';
  window.mm_menu_1202184627_0 = new Menu("root",124,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202184627_0.addMenuItem("Technology","window.open('http://www.hypervibe.ca/vibration_technology.php', '_self');");
  mm_menu_1202184627_0.addMenuItem("Frequency&nbsp;Specific","window.open('http://www.hypervibe.ca/frequency_specific_vibration.php', '_self');");
  mm_menu_1202184627_0.addMenuItem("Programs","window.open('http://www.hypervibe.ca/vibration_programs.php', '_self');");
   mm_menu_1202184627_0.hideOnMouseOut=true;
   mm_menu_1202184627_0.bgColor='#1C6200';
   mm_menu_1202184627_0.menuBorder=1;
   mm_menu_1202184627_0.menuLiteBgColor='';
   mm_menu_1202184627_0.menuBorderBgColor='#EAEAEA';
window.mm_menu_1202185213_0 = new Menu("root",132,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202185213_0.addMenuItem("Benefits","window.open('http://www.hypervibe.ca/vibration_machine_benefits.php', '_self');");
  mm_menu_1202185213_0.addMenuItem("Contraindications","window.open('http://www.hypervibe.ca/vibration_machine_contraindications.php', '_self');");
   mm_menu_1202185213_0.hideOnMouseOut=true;
   mm_menu_1202185213_0.bgColor='#1C6200';
   mm_menu_1202185213_0.menuBorder=1;
   mm_menu_1202185213_0.menuLiteBgColor='';
   mm_menu_1202185213_0.menuBorderBgColor='#EAEAEA';
  window.mm_menu_1202185509_0 = new Menu("root",88,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202185509_0.addMenuItem("Press","window.open('http://www.hypervibe.ca/press.php', '_self');");
  mm_menu_1202185509_0.addMenuItem("Testimonials","window.open('http://www.hypervibe.ca/testimonials.php', '_self');");
  mm_menu_1202185509_0.addMenuItem("News","window.open('http://www.hypervibe.ca/news.php', '_self');");
   mm_menu_1202185509_0.hideOnMouseOut=true;
   mm_menu_1202185509_0.bgColor='#1C6200';
   mm_menu_1202185509_0.menuBorder=1;
   mm_menu_1202185509_0.menuLiteBgColor='';
   mm_menu_1202185509_0.menuBorderBgColor='#EAEAEA';

  window.mm_menu_1202185957_0 = new Menu("root",88,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202185957_0.addMenuItem("Return","window.open('http://www.hypervibe.ca/return_policy.php', '_self');");
  mm_menu_1202185957_0.addMenuItem("Payments","window.open('http://www.hypervibe.ca/payments.php', '_self');");
  mm_menu_1202185957_0.addMenuItem("Shipping","window.open('http://www.hypervibe.ca/shipping.php', '_self');");
  mm_menu_1202185957_0.addMenuItem("Faq","window.open('http://www.hypervibe.ca/faq.php', '_self');");
   mm_menu_1202185957_0.hideOnMouseOut=true;
   mm_menu_1202185957_0.menuBorder=1;
   mm_menu_1202185957_0.menuLiteBgColor='';
   mm_menu_1202185957_0.menuBorderBgColor='#EAEAEA';

  window.mm_menu_1202190158_0 = new Menu("root",115,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202190158_0.addMenuItem("Email","window.open('http://www.hypervibe.ca/email.php', '_self');");
  mm_menu_1202190158_0.addMenuItem("Locations","window.open('http://www.hypervibe.ca/locations.php', '_self');");
   mm_menu_1202190158_0.hideOnMouseOut=true;
   mm_menu_1202190158_0.menuBorder=1;
   mm_menu_1202190158_0.menuLiteBgColor='';
   mm_menu_1202190158_0.menuBorderBgColor='#EAEAEA';

  window.mm_menu_1202190255_0 = new Menu("root",97,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  //mm_menu_1202190255_0.addMenuItem("Rejuvenate","window.open('http://www.hypervibe.ca/rejuvenate_vibration_machine.php', '_self');");
  mm_menu_1202190255_0.addMenuItem("Performance","window.open('http://www.hypervibe.ca/whole_body_vibration_machine.php', '_self');");
  mm_menu_1202190255_0.addMenuItem("Commercial","window.open('http://www.hypervibe.ca/commercial_vibration_machine.php', '_self');");
  mm_menu_1202190255_0.addMenuItem("Accessories","window.open('http://www.hypervibe.ca/vibration_exercise_accessories.php', '_self');");
   mm_menu_1202190255_0.hideOnMouseOut=true;
   mm_menu_1202190255_0.bgColor='#1C6200';
   mm_menu_1202190255_0.menuBorder=1;
   mm_menu_1202190255_0.menuLiteBgColor='';
   mm_menu_1202190255_0.menuBorderBgColor='#EAEAEA';

  window.mm_menu_1202191215_0 = new Menu("root",140,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202191215_0.addMenuItem("Technology","window.open('http://www.hypervibe.ca/vibration_technology.php', '_self');");
  mm_menu_1202191215_0.addMenuItem("Frequency&nbsp;Specific","window.open('http://www.hypervibe.ca/frequency_specific_vibration.php', '_self');");
  mm_menu_1202191215_0.addMenuItem("Programs","window.open('http://www.hypervibe.ca/vibration_programs.php', '_self');");
   mm_menu_1202191215_0.hideOnMouseOut=true;
   mm_menu_1202191215_0.bgColor='#1C6200';
   mm_menu_1202191215_0.menuBorder=1;
   mm_menu_1202191215_0.menuLiteBgColor='#FFFFFF';
   mm_menu_1202191215_0.menuBorderBgColor='#EAEAEA';

  window.mm_menu_1202191457_0 = new Menu("root",129,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202191457_0.addMenuItem("Benefits","window.open('http://www.hypervibe.ca/vibration_machine_benefits.php', '_self');");
  mm_menu_1202191457_0.addMenuItem("Contraindications","window.open('http://www.hypervibe.ca/vibration_machine_contraindications.php', '_self');");
   mm_menu_1202191457_0.hideOnMouseOut=true;
   mm_menu_1202191457_0.bgColor='#1C6200';
   mm_menu_1202191457_0.menuBorder=1;
   mm_menu_1202191457_0.menuLiteBgColor='#ECE9D8';
   mm_menu_1202191457_0.menuBorderBgColor='#EAEAEA';

  window.mm_menu_1202191855_0 = new Menu("root",98,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202191855_0.addMenuItem("Press","window.open('http://www.hypervibe.ca/press.php', '_self');");
  mm_menu_1202191855_0.addMenuItem("Testimonials","window.open('http://www.hypervibe.ca/testimonials.php', '_self');");
  mm_menu_1202191855_0.addMenuItem("News","window.open('http://www.hypervibe.ca/news.php', '_self');");
   mm_menu_1202191855_0.hideOnMouseOut=true;
   mm_menu_1202191855_0.bgColor='#1C6200';
   mm_menu_1202191855_0.menuBorder=1;
   mm_menu_1202191855_0.menuLiteBgColor='';
   mm_menu_1202191855_0.menuBorderBgColor='#EAEAEA';

        window.mm_menu_1202192042_0 = new Menu("root",82,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202192042_0.addMenuItem("Return","window.open('http://www.hypervibe.ca/return_policy.php', '_self');");
  mm_menu_1202192042_0.addMenuItem("Payments","window.open('http://www.hypervibe.ca/payments.php', '_self');");
  mm_menu_1202192042_0.addMenuItem("Shipping","window.open('http://www.hypervibe.ca/shipping.php', '_self');");
  mm_menu_1202192042_0.addMenuItem("Faq","window.open('http://www.hypervibe.ca/faq.php', '_self');");
   mm_menu_1202192042_0.hideOnMouseOut=true;
   mm_menu_1202192042_0.bgColor='#1C6200';
   mm_menu_1202192042_0.menuBorder=1;
   mm_menu_1202192042_0.menuLiteBgColor='';
   mm_menu_1202192042_0.menuBorderBgColor='#EAEAEA';

      window.mm_menu_1202192313_0 = new Menu("root",83,25,"",12,"#EAEAEA","#FFFFFF","#35A910","#0F7303","left","middle",5,0,50,-5,7,true,true,true,0,true,false);
  mm_menu_1202192313_0.addMenuItem("Email","window.open('http://www.hypervibe.ca/email.php', '_self');");
  mm_menu_1202192313_0.addMenuItem("Locations","window.open('http://www.hypervibe.ca/locations.php', '_self');");
   mm_menu_1202192313_0.hideOnMouseOut=true;
   mm_menu_1202192313_0.bgColor='#1C6200';
   mm_menu_1202192313_0.menuBorder=1;
   mm_menu_1202192313_0.menuLiteBgColor='#FFFFFF';
   mm_menu_1202192313_0.menuBorderBgColor='#EAEAEA';

mm_menu_1202192313_0.writeMenus();
} // mmLoadMenus()

function MM_showMenu(menu, x, y, child, imgname) {
	if (!window.mmWroteMenu) return;
	MM_clearTimeout();
	if (menu) {
		var obj = FIND(imgname) || document.images[imgname] || document.links[imgname] || document.anchors[imgname];
		x = moveXbySlicePos (x, obj);
		y = moveYbySlicePos (y, obj);
	}
	if (document.layers) {
		if (menu) {
			var l = menu.menuLayer || menu;
			l.top = l.left = 1;
			hideActiveMenus();
			if (this.visibility) l = this;
			window.ActiveMenu = l;
		} else {
			var l = child;
		}
		if (!l) return;
		for (var i=0; i<l.layers.length; i++) { 			   
			if (!l.layers[i].isHilite) l.layers[i].visibility = "inherit";
			if (l.layers[i].document.layers.length > 0) MM_showMenu(null, "relative", "relative", l.layers[i]);
		}
		if (l.parentLayer) {
			if (x != "relative") l.parentLayer.left = x || window.pageX || 0;
			if (l.parentLayer.left + l.clip.width > window.innerWidth) l.parentLayer.left -= (l.parentLayer.left + l.clip.width - window.innerWidth);
			if (y != "relative") l.parentLayer.top = y || window.pageY || 0;
			if (l.parentLayer.isContainer) {
				l.Menu.xOffset = window.pageXOffset;
				l.Menu.yOffset = window.pageYOffset;
				l.parentLayer.clip.width = window.ActiveMenu.clip.width +2;
				l.parentLayer.clip.height = window.ActiveMenu.clip.height +2;
				if (l.parentLayer.menuContainerBgColor && l.Menu.menuBgOpaque ) l.parentLayer.document.bgColor = l.parentLayer.menuContainerBgColor;
			}
		}
		l.visibility = "inherit";
		if (l.Menu) l.Menu.container.visibility = "inherit";
	} else if (FIND("menuItem0")) {
		var l = menu.menuLayer || menu;	
		hideActiveMenus();
		if (typeof(l) == "string") l = FIND(l);
		window.ActiveMenu = l;
		var s = l.style;
		s.visibility = "inherit";
		if (x != "relative") {
			s.pixelLeft = x || (window.pageX + document.body.scrollLeft) || 0;
			s.left = s.pixelLeft + 'px';
		}
		if (y != "relative") {
			s.pixelTop = y || (window.pageY + document.body.scrollTop) || 0;
			s.top = s.pixelTop + 'px';
		}
		l.Menu.xOffset = document.body.scrollLeft;
		l.Menu.yOffset = document.body.scrollTop;
	}
	if (menu) window.activeMenus[window.activeMenus.length] = l;
	MM_clearTimeout();
}

function autoSubmit11(){
	document.frmConfirm.action="http://www.hypervibe.ca/billingShipping/index.php?mode=edit";
	document.frmConfirm.submit();
}
function updtNow(ctrl){
	ctrl.disabled = 'disabled';
}

function showNow(Id){
	if(document.getElementById(Id).className == 'hide'){
		document.getElementById('img_'+Id).src = 'http://www.hypervibe.ca/images/up.gif';
		document.getElementById('img_'+Id).title = 'Hide Replies';
		document.getElementById('img_'+Id).alt = 'Hide Replies';
		document.getElementById('shw_'+Id).title = 'Hide Replies';
		document.getElementById('shw_'+Id).innerHTML = '&nbsp;Hide Replies';
		document.getElementById(Id).className = 'show';
	} else {
		document.getElementById('img_'+Id).src = 'http://www.hypervibe.ca/images/down.gif';
		document.getElementById('img_'+Id).title = 'Show Replies';
		document.getElementById('img_'+Id).alt = 'Show Replies';
		document.getElementById('shw_'+Id).title = 'Show Replies';
		document.getElementById('shw_'+Id).innerHTML = '&nbsp;Show Replies';
		document.getElementById(Id).className = 'hide';
	}
}

function showmsgNow(Id){
	if(document.getElementById(Id).className == 'hidemsg'){
		document.getElementById(Id).className = 'showmsg';
	} else {
		document.getElementById(Id).className = 'hidemsg';
	}
}

function showFAQ(Id){
	if(document.getElementById(Id).className == 'hide'){
		document.getElementById(Id).className = 'show';
	} else {
		document.getElementById(Id).className = 'hide';
	}
}

function valid_reply(frm, ctrl){
	val = document.getElementById(ctrl).value;
	if(trim(val) == ''){
		alert('Please enter your message.');
		return false;
	}
	str = ctrl.split('_');
	frm.q_id.value = str[1];
	return true;
}

function valid_phpfrm(frm){
	if(trim(frm.reply_msg.value) == ''){
		alert('Please enter your reply.');
		return false;
	}
	return true;
}

function supportValidate(frm){
	if(trim(frm.message.value) == ''){
		alert('Please enter your message.');
		return false;
	}
	return true;
}

function faqValidate(frm){
	if(trim(frm.faq_ques.value) == ''){
		alert('Please enter faq question.');
		return false;
	}
	if(trim(frm.faq_ans.value) == ''){
		alert('Please enter faq answer.');
		return false;
	}
	return true;
}

function valid_phy_reply(frm, ctrl){
	val = document.getElementById(ctrl).value;
	if(trim(val) == ''){
		alert('Please enter your message.');
		return false;
	}
	str = ctrl.split('_');
	frm.q_id.value = str[1];
	frm.ref_id.value = str[2];
	return true;
}

function goBackFrm(url){
	location.href = url;
}

function getFAQ(val){
	document.frmsupport.reply_msg.value = document.getElementById(val).value;
}

function validSubscribe(objFrm){
   if(trim(objFrm.first_name.value)==""){
     alert("Please enter first name.");
	 objFrm.first_name.focus();
	 return false;
   }
   if(trim(objFrm.last_name.value)==""){
     alert("Please enter last name.");
	 objFrm.last_name.focus();
	 return false;
   }
   if(trim(objFrm.email.value)==""){
     alert("Please enter an email address.");
	 objFrm.email.focus();
	 return false;
   }
    if(!isValidEmail(objFrm.email.value)){
		alert("Please enter valid email address.");
		objFrm.email.focus();
		return false;
	}
    if(trim(objFrm.phone.value)==""){
     alert("Please enter phone number.");
	 objFrm.phone.focus();
	 return false;
   }
	if(trim(objFrm.private_key.value)==""){
     alert("Please enter security code.");
	 objFrm.private_key.focus();
	 return false;
   }
   return true;
}
function showfrmFAQ(Id, frm){
	if(document.getElementById(Id).className == 'hide'){
		document.getElementById(Id).className = 'show';
	} else {
		document.getElementById(Id).className = 'hide';
	}
	frm.faq_ques.value = '';
	frm.faq_ans.value = '';
}
function showTab(name, opt){
	lnk = 'lnk_' + name;
	if(opt == '1'){
		document.getElementById(lnk+'_1').className = 'active';
		document.getElementById(lnk+'_0').className = '';
		document.getElementById(lnk+'_2').className = '';
		document.getElementById(name+'_1').className = 'show';
		document.getElementById(name+'_0').className = 'hide';
		document.getElementById(name+'_2').className = 'hide';
	} else if(opt == '2'){
		document.getElementById(lnk+'_2').className = 'active';
		document.getElementById(lnk+'_0').className = '';
		document.getElementById(lnk+'_1').className = '';
		document.getElementById(name+'_2').className = 'show';
		document.getElementById(name+'_0').className = 'hide';
		document.getElementById(name+'_1').className = 'hide';
	} else {
		document.getElementById(lnk+'_0').className = 'active';
		document.getElementById(lnk+'_1').className = '';
		document.getElementById(lnk+'_2').className = '';
		document.getElementById(name+'_0').className = 'show';
		document.getElementById(name+'_1').className = 'hide';
		document.getElementById(name+'_2').className = 'hide';
	}
}
function confirmDelete(){
	if (confirm("Do you really want to delete this record?")){
		return true;
	}
	return false;
}
function imgEffect(divid, opt){
	if(opt == '1'){
		document.getElementById(divid).className = 'highlight';
	} else {
		document.getElementById(divid).className = '';
	}
}
