function init(){
	var img_arr = ["menu_main_over.gif","menu_newprod_over.gif","menu_checkout_over.gif","menu_acc_over.gif","menu_cart_over.gif","btn_add_cart_over.gif","btn_det_over.gif"];
	vcms_preloadImage(img_arr,"images/");
}

function vcms_swapImage(me){
	me.old = me.src;
	me.src = me.src.substr(0, me.src.length-6)+"over.gif";
	me.onmouseout = function(){
		this.src = me.old;
	}
}

function vcms_textboxMsg(me ,msg){
	if(me.value == msg){
		me.value = "";
	}
	me.onblur = function(){
		if(me.value == msg || me.value == ""){
			me.value = msg;
		}
	};
}

function vcms_hoverStyle(me){
	me.old       = me.className;
	me.className = me.className.substr(0, me.className.length-2)+"over";
	me.onmouseout = function(){
		this.className = me.old;
	}
}

function vcms_preloadImage(preload_arr, prefix){
	var path_pre = prefix || "";
	var temp_img = new Array();
	for(i=0;i<preload_arr.length;i++){
		temp_img[i] = new Image();
		temp_img[i].src = path_pre+preload_arr[i];
	}
}

function show_hide(target){
	var theTD=document.getElementById(target);
	if(theTD.style.display =="none" || theTD.style.display == ""){
		theTD.style.display="block";
	}else{
		theTD.style.display="none";
	}
}

function show_hide_def(target,status){
	var theTD=document.getElementById(target);
	theTD.style.display=status;
}

// This scripts  for success story

function LTrim(sString) 
{ 
     while (sString.substring(0,1) == ' ') 
     { 
          sString = sString.substring(1, sString.length); 
     } 
     return sString; 
}	

function validate_success(formName)
{
	var target = document[formName];
	
	if(LTrim(target.first_name.value)=="")
	{
	alert("please enter your name!");
	//target.first_name.focus();
	return false;
	}
	if(LTrim(target.surname.value)=="")
	{
	alert("please enter surname!");
	//target.first_name.focus();
	return false;
	}
	
	//email******************
	var tBox    = target.email;
	var atIndex = tBox.value.indexOf("@"); 
	var dotIndex = tBox.value.lastIndexOf("."); 
	if((atIndex == -1) || (dotIndex == -1) || (atIndex == 0) || (atIndex > dotIndex)){ 
	alert("Please enter valid email address!")	;
			  //tBox.focus(); 
			  return false; 
	}
	//email********************
	var x = document.getElementById('mce_editor_0').contentWindow.document.body.innerHTML;
	var y = document.getElementById('mce_editor_1').contentWindow.document.body.innerHTML;
	var z = document.getElementById('mce_editor_2').contentWindow.document.body.innerHTML;
	if(x==""||x=="<br>")
	{
	alert("Please enter your experience with stanley!");
	return false;
	}
	if(y==""||y=="<br>")
	{
	alert("Please enter how is your life now!");
	return false;
	}
	if(z==""||z=="<br>")
	{
	alert("Please enter what did you do to collapse the gap!");
	return false;
	}
	if(LTrim(target.code.value)=="")
	{
	alert("please enter verification code!");
	//target.first_name.focus();
	return false;
	}
	if(!target.terms.checked)
	{
	alert("You must accept terms of submission to post your story");
	return false;	
	}
}

function validate_inquiry()
{
	if(LTrim(document.inquiry.name.value)=="")
	{
	alert("please enter your name!");
	return false;
	}
	//email******************
	var tBox    = document.inquiry.email;
	var atIndex = tBox.value.indexOf("@"); 
	var dotIndex = tBox.value.lastIndexOf("."); 
	if((atIndex == -1) || (dotIndex == -1) || (atIndex == 0) || (atIndex > dotIndex)){ 
	alert("Please enter valid email address!")	;
			  //tBox.focus(); 
			  return false; 
	}
	//email********************
	if(LTrim(document.inquiry.subject.value)=="")
	{
	alert("please enter subject!");
	return false;
	}
	if(LTrim(document.inquiry.details.value)=="")
	{
	alert("please enter details!");
	return false;
	}
	
}