﻿function wp_getObj(id,d)
{
	var i,x;  if(!d) d=document; 
	if(!(x=d[id])&&d.all) x=d.all[id]; 
	for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][id];
	for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=wp_getObj(id,d.layers[i].document);
	if(!x && document.getElementById) x=document.getElementById(id); 
	return x;
}

function checkpage()
{
	if (parent.location.href == self.location.href)
		window.location.href = 'Default.aspx';  // contains the FRAMESET definitions
}


//判斷textbox是否輸入的為數字
function checkNumeric(textbox)
{
	if ((event.keyCode<48 || event.keyCode>57) && event.keyCode!=46) {event.keyCode='';}
	if (event.keyCode==46 && textbox.value.indexOf('.')>=0) {event.keyCode='';}

}

//判斷textbox是否有輸入
function checkInput(o)
{
	if (o.value == "")
	{
		o.focus();
		o.style.backgroundColor="Red";
		return false;
	}
	else
	{
		return true;
	}


}

function mouseover(obj,fcolor,bcolor)
{
	obj.style.backgroundColor = bcolor;//背景顏色
	obj.style.color = fcolor;//文字顏色
}

function mouseout(obj,fcolor,bcolor)
{
	obj.style.backgroundColor = bcolor;//背景顏色
	obj.style.color = fcolor;//文字顏色
}



//轉址
function rsPage(url)
{
	document.location.href=url;
}	


//切換Frame
function sizechage(frameset,frame,size)
{
	if(frame.document.readyState=='complete')
	{
		frameset.cols=size;
		clearInterval(check);
	}
}

//MapFrame --> 指定url
function ShowTempFrame(url)
{
	top.mapvis = 0;
	if (url != null) top.frames["tempFrame"].location.href  = url;

	//var allmap_framese=top.document.getElementById('allmap_framese');
	//allmap_framese.cols= '0,0,*,0';
	check=setInterval("sizechage( top.document.getElementById('allmap_framese') , top.frames['tempFrame'],'0,0,*,0')",300);
	var modframeset=top.document.getElementById('modframeset');
	modframeset.rows= '*,0';
}

//TempFrame2 --> 指定url
function ShowTempFrame2(url)
{
	top.mapvis = 0;
	if (url != null) top.frames["tempFrame2"].location.href  = url;
	
	//var allmap_framese=top.document.getElementById('allmap_framese');
	//allmap_framese.cols= '0,0,0,*';
	check=setInterval("sizechage(top.document.getElementById('allmap_framese') ,top.frames['tempFrame2'],'0,0,0,*')",300);
	var modframeset=top.document.getElementById('modframeset');
	modframeset.rows= '*,0';
}


//MapFrame --> map
function ShowMapFrame()
{
	top.mapvis = 1;
	var allmap_framese=top.document.getElementById('allmap_framese');
	allmap_framese.cols= '150,*,0,0';
	var modframeset=top.document.getElementById('modframeset');
	modframeset.rows= '*,35';
}


//用javascript讀cookie
function getCKVal(CookieName)
{
	alert(document.cookie);
	CookieName = CookieName + "="
	if (document.cookie.length > 0)
	{
		position = document.cookie.indexOf(CookieName)
		if (position != -1)
		{
			position = position + CookieName.length
			endposition = document.cookie.indexOf(";" , position)
			if (endposition == -1)
			{
				endposition = document.cookie.length
			}
			return document.cookie.substring(position,endposition)
		}
	}
	return null
}







