function page_submit(){
		var name = document.forms[0].txt_first_name.value;
		var email = document.forms[0].txt_email.value;
		var message = document.forms[0].txt_message.value;
		var txt_phone = document.forms[0].txt_phone.value;
		
		if(name == ""){
			alert('Please Enter the Name');
			return false;
		}
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	    if(reg.test(email) == false) {
		  alert('Invalid Email Address');
		   return false;
	   }
	   
	   var numericExpression =/^[0-9\-]{12,12}$/;
	     if(numericExpression.test(txt_phone) == false) {
		  alert('Please enter a valid Phone no. Ex :- 000-000-0000');
		   return false;
	   }

		if(message == ""){
			alert('Please Enter the Message');
			return false;
		}
		
		document.forms[0].submit();
		return true;

		
}

function page_submit1(){
		
		var email = document.forms[0].email_subscriber.value;
		
		var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
	    if(reg.test(email) == false) {
		  alert('Invalid Email Address');
		   return false;
		}
		document.forms[0].submit();
		return true;

		
}

function copyto_user_id(){
	
	emailid = document.forms[0].txt_email.value;
	
	document.forms[0].txt_user_id.value = emailid;
}


function copy_address(){
 
	
  address= document.forms[0].txt_address.value;
  
  document.forms[0].address_new.value = address;
	
	state = document.forms[0].hid_state.value;
	 
	selObj = document.getElementById("txt_new_state");
  // state =  state-1;
	selObj.selectedIndex = state;
	
	//document.forms[0].txt_new_state.value = state;
  /* phone = document.forms[0].hid_ph_no.value;
	document.forms[0].primary_tel_no.value = phone; 
*/

	city = document.forms[0].hid_city.value;

	document.forms[0].txt_new_city.value = city;
	
	zip = document.forms[0].hid_zip.value;
	document.forms[0].txt_zip.value = zip;
	 
	country = document.forms[0].hid_country.value;
	  
     selObj = document.getElementById("new_shipping_country");
  
	  selObj.selectedIndex = country;
  
	
}
function redirect()
{
window.location = "index.php"

}
function redirect_login()
{
window.location = "user_login.php"

}

function redirect_index()
{
window.location = "index.php"

}

function formValidator(){
	// Make quick references to our fields
	var name = document.getElementById('name');
	var email = document.getElementById('email');
	var company = document.getElementById('company');
    var phone = document.getElementById('phone');
	var comment = document.getElementById('comment');

if(isEmpty(name, "Please enter your name")){
if(isEmpty(company, "Please enter your Company")){
if(emailValidator(email, "Please enter a valid email address")){
if(isEmpty(phone, "Please enter your phone number")){
if(isEmpty(comment, "Please enter the comment")){
							return true;
						}
					}
				}
			}

        }
        
	return false;
	
}
function emailValidator(elem, helperMsg){
	var emailExp = /^[\w\-\.\+]+\@[a-zA-Z0-9\.\-]+\.[a-zA-Z0-9]{2,4}$/;
	if(elem.value.match(emailExp)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}

function isEmpty(elem, helperMsg){
		if(elem.value.length == 0){
		alert(helperMsg);
		elem.focus(); // set the focus to this input
		return false;
	}
	return true;
}

function isNumeric(elem, helperMsg){
	var numericExpression = /^[0-9]+$/;
	if(elem.value.match(numericExpression)){
		return true;
	}else{
		alert(helperMsg);
		elem.focus();
		return false;
	}
}


function redirect_order_view(orderid)

{
var order1 = trim(orderid)
var list = document.order_details.status.value;

//window.location = "order_view.php?list="+list+"&action=edit"
window.location = "order_view.php?order_id="+order1+"&list="+list+"&action=edit"
//window.location = "order_view.php?order_id=0123&list="+list+"&action=edit"
}

function redirect_order_details()
{

window.location = "order_details.php"

}


//Taxid div hide and show

function dvTax()
{

var chkGovStatus;
var orgTax;
var orgAmount;
var orgShiping;
var freeTax;

chkGovStatus=document.getElementById('gov_check').checked;

orgTax=document.getElementById('hid_tax_amount').value;

orgShiping=document.getElementById('hid_shipping_calc').value;
orgAmount=document.getElementById('hid_tot_amount').value;

if(chkGovStatus==true)
{
freeTax=orgAmount-orgTax;
freeTax=Math.round(freeTax);
document.getElementById('taxId').style.display='block';
document.getElementById('dispTax').innerHTML='$0.00';
document.getElementById('totAmount').innerHTML='<span class=normal_black_letters><b>Total :$ '+freeTax+'.00</b></span>';
}
else
{
document.getElementById('taxId').style.display='none';
document.getElementById('dispTax').innerHTML='$'+orgTax;
document.getElementById('totAmount').innerHTML='<span class=normal_black_letters><b>Total :$ '+orgAmount+'</b></span>';

}

}


function upload(div){
	
	if(div){
	document.getElementById('upload_images').style.display='block';
	}
	else{
		document.getElementById('upload_images').style.display='';	
	}
	
}

