﻿// JScript 
function doc(obj){
    return document.getElementById(obj);
}

function sendinquiry(id){
	window.location.href = "/send-inquiry.html?pids=" + id;
}

function sendinquirys(selectbox){
    var objcheck=document.getElementsByName(selectbox);
    
    var ids = "";
	for(var i=0;i<objcheck.length;i++)
	{
	    ids += objcheck[i].checked==true?objcheck[i].value + "," : "";
	}

	if(ids!="")
	    ids = ids.substring(1,ids.length-1);
	
	window.location.href = "/send-inquiry.html?pids=" + ids;
}

function AddBasket(id){
    
}

function __doPostDelBasket(){
		
}

function AddBaskets(selectbox){
    var objcheck=document.getElementsByName(selectbox);
    
    var ids = "";
	for(var i=0;i<objcheck.length;i++)
	{
	    ids += objcheck[i].checked==true?objcheck[i].value + "," : "";
	}


	if(ids!=""){
	    ids = ids.substring(0,ids.length-1);
	    
	    var url = "/service/addproductbasket.aspx";
        var pars = "pids=" + ids + "&re=" + Math.random(1000);
        var editAjax = new Ajax.Request(url,{method: 'get', parameters: pars, onComplete:AddBasketResault});
	}
	else{
	    alert("Please choose products.");
	}
}

function __doPostsendinquiry(){
    if(doc("txtsubject").value==''){
        alert("Please enter subject.");
        doc("txtsubject").focus();
        return false;
    }
    doc("inquiryform").submit();
}

function loadrecode(){
    var a= Math.random()*1000000;
    var _src = "/images/code/" + (a) +".jpg";
    doc("ReCodeImg").setAttribute("src",_src);
}

/*------------------------ Products basket ------------------------*/
function AddBasketResault(resaultObj){
	var xmls=resaultObj.responseXML;
	var suc=xmls.getElementsByTagName("result")[0].getAttribute("value");
//	alert(suc);
	window.location.href = "/basket/";  
}


/*-------------------------- end ---------------------------------*/


function search_(){
	var	Getkey = doc("modval_").value;
	var	Gettype= doc("type_").value;
	
	if (Getkey!='' &&Gettype!=''){
			window.location = "/" + Gettype + "-search/" + Getkey + ".html";
	}
	else{
		doc("modval_").focus();
	}	
}

function searchsimple_(){
	var	Getkey = doc("modval_").value;
	
	if (Getkey!='' &&Gettype!=''){
			window.location = "/all-search/" + Getkey + ".html";
	}
	else{
		doc("modval_").focus();
	}	
}