function isObj(o){
	if(o!=null&&o!='undefined'){
		return true;
	}
	return false;
}
function globalshowroom(){
var alertMSG = '';
	alertMSG+='\nUnauthorized Domain: '+document.domain+'';
	alertMSG+='\Product: Globalshowroom webCMS/OnlineStore.\n';			
	alertMSG+='\nWarning: This computer program is protected by copyright law and international treaties.\nUnauthorized reproduction or distribution of this program, or any portion of it,\nmay result in severe civil and criminal penalties, and will be prosecuted to the maximum extent possible under the law.\n';	
	//alertMSG+='\nPlease report to Globalshowroom immediately:';
	//alertMSG+='\ntel (HK) +852 21112 808';
	alertMSG+='\ninfo@globalshowroom.com / www.globalshowroom.com';
	alertMSG+='\n\n2000-2008 Globalshowroom Corporation Limited. All rights reserved.';
	alert(alertMSG);
}
function GS_replaceSTR(str,ptn,rpl,num){
	if(num==1){
		str=str.replace(ptn,rpl);
		if(ptn=='px')str=str.replace('pt',rpl);		
		if(isNaN(str)){
			alert(str);
		}else{
			str=Math.abs(str);
		}
	}else{
		str = str.replace(ptn,rpl);
	}
	return str;
}
//ex1:
//onclick="divZoom(this,'');"
//ex2
//onclick="divZoom(this,'http://.....en1.jpg');"
function divZoom_close(id){
o=document.getElementById(id);
document.body.removeChild(o);
}
function Globalshowroom_ZoomDIV(o,imgUrl,gs){
if(gs!='Powered by Globalshowroom - www.globalshowroom.com.')
GlobalshowroomReserved();
if(!document.getElementById('divZoomID_DIV'))
divZoom_createNow(o,imgUrl);
}
function divZoom(o,imgUrl){
if(!document.getElementById('divZoomID_DIV'))
divZoom_createNow(o,imgUrl);
}
function divZoom_createNow(o,imgUrl){
		if(imgUrl==''){imgUrl=o.src}
		//create IMG
		
		ce_1=document.createElement("DIV");		
		ce_1.id='divZoomID_DIV';
		//tbSTR='<table id=divZoomID_TABLE onclick="divZoom_close(\'divZoomID_DIV\')" border="0" cellspacing="1" cellpadding="0" bgcolor="#FFFFFF">';
  		//tbSTR+='<tr>';
    	//tbSTR+='<td valign="top"><img id=divZoomID_IMG src="'+imgUrl+'" border=0 alt="close"></td>';
  		//tbSTR+='</tr>';
		//tbSTR+='</table>'
		tbSTR='<img id=divZoomID_IMG src="'+imgUrl+'" border=0 onclick="divZoom_close(\'divZoomID_DIV\')">';
		ce_1.innerHTML=tbSTR;
		ce_1.style.position='absolute';
		ce_1.style.zIndex=100;
		//ce_1.style.left=document.body.scrollLeft;
		//ce_1.style.top=document.body.scrollTop;
		ce_1.style.borderTop='1px solid #DDDDDD';
		ce_1.style.borderLeft='1px solid #DDDDDD';
		ce_1.style.borderRight='1px solid #DDDDDD';
		ce_1.style.borderBottom='1px solid #DDDDDD';		
		document.body.appendChild(ce_1); //IE, Firefox
		
		ce_1.onmouseover=function(){document.getElementById('divZoomID_DIV').className='zoomOut'}
		ce_1.onmouseout=function(){document.getElementById('divZoomID_DIV').className=''}
		
		setTimeout('centerDivZoom()',1000)
		/////leftpos=(document.body.clientWidth-document.getElementById('divZoomID_IMG').width)/2
		/////toppos=(document.body.clientHeight-document.getElementById('divZoomID_IMG').height)/2
		/////ce_1.style.left=leftpos+document.body.scrollLeft;
		/////ce_1.style.top=toppos+document.body.scrollTop;
		
		//ce_1.onclick=function(){document.body.removeChild(this)}
		
		//create icon
		/////var xicon='http://'+document.domain+'/icon/helpX.gif'
		/////ce_2=document.createElement("IMG");
		/////ce_2.style.position='absolute';
		/////ce_2.src=xicon;
		/////ce_2.style.zIndex=1;	
		/////ce_2.style.left=document.getElementById('divZoomID_IMG').width-18;
		/////ce_2.style.top=3;
		/////ce_2.onclick=function(){divZoom_close('divZoomID_DIV')}
		/////document.getElementById('divZoomID_DIV').appendChild(ce_2); //IE, Firefox
}

