function view_larger(val) {
	var product_id = val;
    window.open ('product_view_larger.php?id='+ product_id,'','height=250,width=370,top=200,left=300,scrollbars=0,resizing=0,location=no,menubar=no,toolbar=no,status=no,directories=no');
}

// To show and hide div

function show_div1(val1,val2,val3)
{ 
	document.getElementById(val1).style.display="block";
	document.getElementById(val2).style.display="none";
	document.getElementById(val3).style.display="none";
}

function show_div2(val1,val2,val3)
{ 
	document.getElementById(val1).style.display="none";
	document.getElementById(val2).style.display="block";
	document.getElementById(val3).style.display="none";
}

function show_div3(val1,val2,val3)
{ 
	document.getElementById(val1).style.display="none";
	document.getElementById(val2).style.display="none";
	document.getElementById(val3).style.display="block";
}

function change_product(val){
	var id = val; 
	$('value_id').value = id;
	var qnty = $('quantity').value; //alert(qnty);
	//document.product_detail.submit();
	window.location = 'product_detail.php?id='+id+'&qnty='+qnty;
}

function show_qnty_option_div(val1,val2,val3,val4){
	document.getElementById(val1).style.display="block";
	document.getElementById(val2).style.display="none";
	document.getElementById(val3).style.display="none";
	document.getElementById(val4).style.display="block";
}

function sameaddress(val){
	if(document.billing_details.same_address.checked){
						document.billing_details.s_firstname.value = document.billing_details.b_firstname.value;
						document.billing_details.s_lastname.value = document.billing_details.b_lastname.value;
						document.billing_details.s_address1.value = document.billing_details.b_address1.value;
						document.billing_details.s_address2.value = document.billing_details.b_address2.value;
						document.billing_details.s_city.value = document.billing_details.b_city.value;
						document.billing_details.s_country.value = document.billing_details.country.value;
						document.billing_details.s_zip.value = document.billing_details.b_zip.value;
						document.billing_details.s_phone.value = document.billing_details.b_phone.value;
						document.billing_details.s_phone_type.value = document.billing_details.b_phone_type.value;
						document.billing_details.s_email.value = document.billing_details.b_email.value;
						document.billing_details.s_flag.value = document.billing_details.flag.value; //alert(document.billing_details.s_flag.value);
						if(document.billing_details.flag.value == 1){
						$('s_state_txt').style.display="block";
						$('s_states').style.display="none"; 	
						document.billing_details.s_state_txt.value = document.billing_details.state_txt.value;
						}
						else{
						$('s_state_txt').style.display="none";
						$('s_states').style.display="block";	
						document.billing_details.s_state.value = document.billing_details.state.value;
						}
			}
			else{
						document.billing_details.s_firstname.value = "";
						document.billing_details.s_lastname.value = "";
						document.billing_details.s_address1.value = "";
						document.billing_details.s_address2.value = "";
						document.billing_details.s_city.value = "";
						document.billing_details.s_country.value = "";
						document.billing_details.s_zip.value = "";
						document.billing_details.s_phone.value = "";
						document.billing_details.s_phone_type.value = "";
						document.billing_details.s_email.value = "";
						//document.billing_details.s_flag.value = "";
						document.billing_details.s_state_txt.value = "";
			} 
}


function hide_discount_box(val)
{ 	
	if(val == '3' || val == '4' || val == '5')
	$('discount_div').style.display="none";
	else
	$('discount_div').style.display="block";
}

function show_user_limit_box(val)
{ 	
	if(val == '3')
	$('user_limit_div').style.display="block";
	else
	$('user_limit_div').style.display="none";
}
