// Used in all pages to submit a form and optionally set a hidden 
// form varaible called 'navigate' to direct navgiation
function submitForm(formName, navigateValue) {
	if (navigateValue != null && navigateValue != "") {
		document.forms[formName].navigate.value = navigateValue;
	}
    document.forms[formName].submit();
}


function toggle(id){
		if(document.getElementById(id).style.display=='none')
		document.getElementById(id).style.display='block';
		else
		document.getElementById(id).style.display='none';
}					

function show_popup(id) {
    if (document.getElementById){
        obj = document.getElementById(id);
        if (obj.style.display == "none") {
            obj.style.display = "";
        }
    }
}
function hide_popup(id){
    if (document.getElementById){
        obj = document.getElementById(id);
        if (obj.style.display == ""){
            obj.style.display = "none";
        }
    }
}

function toggle_hide(id)
{
document.getElementById(id).style.display='none';
}


function isNumberKey(evt)
{
 var charCode = (evt.which) ? evt.which : event.keyCode
 if (charCode > 31 && (charCode < 48 || charCode > 57))
  return false;

 return true;
}	

function valid_index(){ 
var src=document.frmShipping.source.value;
var des=document.frmShipping.destination.value;
var make = document.frmShipping.make.value;
var destCountry=document.frmShipping.destinationCountry.value;
var srcCountry=document.frmShipping.sourceCountry.value;

//var hid= document.frmShipping.hid.value;

if(document.getElementById('my_popup1').style.display!='none'){
	var height=document.frmShipping.height.value;
	//alert(src + des + make + hid + height);
	var length=document.frmShipping.length.value;
	var width= document.frmShipping.width.value;
	var weight=document.frmShipping.weight.value;
	if(src==""||des==""||height==''||length==''||width==''||weight==''){
		alert('Fields with * sign are required to fill');
		return false;
	}else{
		return true;
	}
}else{

		
		 if(srcCountry=="")
		{
		alert('Please select source from the dropdown to set the value of source country.');
		return false;
		}

                 if(destCountry=="")
		{
		alert('Please select destination from the dropdown to set the value of destination country.');
		return false;
		}


              if(src==""||des==""||make==''){
			alert('Please eiter select make and model or fill your bike specifications');
			return false;
		}
		else{
		document.getElementById('fade').style.display='block';
		show_popup('my_popup2');
		return true;
	}
}

}

	
function show_overlay()
{
			
	document.getElementById('fade').style.display="block";
}
		
function hide_overlay()
{
	document.getElementById('fade').style.display="none";
}
	//function added by deepti 

function showheader(headerName, siteURL)
{
var baseurl="'"+siteURL+"admin/header/"+headerName+"'";
document.getElementById("header").style.backgroundImage = "url("+baseurl+")";

}