function centerDivZoom(){
		var leftpos=0; toppos=0;
		if(document.getElementById('divZoomID_IMG').width!=''&&document.getElementById('divZoomID_IMG').width>0)
		leftpos=(document.body.clientWidth-document.getElementById('divZoomID_IMG').width)/2
		if(document.getElementById('divZoomID_IMG').height!=''&&document.getElementById('divZoomID_IMG').height>0)
		toppos=(document.body.clientHeight-document.getElementById('divZoomID_IMG').height)/2
		document.getElementById('divZoomID_DIV').style.left=leftpos+document.body.scrollLeft;
		document.getElementById('divZoomID_DIV').style.top=toppos+document.body.scrollTop;
}


function Globalshowroom_popDIV(o,linkUrl,scrollable,width,height,gs){
if(gs!='www.globalshowroom.com')
GlobalshowroomReserved();
if(!document.getElementById('divZoomID_DIV'))
divPop_createNow(o,linkUrl,scrollable,width,height);
}
//<span onclick="Globalshowroom_popDIV(this,'http://www.hkcs.org.hk/asocio/tomokazu.html','yes',700,500,'www.globalshowroom.com')">click me</span>
function divPop_createNow(o,linkUrl,scrollable,width,height){
		
		//create IMG
		ce_1=document.createElement("DIV");		
		ce_1.id='divZoomID_DIV';
		tbSTR='<table id=divZoomID_TABLE border="0" cellspacing="2" cellpadding="0">';
  		tbSTR+='<tr>';
    	tbSTR+='<td align=right>';
			tbSTR='<table border="0" cellspacing="2" cellpadding="0">';
			tbSTR+='<tr>';
				tbSTR+='<td align=right bgcolor="#eeeeee">';
					tbSTR+='<img src="http://'+document.domain+'/icon/sq_delete.gif" border=0 onclick="divZoom_close(\'divZoomID_DIV\')">';
				tbSTR+='</td>';
			tbSTR+='</tr>';	
		tbSTR+='</td>';
  		tbSTR+='</tr>';
		
		tbSTR+='<tr>';
    	tbSTR+='<td valign="top"><iframe src="'+linkUrl+'" scrolling="'+scrollable+'" frameborder=0 width='+width+' height='+height+'></iframe></td>';
  		tbSTR+='</tr>';
		tbSTR+='</table>'

		ce_1.innerHTML=tbSTR;
		ce_1.style.position='absolute';
		ce_1.style.zIndex=100;
		ce_1.style.borderTop='1px solid #cccccc';
		ce_1.style.borderLeft='1px solid #cccccc';
		ce_1.style.borderRight='1px solid #DDDDDD';
		ce_1.style.borderBottom='1px solid #DDDDDD';	
		ce_1.style.backgroundColor='white';	
		document.body.appendChild(ce_1); //IE, Firefox

		var leftpos=0; toppos=0;
		
		leftpos=(document.body.clientWidth-width)/2
		
		toppos=(document.body.clientHeight-height)/2
		document.getElementById('divZoomID_DIV').style.left=leftpos+document.body.scrollLeft;
		document.getElementById('divZoomID_DIV').style.top=toppos+document.body.scrollTop;
		
}
/* Scroll Area START + common_JS.js ; gsStyle.css : scrollArea_left-Down */

