function showhide(containerId, val) {
	if (val=='show'){
		document.getElementById(containerId).style.display="block";
		document.getElementById('list').style.display="none";
		}
	else
		{
		document.getElementById(containerId).style.display="none";
		document.getElementById('list').style.display="";
		}
		}
		
	function getState()	 {
	 document.getElementById('statediv').style.display="";
	 var cat=document.getElementById('country').value;
	 ajaxpage("findState1.php?country="+cat,'statediv');
	}
	
	function getShippingPrice() {
	 document.getElementById('shipping').style.display="";
	 var zip=document.getElementById('zip').value;
	 var osize=document.getElementById('osize').value;
var dat=document.getElementById('dat').value;
	 ajaxpage("getShippingPrice.php?zip="+zip+"&osize="+osize+"&dat="+dat,'shipping');
	}

function verify_frm()
{
	email_addr = strTrim(document.frmPrev.email_adr.value);
	
	if(chkEmail(email_addr) == false)
	{
		alert("Please enter email valid address");
		document.frmPrev.email_adr.focus();
		return false;
	}
}

function getShippingPrice1() {
	var d = new Date();
	var curr_hour = d.getHours();
	var curr_min = d.getMinutes();
	document.getElementById('dat').value=curr_hour;
	 var zip1=document.getElementById('zip1').value;
	 var osize1=document.getElementById('osize1').value;
	var osize1=document.getElementById('osize1').value;
	var linkval="getShippingPrice1.php?zip="+zip1+"&dat="+curr_hour+"&osize="+osize1+"&width=400&height=325";
	document.getElementById("shiplink").href=linkval;
	 //ajaxpage("getShippingPrice1.php?zip="+zip1+"&osize="+osize1,'shipping1');
	}
	function chcekShip()
	{
		var zip1=document.getElementById('zip1').value;
	 	var osize1=document.getElementById('osize1').value;
		var chkerror="";
		if(zip1 == "")
		{	
			chkerror="Enter ZIP<br>";
			if(osize1)	
			{
			chkerror+="Select Order Type";
			}
			alert(chkerror);
		}
		else{}		
	}
	
	var countn=1;
  var countrys="";
  function multicountry(){
	countn = 1;
  for(var i=1;i<countn+1;i++){
  var optiname="countri_names"+i; 
  countrys=countrys+document.getElementById(optiname).value+",";}  
  }
  function echeck(str) {

		var at="@"
		var dot="."
		var lat=str.indexOf(at)
		var lstr=str.length
		var ldot=str.indexOf(dot)
		if (str.indexOf(at)==-1){
		   return false
		}

		if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){
		   return false
		}

		if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){
		    return false
		}

		 if (str.indexOf(at,(lat+1))!=-1){
		    return false
		 }

		 if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){
		    return false
		 }

		 if (str.indexOf(dot,(lat+2))==-1){
		    return false
		 }
		
		 if (str.indexOf(" ")!=-1){
		    return false
		 }

 		 return true					
	}
	function validateRequestForm1()
	{
		
		if(document.getElementById('phname').value == "")
		{
			alert("Enter your first name.");
			document.getElementById('phname').focus();
			return false;
		}
		
		if(document.getElementById('phphno').value == "")
		{
			alert("Enter your day time phone number.");
			document.getElementById('phphno').focus();
			return false;
		}
		if(document.getElementById('phemail').value == "")
		{
			alert("Enter your email address.");
			document.getElementById('phemail').focus();
			return false;
		}
		if(!echeck(document.getElementById('phemail').value))
		{
			alert("Enter proper email address.");
			document.getElementById('phemail').focus();
			return false;
		}
		if(document.getElementById('phdetails').value == "")
		{
			alert("Enter your phone Details.");
			document.getElementById('phphno').focus();
			return false;
		}
		return true;
	}
   function submitphoneinfo(){  	
	   
	if(validateRequestForm1())
	   {
		   $.ajax({
		   type: "POST",
		   url: "requestinfo-mail1.php",
		   data: "Name= "+document.getElementById('phname').value+"&Phone="+document.getElementById('phphno').value+"&Email="+document.getElementById('phemail').value+"&Details="+document.getElementById('phdetails').value+"&countri_names="+document.getElementById('countri_names').value+"&optiname="+countrys,
		   success: function(html){   	   
			   document.getElementById('phoneenquiry').innerHTML='<center><img src="<?=getlinkhost()?>/images/loading.gif" border="0"></center>';
			   document.getElementById('phoneenquiry').innerHTML=html;
		   }
		   });
	  }
   }
   
   
   function add_Option(){
	/*var table = document.getElementById('editphoneOption');
 	var rowCount = table.rows.length;
	var row = table.insertRow(rowCount); 	
 	var cell2 = row.insertCell(0); 					
	 	var element1 = document.createElement("input");
		element1.type = "text";
		element1.name = "optiname";
		element1.id = "optiname"+count;
		cell2.appendChild(element1); 
		count++;*/
	if(countn < 9){
	var element1d = "optiname"+countn;
	document.getElementById(element1d).style.display="block";
	countn++;}
	else{}
}
function showde(containerId, val) {
	if (val=='show'){
//alert(containerId);
		document.getElementById(containerId).style.display="block";
		//document.getElementById('list').style.display="none";
		}
	else
		{
		document.getElementById(containerId).style.display="none";
		//document.getElementById('list').style.display="";
		}
		}
		
		ddaccordion.init({
	headerclass: "mypets", //Shared CSS class name of headers group
	contentclass: "main_thepet", //Shared CSS class name of contents group
	revealtype: "click", //Reveal content when user clicks or onmouseover the header? Valid value: "click", "clickgo", or "mouseover"
	mouseoverdelay: 200, //if revealtype="mouseover", set delay in milliseconds before header expands onMouseover
	collapseprev: true, //Collapse previous content (so only one open at any time)? true/false 
	defaultexpanded: [], //index of content(s) open by default [index1, index2, etc]. [] denotes no content.
	onemustopen: false, //Specify whether at least one header should be open always (so never all headers closed)
	animatedefault: true, //Should contents open by default be animated into view?
	persiststate: false, //persist state of opened contents within browser session?
	toggleclass: ["", "openpet"], //Two CSS classes to be applied to the header when it's collapsed and expanded, respectively ["class1", "class2"]
	togglehtml: ["none", "", ""], //Additional HTML added to the header when it's collapsed and expanded, respectively  ["position", "html1", "html2"] (see docs)
	animatespeed: "slow", //speed of animation: integer in milliseconds (ie: 200), or keywords "fast", "normal", or "slow"
	oninit:function(expandedindices){ //custom code to run when headers have initalized
		//do nothing
	},
	onopenclose:function(header, index, state, isuseractivated){ //custom code to run whenever a header is opened or closed
		//do nothing
	}
})

