// JavaScript Document

function hideNav(navid) {
  document.getElementById('nav'+navid).style.backgroundImage = 'url(/images/bg_nav_old.gif)';
  document.getElementById('SubNav'+navid).style.display = 'none';
}
function showSubNav(navid,num) {
  for(i=1;i<num;i++){
    document.getElementById('nav'+i).style.backgroundImage = 'url(/images/bg_nav_old.gif)';
    document.getElementById('SubNav'+i).style.display = 'none';
  }
  document.getElementById('nav'+navid).style.backgroundImage = 'url(/images/bg_nav.gif)';
  document.getElementById('SubNav'+navid).style.display = '';
}
function hideAll(num) {
  for(i=1;i<num;i++){
    document.getElementById('nav'+i).style.backgroundImage = 'url(/images/bg_nav_old.gif)';
    document.getElementById('SubNav'+i).style.display = 'none';
  }
}

function ShowBest(){
	document.getElementById('BestDeals').style.display = '';
	document.getElementById('NewArrivals').style.display = 'none';
	document.getElementById('ClassBestDeals').className = 'main_Best main_over'
	document.getElementById('ClassNewArrivals').className = 'main_Best main_out'
}


function ShowNew(){
	document.getElementById('BestDeals').style.display = 'none';
	document.getElementById('NewArrivals').style.display = '';
	document.getElementById('ClassBestDeals').className = 'main_Best main_out'
	document.getElementById('ClassNewArrivals').className = 'main_Best main_over'
}




function getPrice(id,priceVal,Qty,obj){
	if (obj.value < Qty){
		alert("Min. Order: "+ Qty + "pcs");
		document.getElementById('Qty'+id).value = Qty;
		document.getElementById('Qty'+id).focus();
		return false;
	}
  	price = priceVal * obj.value;
	var price = price.toFixed(2);
	priceVal = 'US $' + price;
	document.getElementById('price'+id).innerHTML = priceVal;
}


function getRate(obj,Rate){
	document.getElementById('PriceWholesale').value = (obj.value * Rate) * 1.1;
}


function getCBM(){
	var length = document.getElementById('box_length').value;
	var width = document.getElementById('box_width').value;
	var height = document.getElementById('box_height').value;
	var Units = document.getElementById('box_Units').value;
	if (Units == 'mm'){
		document.getElementById('CBMCTN').value = (length/1000) * (width/1000) * (height/1000);
	}	
	if (Units == 'cm'){
		document.getElementById('CBMCTN').value = (length/100) * (width/100) * (height/100);
	}	
	if (Units == 'm'){
		document.getElementById('CBMCTN').value = length * width * height;
	}	
}


function getWeightCTN(){
	var QtyCTN = document.getElementById('QtyCTN').value;
	var Weight = document.getElementById('Weight').value;
	var Weight_Units = document.getElementById('Weight_Units').value;
	if (Weight_Units == 'k'){
		document.getElementById('WeightCTN_Units')[0].selected = true;
	}	
	if (Weight_Units == 'kg'){
		document.getElementById('WeightCTN_Units')[1].selected = true;
	}	
	document.getElementById('WeightCTN').value = QtyCTN * Weight;
}



function goURL(URL){
	//window.location.href = URL;	
	window.open(URL,'_blank');
}



function productMoreImg(picProduct,linkProduct,textProduct){
	var focus_width=211
	var focus_height=211
	var text_height=0
	var swf_height = focus_height
	//var swf_height = focus_height+text_height
	
	var pics = picProduct;
	var links = linkProduct;
	var texts = textProduct;
	
	document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" width="'+ focus_width +'" height="'+ swf_height +'">');
	document.write('<param name="allowScriptAccess" value="sameDomain"><param name="movie" value="/images/pixviewer.swf"><param name="quality" value="high"><param name="bgcolor" value="#DADADA">');
	document.write('<param name="menu" value="false"><param name=wmode value="opaque">');
	document.write('<param name="FlashVars" value="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'">');
	document.write('<embed src="/images/pixviewer.swf" wmode="opaque" FlashVars="pics='+pics+'&links='+links+'&texts='+texts+'&borderwidth='+focus_width+'&borderheight='+focus_height+'&textheight='+text_height+'" menu="false" bgcolor="#DADADA" quality="high" width="'+ focus_width +'" height="'+ swf_height +'" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />');		document.write('</object>');

}












