/* SHARE FUNCTIONS */



	var newWin;
	function InitialTheLeftMenu()
	{
		document.getElementById('TD_'+SelLeftMItemID).className='SelMenuItem';
		document.getElementById('A_'+SelLeftMItemID).className='SelMenuItem' ;
		document.getElementById('SPAN_'+SelLeftMItemID).innerHTML='<IMG height=7 src=/MORE/UI/IMAGE/BlackArrow.gif width=7></IMG>&nbsp;';
		document.getElementById('TopBarTitle').innerHTML=document.MainFrm.hdTopBarTitle.value+':';
		/*document.getElementById('TopBarImg').src=document.MainFrm.hdTopBarImgSrc.value;*/
		
		/*document.getElementById('KeyCodeText').innerHTML='<U>'+CKT+'</U>';*/
		/*document.TopBFrm.TopB:KeyCodeValue.value=CKV;	*/
	}
	
	function OpenKeyCodeWin(){
		switch (SelLeftMID){
			case "LL": FillKeyCode('Penny','7788');break;
			case "PP": alert("Property!!");break;
			case "TN": alert("Tenant!!");break;
			case "LS": alert("Lease!!");break;
			default:   alert("Some problems happen!!")
		}
	}
	function ViewHelp(){
		//var URLStr=location.href;
		//var URLLength=URLStr.length;
		//var slashFlag=URLStr.lastIndexOf("/",URLLength+1);
		//URLStr=URLStr.substring(slashFlag+1,URLLength+1);
		//alert(URLStr);
		OpenPopWin("ViewHelp","/MORE/HELP/construct.aspx","","","");
	}	
	function SwitchTopTab(UIType){
			document.getElementById('TopTab_'+UIType+'Tab').className="tabsel";
	}		
	function SwitchLeftM(LeftM_type,urlStr){
		CKT=document.getElementById('Tab_TopB_lblCKT').innerHTML;		
		CKV=document.MainFrm.Tab_TopB_hdCKV.value;
		PKT=document.MainFrm.Tab_TopB_hdPKT.value;				
		PKV=document.MainFrm.Tab_TopB_hdPKV.value;				
		AttachQueryStr=document.MainFrm.Tab_TopB_hdAttachQueryStr.value;
		if (CKV!=""){
			urlStr=urlStr+"?CKT="+CKT+"&CKV="+CKV
			if (PKV!="") 
				urlStr=urlStr+"&PKT="+PKT+"&PKV="+PKV;						
			if (AttachQueryStr!="")
				urlStr=urlStr+"&"+AttachQueryStr;
			location.href=urlStr;			
		}else
			alert("Please insert a new ["+LeftM_type+"] first!");
	}
	function SwitchDataTab(TabType){
			if (TabType=='Tab1'){
				document.getElementById('DataTab_Tab1').className="tabsel";						
				document.getElementById('DataTab_Tab2').className="tab";		
				document.getElementById('TABLE_Tab1').style.display="";
				document.getElementById('TABLE_Tab2').style.display="none";				
			}
			if (TabType=='Tab2'){
				document.getElementById('DataTab_Tab1').className="tab";						
				document.getElementById('DataTab_Tab2').className="tabsel";			
				document.getElementById('TABLE_Tab1').style.display="none";
				document.getElementById('TABLE_Tab2').style.display="";											
			}					
	}	
	function SwitchDataTab_tmp(TabType){
			if (TabType=='Basic'){
				document.getElementById('TD_Basic').className="DataTab_dark";
				document.getElementById('TD_Advance').className="DataTab_light";
				document.getElementById('TABLE_Basic').style.display="";
				document.getElementById('TABLE_Advance').style.display="none";		
			}	
			if (TabType=='Advance'){
				document.getElementById('TD_Basic').className="DataTab_light";
				document.getElementById('TD_Advance').className="DataTab_dark";
				document.getElementById('TABLE_Basic').style.display="none";
				document.getElementById('TABLE_Advance').style.display="";
			}					
	}		
	function FillKeyCode(CKT,CKV){
		urlStr=location.href;
		location.href=urlStr.substring(0,urlStr.indexOf('?'))+'?CKT='+CKT+'&CKV='+CKV;
	}

	function OpenPopWin(SelectType,URL,Val1,Val2,Val3){	
		var windowName = "";
		if (SelectType=='PostSDCharges') {			
			w=510;
			h=510;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
		}	
		if (SelectType=='PostSDInterest') {			
			w=510;
			h=510;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
		}					
		if (SelectType=='PostReceivable'){
			w=540;
			h=290;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';				
		}				
		if (SelectType=='SelMContactPerson') {			
			w=510;
			h=510;
			X=150;
			Y=150;
			windowName = "SelMContactPerson";
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
		}		
		if (SelectType=='ViewHelp') {			
			w=460;
			h=365;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
		}						
		if (SelectType=='SelCompany') {			
			w=460;
			h=365;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
		}	
		if (SelectType=='SelPerson') {			
			w=460;
			h=365;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
		}			
		if (SelectType=='EditRoom') {	
			w=300;
			h=200;
			X=150;
			Y=150;	
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
		}
		//staff title:/PM/PN/Personnel_profile_update.aspx
		if (SelectType=='SelSTTitle') {	
			w=539;
			h=400;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', menubar=0, toolbar=0, resizable=0, status=0, scrollbars=1';
		}
		//staff status:/PM/PN/Personnel_profile_update.aspx
		if (SelectType=='SelSTStatus') {	
			w=539;
			h=400;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', menubar=0, toolbar=0, resizable=0, status=0, scrollbars=1';
		}
		//Show Upload Photo
		if(SelectType=='ShowPhoto') {
			w=540;
			h=540;
			X=150;
			Y=150;
			StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', menubar=0, toolbar=0, resizable=1, status=0, scrollbars=1';
		}
		
		newWin=window.open(URL,windowName,StatusStr);	
		newWin.focus();									
	}