function h_unh(selval)
{
	sim_recharge_ids = document.card.sim_recharge_ids.value;
	arr_ids = sim_recharge_ids.split(',');
	for(i=0; i<arr_ids.length; i++)
	{
		$("#rch_opt_"+arr_ids[i]).removeClass();
		document.getElementById("rch_opt_"+arr_ids[i]).innerHTML = '<img border="0" src="images/image_plane.jpg">';
	}
	if(selval != 99999)
		document.getElementById("rch_opt_"+selval).innerHTML = '<img border="0" src="images/image_shdw.jpg">';
	//$("#rch_opt_"+selval).addClass("img-shadow");
	document.card.sim_recharge.value=selval;
	document.card.recharge2.checked=false;
}
function norecharge()
{
	sim_recharge_ids = document.card.sim_recharge_ids.value;
	arr_ids = sim_recharge_ids.split(',');
	for(i=0; i<arr_ids.length; i++)
	{
		$("#rch_opt_"+arr_ids[i]).removeClass();
		document.getElementById("rch_opt_"+arr_ids[i]).innerHTML = '<img border="0" src="images/image_plane.jpg">';
	}
	document.card.sim_recharge.value=0;
}
function show_rate(rate)
{
	if(rate != "")
	{
		arr_rate = rate.split('|');
		document.getElementById('countrycode').innerHTML = '<strong>Country Code<br /><font color="#B83E08">'+arr_rate[0]+'</font></strong>';
		document.getElementById('landline').innerHTML = '<strong>Land Line Rate<br /><font color="#B83E08">'+arr_rate[1]+'</font></strong>';
		document.getElementById('cellrate').innerHTML = '<strong>Cell Rate<br /><font color="#B83E08">'+arr_rate[2]+'</font></strong>';
	}
	else
	{
		document.getElementById('countrycode').innerHTML = '';
		document.getElementById('landline').innerHTML = '';
		document.getElementById('cellrate').innerHTML = '';
	}
	
}
