function detect_beowser(){
	var browser=navigator.appName;
	var b_version=navigator.appVersion;
	var version=parseFloat(b_version);
	
	//document.write("Browser name: "+ browser);
	//document.write("<br />");
	//document.write("Browser version: "+ version);
	return browser+version
}
function delete_product_crom_cart(){
	var conf = confirm('האם אתה בטוח שברצונך למחוק את המוצר');
	return conf;
}
function cart_shipment_type(value){
	if(document.getElementById('oreder_shipment').checked){
		document.getElementById('shipment_default').style.display = '';
		document.getElementById('shipment_manual').style.display = 'none';
	}
	else{
		document.getElementById('shipment_default').style.display = 'none';
		document.getElementById('shipment_manual').style.display = '';
	}
}
function order_products(value,pn,page,c_id,ot){
	var link = 'http://www.gmix.co.il/?page='+page+'&c_id='+c_id+'&ob='+value;
	if(pn!=''){
		link = link+'&pn='+pn;
	}	
	if(ot==1){
		ot_now = 0;
	}
	else{
		ot_now = 1;
	}
	
	link = link+'&ot='+ot_now;
	
	if(value=='normal'){
		link = 'http://www.gmix.co.il/?page='+page+'&c_id='+c_id;
	}
	
	window.location = link;
}
function order_products_search(value,pn,page,c_id,ot,term){
	var link = 'http://www.gmix.co.il/?page='+page+'&term='+term+'&ob='+value;
	if(pn!=''){
		link = link+'&pn='+pn;
	}	
	if(ot==1){
		ot_now = 0;
	}
	else{
		ot_now = 1;
	}
	
	link = link+'&ot='+ot_now;
	
	if(value=='normal'){
		link = 'http://www.gmix.co.il/?page='+page+'&term='+term;
	}
	
	window.location = link;
}
function show_change_password(){
	var obj = document.getElementById('change_passowrd');
	var obj2 = document.getElementById('change_passowrd_text');

	var pass = document.getElementById('register_password');
	var conf_pass = document.getElementById('register_confirm_password');

	if(obj.style.display=='none'){
		obj.style.display = '';
		obj2.style.display = '';
	}
	else{
		obj.style.display = 'none';
		obj2.style.display = 'none';
		pass.value='';
		conf_pass.value='';
	}
}
function show_product_picture(picture_id){
	if(document.getElementById('product_big_picture_1')){
		document.getElementById('product_big_picture_1').style.display = 'none';
	}
	if(document.getElementById('product_big_picture_2')){
		document.getElementById('product_big_picture_2').style.display = 'none';
	}
	if(document.getElementById('product_big_picture_3')){
		document.getElementById('product_big_picture_3').style.display = 'none';
	}
	if(document.getElementById('product_big_picture_4')){
		document.getElementById('product_big_picture_4').style.display = 'none';
	}
	if(document.getElementById('product_big_picture_5')){
		document.getElementById('product_big_picture_5').style.display = 'none';
	}
	if(document.getElementById('product_big_picture_6')){
		document.getElementById('product_big_picture_6').style.display = 'none';
	}
	document.getElementById('product_big_picture_'+picture_id).style.display = '';
}
function findPos(obj) {
var curleft = curtop = 0;
if (obj.offsetParent) {
        curleft = obj.offsetLeft
        curtop = obj.offsetTop
        while (obj = obj.offsetParent) {
                curleft += obj.offsetLeft
                curtop += obj.offsetTop
        }
}
return [curleft,curtop];
}


function drop_down_hide(table_1){
	var obj = document.getElementById(table_1);
	obj.style.display = 'none';
}

function drop_down(td_1,table_1){
	var h = document.getElementById(td_1);
	var obj = document.getElementById(table_1);
	
	//obj.style.opacity = 5/10;
	//obj.style.filter = 'alpha(opacity=' + 5*10 + ')';

	
	
	myPos = findPos(h)
	var left = myPos[0];
	var top = myPos[1];
	if(detect_beowser()=='Microsoft Internet Explorer4'){
		obj.style.left = left-186 + "px"
	}
	else{
		obj.style.left = left-186 + "px"
	}
	obj.style.top = top-1 + "px"
		
	obj.style.position='absolute';
	obj.style.zIndex="3000";
	
	obj.style.display = '';
}


function show_sub_menu(sub_menu_id){
	var obj = document.getElementById(sub_menu_id);
	if(obj.style.display=='none'){
		obj.style.display='';
	}
	else{
		obj.style.display='none'
	}	
}

function change_addons_sum(value){
	var addons_sum = 0;

	if(document.product_form.product_addon_1){
		for (var i=0; i < document.product_form.product_addon_1.length; i++){
			if (document.product_form.product_addon_1[i].checked){
				var rad_val = document.product_form.product_addon_1[i].value;
				var mySplitResult = rad_val.split("#%#");

				addons_sum = addons_sum+parseFloat(mySplitResult[0]);
			}
		}
	}

	if(document.product_form.product_addon_2){
		for (var i=0; i < document.product_form.product_addon_2.length; i++){
			if (document.product_form.product_addon_2[i].checked){
				var rad_val = document.product_form.product_addon_2[i].value;
				var mySplitResult = rad_val.split("#%#");

				addons_sum = addons_sum+parseFloat(mySplitResult[0]);
			}
		}
	}

	if(document.product_form.product_addon_3){
		for (var i=0; i < document.product_form.product_addon_3.length; i++){
			if (document.product_form.product_addon_3[i].checked){
				var rad_val = document.product_form.product_addon_3[i].value;
				var mySplitResult = rad_val.split("#%#");

				addons_sum = addons_sum+parseFloat(mySplitResult[0]);
			}
		}
	}

	if(document.product_form.product_addon_4){
		for (var i=0; i < document.product_form.product_addon_4.length; i++){
			if (document.product_form.product_addon_4[i].checked){
				var rad_val = document.product_form.product_addon_4[i].value;
				var mySplitResult = rad_val.split("#%#");

				addons_sum = addons_sum+parseFloat(mySplitResult[0]);
			}
		}
	}

	if(document.product_form.product_addon_5){
		for (var i=0; i < document.product_form.product_addon_5.length; i++){
			if (document.product_form.product_addon_5[i].checked){
				var rad_val = document.product_form.product_addon_5[i].value;
				var mySplitResult = rad_val.split("#%#");

				addons_sum = addons_sum+parseFloat(mySplitResult[0]);
			}
		}
	}
	document.getElementById('addons_cost').innerHTML = addons_sum+' ₪';
}