function GS_getMove_Ver(id,action,speed){
	
	if(eval('isMouseOver_'+id+'')==0){
			Y=eval('Y_'+id+'');			
			DIV_area_H=eval('DIV_area_H_'+id+'');
			clientObj_H=eval('clientObj_H_'+id+'');
			currentID=eval('currentID_'+id+'');
			increase_clientObj_H=eval('increase_clientObj_H_'+id+'');
				//when client obj "top" meet "top Corner"
				if(Y%clientObj_H==0){
					if(currentID==1&&currentID!=0){
						currentID=2; //swap
						increase_clientObj_H=increase_clientObj_H+clientObj_H; //accumulate
					}else{
						if(currentID!=0)increase_clientObj_H=increase_clientObj_H+clientObj_H; //accumulate
						currentID=1; //swap
					}
				}
			if(action=='T'){
					if(currentID==1){ //run
						document.getElementById("contentTB_1_"+id+"").style.top=Y+increase_clientObj_H;
						move=(Y+clientObj_H+increase_clientObj_H);
						document.getElementById("contentTB_2_"+id+"").style.top=move;
					}else{
						document.getElementById("contentTB_2_"+id+"").style.top=Y+increase_clientObj_H;
						move=(Y+clientObj_H+increase_clientObj_H);
						document.getElementById("contentTB_1_"+id+"").style.top=move;		
					}
				Y--;
			}else if(action=='D'){
					if(currentID==1){ //run
						document.getElementById("contentTB_1_"+id+"").style.top=Y-increase_clientObj_H;
						move=(Y-clientObj_H-increase_clientObj_H);
						document.getElementById("contentTB_2_"+id+"").style.top=move;
					}else{
						document.getElementById("contentTB_2_"+id+"").style.top=Y-increase_clientObj_H;
						move=(Y-clientObj_H-increase_clientObj_H);
						document.getElementById("contentTB_1_"+id+"").style.top=move;		
					}
				Y++;
			}
			eval('Y_'+id+'='+Y+'');	
			eval('currentID_'+id+'='+currentID+'');
			eval('increase_clientObj_H_'+id+'='+increase_clientObj_H+'');
	}	
	GS_getMove_timeoutobj=setTimeout('GS_getMove_Ver(\''+id+'\',\''+action+'\','+speed+')',speed);

}
function GS_getMove_Hor(id,action,speed){
	
	if(eval('isMouseOver_'+id+'')==0){
			X=eval('X_'+id+'');
			DIV_area_W=eval('DIV_area_W_'+id+'');
			clientObj_W=eval('clientObj_W_'+id+'');
			currentID=eval('currentID_'+id+'');
			increase_clientObj_W=eval('increase_clientObj_W_'+id+'');
				//when client obj "Left" meet "Left Corner"
				
				
						if(X%clientObj_W==0){
							if(currentID==1&&currentID!=0){
								currentID=2; //swap
								increase_clientObj_W=increase_clientObj_W+clientObj_W; //accumulate
							}else{
								if(currentID!=0)increase_clientObj_W=increase_clientObj_W+clientObj_W; //accumulate
								currentID=1; //swap
							}
						}
				if(action=='L'){		
						if(currentID==1){ //run
							document.getElementById("contentTB_1_"+id+"").style.left=X+increase_clientObj_W;
							move=(X+clientObj_W+increase_clientObj_W);
							document.getElementById("contentTB_2_"+id+"").style.left=move;
						}else{
							document.getElementById("contentTB_2_"+id+"").style.left=X+increase_clientObj_W;
							move=(X+clientObj_W+increase_clientObj_W);
							document.getElementById("contentTB_1_"+id+"").style.left=move;		
						}
					X--;
				}else if(action=='R'){

						if(currentID==1){ //run
							document.getElementById("contentTB_1_"+id+"").style.left=X-increase_clientObj_W;
							move=(X-clientObj_W-increase_clientObj_W);
							document.getElementById("contentTB_2_"+id+"").style.left=move;
						}else{
							document.getElementById("contentTB_2_"+id+"").style.left=X-increase_clientObj_W;
							move=(X-clientObj_W-increase_clientObj_W);
							document.getElementById("contentTB_1_"+id+"").style.left=move;		
						}
					X++;				
				}
			eval('X_'+id+'='+X+'');	
			eval('currentID_'+id+'='+currentID+'');
			eval('increase_clientObj_W_'+id+'='+increase_clientObj_W+'');
	}	
	GS_getMove_timeoutobj=setTimeout('GS_getMove_Hor(\''+id+'\',\''+action+'\','+speed+')',speed);

}

function GS_createInstance(id,action,speed){
	o=document.getElementById("DIV_area_"+id+"");
	o.style.position='relative';
	o.onmouseover=function(){GS_ScrollArea_Mover(id)};
	o.onmouseout=function(){GS_ScrollArea_Mout(id)};
	
	if(action=='L'||action=='R'){
		!eval('X_'+id+'=0');
		!eval('DIV_area_W_'+id+'=0');
		!eval('clientObj_W_'+id+'=0');	
		!eval('increase_clientObj_W_'+id+'=0');
	}else{
		!eval('Y_'+id+'=0');
		!eval('DIV_area_H_'+id+'=0');
		!eval('clientObj_H_'+id+'=0');		
		!eval('increase_clientObj_H_'+id+'=0');
	}
	!eval('currentID_'+id+'=0');
	!eval('isMouseOver_'+id+'=0');
	
	var str='';
	str+='<table id="contentTB_1_'+id+'" style="position:absolute" border="0" cellspacing="0" cellpadding="0">';
	  str+='<tr>';
		str+='<td nowrap>';
		str+=o.innerHTML;
		str+='</td>';
	  str+='</tr>';
	str+='</table>';
	
	str+='<table id="contentTB_2_'+id+'" style="position:absolute" border="0" cellspacing="0" cellpadding="0">';
	  str+='<tr>';
		str+='<td nowrap>';
		str+=o.innerHTML;
		str+='</td>';
	  str+='</tr>';
	str+='</table>';
	o.innerHTML=str;
	document.getElementById("contentTB_1_"+id+"").style.left='0px';
	document.getElementById("contentTB_2_"+id+"").style.left='0px';
			
	if(action=='L'||action=='R'){
		clientObj_W=(document.getElementById("contentTB_1_"+id+"").clientWidth);
			eval('clientObj_W_'+id+'='+clientObj_W+'');
		DIV_area_W=Math.abs(o.style.width.replace('px',''));
			eval('DIV_area_W_'+id+'='+DIV_area_W+'');
			GS_getMove_Hor(id,action,speed);
	}else{
		clientObj_H=(document.getElementById("contentTB_1_"+id+"").clientHeight);
			eval('clientObj_H_'+id+'='+clientObj_H+'');
		DIV_area_H=Math.abs(o.style.height.replace('px',''));
			eval('DIV_area_H_'+id+'='+DIV_area_H+'');
			GS_getMove_Ver(id,action,speed);
	}	
	
}

