
function getPicSize(theImg){
var hh = 100		//40
var ww = 100		//56
var oldHH = theImg.width;
var oldWW = theImg.height;

	if (oldHH>hh || oldWW>ww){
		if (oldHH > oldWW ){
			ww = parseInt(ww * (oldWW / oldHH));
		} else {
			hh = parseInt(hh * (oldHH / oldWW));
		};
		theImg.style.height = ww;
		theImg.style.width = hh;
	};
	
}


String.prototype.trim= function()  
{  
    // 用正则表达式将前后空格  
    // 用空字符串替代。  
    return this.replace(/(^\s*)|(\s*$)/g, "");  
}

function bookmarksite(title, url){
	if (document.all)
		window.external.AddFavorite(url, title);
	else if (window.sidebar)
		window.sidebar.addPanel(title, url, "")
}

function templateSelect(value){
	var Inquiry = "Dear __________, \n\n We are interested in your product of __________in a quantity of __________. \n\n Please send us details of your product specifications and price terms for shipment to the port of __________ by the way of__________. \n\n We look forward to hearing from you soon. \n\n Sincerely, \n\n __________.";
	
	var Quotation = "We understand from your information posted on Alibaba.com that you are in the market for __________. \n\n We are a __________company specializing in exporting__________. We accordingly make the following offer:\n 1. Product Name: __________\n 2. Packing: __________\n 3. Quantity: __________\n 4. Price: __________\n 5. Payment: __________\n 6. Shipment: __________\n\n If any of our products are of interest to you, please let us know. We will be happy to give you a quotation upon receipt of your detailed requirements.\n\n We look forward to hearing from you soon.\n\n Sincerely,\n\n __________.";
	
	var buyer_inquiry = "Dear__________,\n\n Thank you for your inquiry dated __________regarding__________. \n\n Please find the detailed product information as follows: \n Product Description: __________ \n Specifications: __________ \n Packaging: __________ \n Price: __________ \n Payment terms: __________ \n We look forward to hearing from you soon and processing your first order. \n\n Sincerely, \n\n __________.";
	
	var supplier_quotation = "Dear __________, \n\n Thank you for your message dated__________ \n\n Please send us details of your product specifications and price terms for shipment to the port of __________ by the way of __________. \n\n We are looking forward to your reply. \n\n Sincerely, \n\n __________.";
	
	if(value==1){
		contactForm.message.value=Inquiry;
	}else if(value==2){
		contactForm.message.value=Quotation;
	}else if(value==3){
		contactForm.message.value=buyer_inquiry;
	}else if(value==4){
		contactForm.message.value=supplier_quotation;
	}else{
		contactForm.message.value = "";
	}
}


/**contact.asp留言form验证**/
function checkContactForm(form){
	var subject = form.subject.value;
	var message = form.message.value;
	//alert(message);
	if(subject.trim()==""){
		alert("Please input the Subject!");
		return false;
	}
	if(message.trim()==""){
		alert("Please input the Subject!");
		return false;
	}
	return true;
}



function showDialog(){
	window.showModalDialog("message.asp","","dialogHeight:400px; dialogWidth:650px; edge: Raised; center: Yes; help: no; resizable: no; status: no;");
}