function Redirect(href){
	location.href=href;
}
function OpenMap(href){
	var won;
	var width=500;
	var height=400;
	var left =(screen.availWidth - width)/2;
	var top =(screen.availHeight - height)/2;
	var won;
	var strTemp ="location=no,scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won=window.open( href,'newwin',strTemp);
	won.focus();

}
function OpenFullWindow(href){
	var won;

	var left =0;
	var top =0;
	var width =screen.availWidth;
	var height =screen.availHeight;
	var won;
	var strTemp ="location=no,scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won=window.open( href,'newwin',strTemp);
	won.focus();

}
function OpenMidWindow(href,width,height){
	var won;

	var left =(screen.availWidth - width)/2;
	var top =(screen.availHeight - height)/2;
	var won;
	var strTemp ="location=no,scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won=window.open( href,'newwin',strTemp);
	won.focus();

}
function OpenMid2Window(href,width,height){
	var won;

	var left =(screen.availWidth - width)/2;
	var top =(screen.availHeight - height)/2;
	var won2;
	var strTemp ="location=no,scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won2=window.open( href,'newwin2',strTemp);
	won2.focus();

}
function OpenMidScrollWindow(href,width,height){
	var won;

	var left =(screen.availWidth - width)/2;
	var top =(screen.availHeight - height)/2;
	var won;
	var strTemp ="location=no,scrollbars=Yes,resizable=Yes,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won=window.open( href,'newwin',strTemp);
	won.focus();

}
function OpenMidScroll2Window(href,width,height){
	var won;

	var left =(screen.availWidth - width)/2;
	var top =(screen.availHeight - height)/2;
	var won;
	var strTemp ="location=no,scrollbars=Yes,resizable=Yes,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won=window.open( href,'newwin',strTemp);
	won.focus();

}
function OpenMidTopWindow(href,width,height){
	var won;

	var left =(screen.availWidth - width)/2;
	var top =0;
	var won;
	var strTemp ="location=no,scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won=window.open( href,'newwin',strTemp);
	won.focus();
}
function OpenMidFullWindow(href,width){
	var won;

	var left =(screen.availWidth - width)/2;
	var top =0;
	var won;
	var strTemp ="location=no,scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + (screen.availHeight-40);
	won=window.open( href,'newwin',strTemp);
	won.focus();
}
function OpenLeftTopWindow(href,width){
	var won;

	var left =0;
	var top =0;
	var won;
	var strTemp ="location=no,scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + (screen.availHeight-40);
	won=window.open( href,'newwin',strTemp);
	won.focus();
}
function OpenLeftTopWindow2(href,width){
	var won;

	var left =0;
	var top =0;
	var won;
	var strTemp ="location=no,scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + (screen.availHeight-40);
	won=window.open( href,'newwin2',strTemp);
	won.focus();
}
function OpenOtherTopWindow(href,left){
	var won2;
	var top =0;
	left += 10;
	var width =screen.availWidth - left;
	var strTemp ="location=no,scrollbars=yes,resizable=yes,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + (screen.availHeight-40);
	won2=window.open( href,'newwin2',strTemp);
	won2.focus();
}
function WinClose(){
	window.opener = '';
	window.close();
}
function AddCart(href){
	var won;
	var width=150;
	var height=40;
	var left =(screen.availWidth - width)/2;
	var top =(screen.availHeight - height)/2;
	var won;
	var strTemp ="location=no,scrollbars=no,resizable=no,menubar=no,status=no,toolbar=no,titlebar=no";
	strTemp += ',top=' + top ;
	strTemp += ',left=' + left;
	strTemp += ',width=' + width;
	strTemp += ',height=' + height;
	won=window.open( href,'addcart',strTemp);
	won.focus();

}
function OpenFtp(href,username,password)
{
	window.open("ftp://" + username + ":" + password + "@" + href,"ftp","");
}
function SetTitle(str)
{
	document.title=str;
}
function SetStatus(str)
{
	window.status=str;
}
function Resize(w,h)
{
	window.resizeTo(w,h);
}
function ResizeToCenter(w,h)
{
	window.resizeTo(w,h);
 	var x=(screen.availWidth-w)/2;
 	var y=(screen.availHeight-h)/2;
 	window.moveTo(x,y);
}
function ResizeToTopLeft(w,h)
{
	window.resizeTo(w,h);
 	window.moveTo(0,0);
}
function ResizeToFullScreen()
{
	var w=screen.availWidth;
	var h=screen.availHeight
	window.resizeTo(w,h);
 	var x=0;
 	var y=0;
 	window.moveTo(x,y);
}
function ResizeToHighFullScreen(w)
{
	var h=screen.availHeight
	window.resizeTo(w,h);
 	var x=(screen.availWidth-w)/2;
 	var y=0;
 	window.moveTo(x,y);
}
function AddBookMark(){
	window.external.AddFavorite("http://www.dot-net.com.tw","DotNetMaster");
}
function AddHome(){
	AddHomeLink.setHomePage("http://www.dot-net.com.tw");
}
function PrintThisPage(){
	window.print();  
}