/*	
	function OpenPopWin(i,URL,Val1,Val2,Val3){	
		arrayList = new Array("PostSDCharges",		//0
							  "PostSDInterest",		//1
							  "PostReceivable",		//2
							  "SelMContactPerson",	//3
							  "ViewHelp",			//4
							  "SelCompany",			//5
							  "SelPerson",			//6
							  "EditRoom",			//7
							  "SelSTTitle",			//8
							  "SelSTStatus",		//9
							  "ShowPhoto"			//10
							  );
		SelectType = arrayList[i];
	    switch(SelectType)
	    {
			case "PostSDCharges":
				w=510;
				h=510;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
				break;
			case "PostSDInterest":
				w=510;
				h=510;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
				break;
			case "PostReceivable":
				w=540;
				h=290;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';		
				break;
			case "SelMContactPerson":
				w=510;
				h=510;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
				break;
			case "ViewHelp":
				w=460;
				h=365;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
				break;
			case "SelCompany":
				w=460;
				h=365;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
				break;
			case "SelPerson":
				w=460;
				h=365;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
				break;
			case "EditRoom":
				w=300;
				h=200;
				X=150;
				Y=150;	
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', scrollbars=no, menubar=0, toolbar=0,scrollbars=yes';
				break;
			case "SelSTTitle"://staff title:/PM/PN/Personnel_profile_update.aspx
				w=539;
				h=400;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', menubar=0, toolbar=0, resizable=0, status=0, scrollbars=1';
				break;
			case "SelSTStatus"://staff status:/PM/PN/Personnel_profile_update.aspx
				w=539;
				h=400;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', menubar=0, toolbar=0, resizable=0, status=0, scrollbars=1';
				break;
			case "ShowPhoto"://Show Upload Photo
				w=539;
				h=400;
				X=150;
				Y=150;
				StatusStr='width='+w+', height='+h+',left='+X+', top='+Y+', menubar=0, toolbar=0, resizable=1, status=0, scrollbars=1';
				break;
			default:
				break;
	    }
		
		newWin=window.open(URL,"",StatusStr);	
		newWin.focus();									
	}
*/

	//連結至Property工作
	function Redirection(target, querySet1, querySet2, querySet3, querySet4)
	{
		switch(target)
		{
			case 0:	//LL
				parent.location.href = "LL_profile_detail.aspx?CKV=" + querySet1 + "&CKT=" + escape(querySet2);
				break;
			case 1:	//PP
				parent.location.href = "PPT_profile_update.aspx?CKV=" + querySet1 + "&CKT=" + escape(querySet2);
				break;
			case 2:	//UN
				parent.location.href = "UN_profile_detail.aspx?CKV=" + querySet1 + "&CKT=" + escape(querySet2);
				break;
			case 3:	//LS
				parent.location.href = "LS_profile_detail.aspx?CKV=" + querySet1 + "&CKT=" + escape(querySet2) + "&PKV=" + querySet3 + "&PKT=" + escape(querySet4);
				break;
		}
	}

/* TOP MENU FUNCTIONS */
/*
	var eOpenMenu = null;
	function OpenMenu(eSrc,eMenu)
	{
		eMenu.style.left = eSrc.offsetLeft + divMenuBar.offsetLeft;
		eMenu.style.top = divMenuBar.offsetHeight + divMenuBar.offsetTop;
		eMenu.style.visibility = "visible";
		eOpenMenu = eMenu;
	}
	function CloseMenu(eMenu)
	{
		eMenu.style.visibility = "hidden";
		eOpenMenu = null;
	}
	function document.onmouseover()
	{
		var eSrc = window.event.srcElement;
		if ("clsMenuBarItem" == eSrc.className)
		{
			//eSrc.style.color = "#CC0000"; 
			var eMenu = document.all[eSrc.id.replace("tdMenuBarItem","divMenu")];
			if (eOpenMenu && eOpenMenu != eMenu) 
			{
				CloseMenu(eOpenMenu);
			}
			if (eMenu) 
			{
				OpenMenu(eSrc,eMenu);
			}
		}
		else if (eOpenMenu && !eOpenMenu.contains(eSrc) && !divMenuBar.contains(eSrc)) 
		{
			CloseMenu(eOpenMenu);
		}
	}
	function document.onmouseout()
	{
		var eSrc = window.event.srcElement;
		if ("clsMenuBarItem" == eSrc.className)
		{
			eSrc.style.color = ""; 
		}
	}	
	
*/