function GS_ScrollArea_Mover(id){
eval('isMouseOver_'+id+'=1')
}
function GS_ScrollArea_Mout(id){
eval('isMouseOver_'+id+'=0')
}
function GlobalshowroomReserved(){
	alert('Globalshowroom Corporation Ltd. all rights reserved.\n\nhttp://www.globalshowroom.com');
}
function GS_ScrollArea_init(gs){
		
		if(gs!='Powered by Globalshowroom - www.globalshowroom.com.')
		GlobalshowroomReserved();
		
		if(isObj(document.getElementById('DIV_area_0'))){
			var init_i=0;
		}else{
			var init_i=1;
		}
		//find DIV_area
		for(i=init_i;document.getElementById('DIV_area_'+i);i++){
			o=document.getElementById('DIV_area_'+i);
			o.style.display='';
			thisSpeed=20;
			oSpeed=document.getElementById('DIV_area_'+i+'_speed');			
			if(oSpeed){
				if(oSpeed.value!=''&&!isNaN(oSpeed.value)){				
					thisSpeed=oSpeed.value;
				}
			}

			
			if(navigator.appName=='Microsoft Internet Explorer'||navigator.appName=='Netscape'){
				thisClassName=o.className;
				//alert(o.title)
				if(thisClassName=='scrollArea_left'){
					GS_createInstance(i,'L',thisSpeed);
				}else if(thisClassName=='scrollArea_top'){
					GS_createInstance(i,'T',thisSpeed);
				}else if(thisClassName=='scrollArea_right'){
					GS_createInstance(i,'R',thisSpeed);
				}else if(thisClassName=='scrollArea_down'){
					GS_createInstance(i,'D',thisSpeed);	
				}
			}else{
				o.innerHTML='Stopped! Only work on IE/Firefox';
			}	
		}

}
/* Scroll Area END */

/* 
Set CSS fontSize START 
onclick="GS_setFontSize('www.globalshowroom.com','CSS-Name')"
*/
var GS_setFontSize_i=0;GS_lastFontSize=0;GS_lastClassObj=null;
function GS_setFontSize(gs,className){
	
	if(gs!='www.globalshowroom.com')
	GlobalshowroomReserved();
		
	var found=0;
	for (var s = 0; s < document.styleSheets.length&&found==0; s++){
		if(document.styleSheets[s].rules){
			for (var r = 0; r < document.styleSheets[s].rules.length; r++){
				if (document.styleSheets[s].rules[r].selectorText == '.' + className){
					GS_lastClassObj=document.styleSheets[s].rules[r];
					found=1;
				}
			}
		}else if(document.styleSheets[s].cssRules){
			for (var r = 0; r < document.styleSheets[s].cssRules.length; r++){
				if (document.styleSheets[s].cssRules[r].selectorText == '.' + className){
					GS_lastClassObj=document.styleSheets[s].cssRules[r];
					found=1;
				}
			}
		}
	}
	if(GS_lastClassObj=='[object CSSStyleRule]'||GS_lastClassObj=='[object]'){
		curr_fontSize=GS_lastClassObj.style.fontSize
		curr_fontSize=GS_replaceSTR(curr_fontSize,'px','',1);
		if(GS_setFontSize_i==0){GS_setFontSize_i=curr_fontSize;}else{GS_setFontSize_i=GS_setFontSize_i+2}
		if(GS_setFontSize_i%20<10){
			GS_lastClassObj.style.cursor='url(http://'+document.domain+'/icon/zoomout.cur), default';
			GS_lastFontSize=curr_fontSize-2;
		}else{
			GS_lastClassObj.style.cursor='url(http://'+document.domain+'/icon/zoomin.cur), default';
			GS_lastFontSize=curr_fontSize+2;
		}						
		GS_lastClassObj.style.fontSize=GS_lastFontSize;		
		//document.getElementById("tmp").innerText='GS_setFontSize_i['+GS_setFontSize_i+'] ; GS_lastFontSize['+GS_lastFontSize+']'
	}
}
/* Set CSS fontSize END */