function MM_reloadPage(init) {  //reloads the window if Nav4 resized
  if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
    document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
  else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

var aWin,d = null;
function openWin(URL) {
	aWin = window.open(URL,"picView","width=200,height=200,resizable=yes,scrollbars=no");
	d = aWin.document;
	d.open("text/html");
	d.write('<html><body><p><center><img src="'+URL+'" onLoad="resizeTo(document.images[0].width+35,document.images[0].height+85);"></center></p></body></html>');
	d.title = '龍發製藥(香港)有限公司 - Long Far Herbal Medicine Mfg.(HK) Ltd.';
	d.close();

	aWin.focus();
}

var aWin,d = null;
function openWinNews(URL) {
	aWin = window.open(URL,"picView","width=200,height=200,left=80,top=10,resizable=yes,scrollbars=yes");
	d = aWin.document;
	d.open("text/html");
	d.write('<html><body><p><center><img src="'+URL+'" onLoad="resizeTo(document.images[0].width+65,document.images[0].height+85);"></center></p></body></html>');
	d.title = '龍發製藥(香港)有限公司 - Long Far Herbal Medicine Mfg.(HK) Ltd.';
	d.close();
	
	aWin.focus();
}

function openURL(inURL)
	{
		
		var winProperty = 'height=580' + ',width=800' + ',top=20' + ',left=40' + ',scrollbars=yes' + ',resizable=yes' ;
		windowname = 'NewURL';
		window.open(inURL, windowname, winProperty);
		
	}

function showShopping() 
{
	var windowPage = "http://shop.epaylink.com/longfar/"
	var windowName = "LongFarShopping"
	var features = "width=770,height=600, toolbar=no,scrollbars=yes,titlebar=no,resizable=yes,menubar=no"
	var newWin = window.open (windowPage, windowName, features)
	newWin.moveTo (0, 0)
	newWin.focus()
	
}

function printit(){  
	if (window.print) {
    		window.print() ;  
	} else {
    		var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
		document.body.insertAdjacentHTML('beforeEnd', WebBrowser);
    		WebBrowser1.ExecWB(6, 2);//Use a 1 vs. a 2 for a prompting dialog box    WebBrowser1.outerHTML = "";  
	}
}

function ShowWindowStatus(){
window.status="龍發製藥(香港)有限公司　Long Far Herbal Medicine Mfg.(HK) Ltd."
setTimeout("remove_message()",4500);
}

function message(txt)
{ 
	window.status = txt;
	setTimeout("remove_message()",4500); 
} 

function remove_message()
{ 
	window.status=""; 
}

//<a href="#" target="content" onMouseOver="message('click');return true;"><img SRC="#.jpg"></a>


/*
No Right Click
*/



//if (window.Event) // Only Netscape will have the CAPITAL E.
//
//  document.captureEvents(Event.MOUSEUP); // catch the mouse up event
//
//
//
//function nocontextmenu()  // this function only applies to IE4, ignored otherwise.
//
//{
//
//	event.cancelBubble = true
//
//	event.returnValue = false;
//
//
//
//	return false;
//
//}
//
//
//
//function norightclick(e)	// This function is used by all others
//
//{
//
//	if (window.Event)	// again, IE or NAV?
//
//	{
//
//		if (e.which == 2 || e.which == 3)
//
//			return false;
//
//	}
//
//	else
//
//		if (event.button == 2 || event.button == 3)
//
//		{
//
//			event.cancelBubble = true
//
//			event.returnValue = false;
//
//			return false;
//
//		}
//
//	
//
//}



//document.oncontextmenu = nocontextmenu;		// for IE5+

//document.onmousedown = norightclick;		// for all others


function setImageSize(imageName, maxWidth, maxHeight)
{
	if (eval("document.getElementById(\"" + imageName + "\").width > " + maxWidth) && eval("document.getElementById(\"" + imageName + "\").height > " + maxHeight))
	{
		if (eval("document.getElementById(\"" + imageName + "\").width > document.getElementById(\"" + imageName + "\").height"))
		{
			eval("document.getElementById(\"" + imageName + "\").width = " + maxWidth + ";");
			eval("document.getElementById(\"" + imageName + "\").height = ( (document.getElementById(\"" + imageName + "\").height / document.getElementById(\"" + imageName + "\").width) * " + maxWidth + ");");
			eval("document.getElementById(\"" + imageName + "\").width.value = document.getElementById(\"" + imageName + "\").width ;");
			eval("document.getElementById(\"" + imageName + "\").height.value = document.getElementById(\"" + imageName + "\").height ;");
		}
		else
		{
			eval("document.getElementById(\"" + imageName + "\").height = " + maxHeight + ";");
			eval("document.getElementById(\"" + imageName + "\").width = ( (document.getElementById(\"" + imageName + "\").width / document.getElementById(\"" + imageName + "\").height) * " + maxHeight + ");");
			eval("document.getElementById(\"" + imageName + "\").width.value = document.getElementById(\"" + imageName + "\").width ;");
			eval("document.getElementById(\"" + imageName + "\").height.value = document.getElementById(\"" + imageName + "\").height ;");
		}
	}
	else
	{
		if (eval("document.getElementById(\"" + imageName + "\").width > " + maxWidth))
		{
			eval("document.getElementById(\"" + imageName + "\").width = " + maxWidth + ";");
			eval("document.getElementById(\"" + imageName + "\").height = ( (document.getElementById(\"" + imageName + "\").height / document.getElementById(\"" + imageName + "\").width) * " + maxWidth + ");");
			eval("document.getElementById(\"" + imageName + "\").width.value = document.getElementById(\"" + imageName + "\").width ;");
			eval("document.getElementById(\"" + imageName + "\").height.value = document.getElementById(\"" + imageName + "\").height ;");
		}
		else
		{
			if (eval("document.getElementById(\"" + imageName + "\").height > " + maxHeight))
			{
				eval("document.getElementById(\"" + imageName + "\").height = " + maxHeight + ";");
				eval("document.getElementById(\"" + imageName + "\").width = ( (document.getElementById(\"" + imageName + "\").width / document.getElementById(\"" + imageName + "\").height) * " + maxHeight + ");");
				eval("document.getElementById(\"" + imageName + "\").width.value = document.getElementById(\"" + imageName + "\").width ;");
				eval("document.getElementById(\"" + imageName + "\").height.value = document.getElementById(\"" + imageName + "\").height ;");
			}
		}
	}
}


function ShowCopyrights()
{

var out = ""
	
	out += "<table align=left with=450 border=0 cellpadding=0 cellspacing=0><tr><td width=50>&nbsp;</td><td align=center>";
	out += "<font size='1'>&copy; Copyrights 1998-2009. Long Far Herbal Medicine Mfg. (HK) Ltd. <br>";
	out += "All rights reserved. Powered by <a href='http://www.ic-computer.com.hk' target='_blank'>IC Computer Service</a></font>";
	out += "</td></tr></table>";
	
	document.write(out)

}

function chk_out()
{
	if(document.searchForm.searchKey.value == "")
	{
		alert("請填寫你想搜尋的資料");
		document.searchForm.searchKey.focus();
		return false;	
		}
		else
		{
		return true;
	}
}

function LoginFormValidation()
{
	if (document.getElementById("txtLoginName").value != "")
	{
		if (document.getElementById("txtLoginPassword").value != "")
		{
			return true ;
		}
		else
		{
			alert("請填寫你的會員密碼") ;
			document.getElementById("txtLoginPassword").focus() ;
			return false ;
		}
		
	}
	else
	{
		alert("請填寫你的會員名稱") ;
		document.getElementById("txtLoginName").focus() ;
		return false ;
	}
}


function init() {
  if (!document.getElementById) return
  var imgOriginSrc;
  var imgTemp = new Array();
  var imgarr = document.getElementsByTagName('img');
  for (var i = 0; i < imgarr.length; i++) {
    if (imgarr[i].getAttribute('hsrc')) {
        imgTemp[i] = new Image();
        imgTemp[i].src = imgarr[i].getAttribute('hsrc');
        imgarr[i].onmouseover = function() {
            imgOriginSrc = this.getAttribute('src');
            this.setAttribute('src',this.getAttribute('hsrc'))
        }
        imgarr[i].onmouseout = function() {
            this.setAttribute('src',imgOriginSrc)
        }
    }
  }
}
onload=init;
onload=MM_preloadImages("images/group/group_dev_over.jpg","images/group/group_annual_over.jpg","images/group/group_awards_over.jpg","images/news/news_over.jpg","images/product/prod_detox_over.jpg","images/product/prod_sliming_over.jpg","images/product/prod_mens_over.jpg","images/product/prod_womens_over.jpg","images/product/prod_body_over.jpg","images/product/prod_soups_over.jpg","images/member/member_circular_over.jpg","images/member/member_qa_over.jpg","images/member/member_quess_over.jpg","images/member/member_health_over.jpg","images/multimedia/multi_tvc_over.jpg","images/multimedia/multi_events_over.jpg","images/multimedia/multi_ecard_over.jpg","images/multimedia/multi_wallpaper_over.jpg","images/contact/contact_over.jpg","images/search/search_over.jpg");
