// JavaScript Document
function SetWinHeight(obj)
{
	var win=obj;
	if (document.getElementById)
	{
		if (win && !window.opera)
		{
			if (win.contentDocument && win.contentDocument.body.offsetHeight)
			{
				win.height = win.contentDocument.body.offsetHeight;
				win.width =win.contentDocument.body.offsetWidth;
			}
			else if(win.Document && win.Document.body.scrollHeight)
			{
				win.height = win.Document.body.scrollHeight;
				win.width=win.Document.body.scrollWidth;
			}
		}
	}
}

function ListSearchKey(wd)
{
	if(wd!="")
	{
		document.getElementById("GetSearchKey").src="/GetSearchKey.aspx?wd=" + wd
	}
}

function SetKeyWord(wd)
{
	var SiteSearch = document.forms["SiteSearch"];
	SiteSearch.wd.value = wd;
	SearchKeyList.style.display="none";
	SiteSearch.submit();
}

function ReplaceScript(strout) {
    strout = strout.replace(/<script[^>]*>[\w\W]*?<\/script>/ig, '');
    strout = strout.replace("<", "&lt;");
    strout = strout.replace(">", "&gt;");
    strout = strout.replace(/(^\s*)|(\s*$)/g,"");
    return strout;
}

function CheckSearchForm()
{
	var SiteSearch = document.forms(0);
	if(ReplaceScript(SiteSearch.wd.value) == "" || ReplaceScript(SiteSearch.wd.value) == "Search Products")
	{
		alert("Please input Key words");
		SiteSearch.wd.value = "Search Products";
		return false;
	}
	return true;
}


function show(obj,targetid){
	var target_obj = document.getElementById(targetid);
	if(target_obj.style.display == 'none'){
	var target_left = 0;
	var target_top = 0;
	for(var e=obj; e; e=e.offsetParent){
		target_left += e.offsetLeft;
		target_top += e.offsetTop
	}
		target_top += 18;
		target_obj.style.top = target_top+'px';
		target_obj.style.left = target_left+'px';
		target_obj.style.display = '';
	}else{
		target_obj.style.display = 'none';
	}
}