//onkeydown
function StepNext(){
	if (event.keyCode == 13) event.keyCode=9;
} 


function PrintThisPage(){
	window.print();  
}
function IsDate(datevalue){
	var v=Date.parse(datevalue);
	var d=new Date(v);
	var d2=d.getFullYear() + '/' + (d.getMonth() + 1) + '/' +d.getDate();
	document.all('Text2').value=d2;
	if(datevalue==d2){
		return true;
	}else{
		return false;
	}
}
//onkeypress
function CheckEN(){
	c=event.keyCode;
	if((c>47 && c<58) || (c>64 && c<91) || (c>96 && c<123)) return true;
	return false;
}
function CheckEmail(){
	c=event.keyCode;
	//window.status=c;
	if((c>47 && c<58) || (c>64 && c<91) || (c>96 && c<123) || c==64 || c==46 ||c==45) return true;
	return false;
}
function CheckTel(){
	c=event.keyCode;
	if((c>47 && c<58) || c==45) return true;
	return false;
}
function CheckNum(c){

	if(c>47 && c<58)  return true;
	return false;
}

function CheckDec(c){
	if(c>47 && c<58)  return true;
	
	if(c==46)  return true;
	return false;
}
function CheckNegNum(c){

	if(c>47 && c<58)  return true;
	
	if(c==45)  return true;
	return false;
}

function CheckNegDec(c){

	if(c>47 && c<58)  return true;
	
	if(c==45)  return true;
	if(c==46)  return true;
	return false;
}
function SetFocus(objid)
{
	document.getElementById(objid).focus();
}

function ChangeImg(ctrl,src)
{
	ctrl.src=src;
}
function ShowProductPic(id,src)
{
//MProduct1_C07
	document.getElementById(id).src="images/product/p/" + src;
}
function ShowGalleryPic(id,src)
{
	document.getElementById(id).src=src;
}
function CartListRefresh(id){
	var obj =parent.document.getElementById(id);
	var d=new Date();
	obj.src="cartlist.aspx?g=" + d.getTime();
}
function ParentRefresh(){
	var lo =parent.document.location;
	parent.document.location.href=lo;
}


function ResizeParentIframe(id1,id2){
	var tb = document.getElementById(id1);
	if(tb==null){
		var obj =parent.document.getElementById(id2);
		obj.style.height=0;
	}else{
		var h = tb.scrollHeight ;
		var obj =parent.document.getElementById(id2);
		obj.style.height=h+20;
	}
}
function CheckNavigator(){
	var n = navigator.appName;
	var v = navigator.appVersion;
	if(n.indexOf('Microsoft')>-1){
		//alert('IE');
		//alert('本站的最佳瀏覽器版本為：\nMicrosoft Internet Explor 6.0 SP1或更新版本.');
	}else{
		alert('本站的最佳瀏覽器版本為：\nMicrosoft Internet Explor 6.0 SP1或更新版本.\n請更換您的瀏覽器.');
	}
}
function SwitchMenu(obj){
    if(document.getElementById){
    var el = document.getElementById(obj);
    var ar = document.getElementById("masterdiv").getElementsByTagName("span");
    	if(el.style.display != "block"){
    		for (var i=0; i<ar.length; i++){
    			if (ar[i].className=="options")
    			ar[i].style.display = "none";
    		}
    		el.style.display = "block";
    	}else{
    		el.style.display = "none";
    	}
    }
}
function CloseAllMenu(obj){
    if(document.getElementById){
    var ar = document.getElementById("masterdiv").getElementsByTagName("span");
    		for (var i=0; i<ar.length; i++){
    			if (ar[i].className=="options")
    			ar[i].style.display = "none";
    		}
    }
}
function SwitchDiv(id){
	var obj =document.getElementById(id);
	if(obj.style.display=="block"){
		obj.style.display="none";
	}else{
		obj.style.display="block";	
	}

}
function SwitchDiv2(id,width,height){
	var obj =document.getElementById(id);
	if(obj.style.display=="block"){
		obj.style.display="none";
	}else{
		obj.style.display="block";	
		
		var left =(screen.availWidth - width)/2;
		//var top =(screen.availHeight - height)/2;
		var top=50;
		obj.style.top=top;
		obj.style.left=left;
		
		
		/*
		
		mx = event.clientX;
   		my = event.clientY;

		obj.style.top=my;
		obj.style.left=mx;
		
		*/
	
	}
	

}
/*
0:48
9:57
A:65
Z:90
a:97
z:122
*/