// JavaScript Document
showtooltip = false;
mousex = 0;
mousey = 0;
checked = 0;
function getMouseXY(e){
	if(!e){
		e = window.event;
	}
	if(e){
		if(e.pageX || e.pageY){
			mousex = e.pageX;
			mousey = e.pageY;
		}else if(e.clientX || e.clientY){
			mousex = e.clientX + document.body.scrollLeft;
			mousey = e.clientY + document.body.scrollTop;
		}
	}
}
function falsefunc(){
	return false;
}
function showtip(thetext,e){
	showtooltip = true;
	document.onmouseover = falsefunc;
	document.onmousemove = updatetip;
	document.onmouseout = hidetip;
	getMouseXY(e);
	document.getElementById('tooltip').innerHTML = thetext;
	document.getElementById('tooltip').style.visibility = "visible";
	document.getElementById('tooltip').style.left = mousex + 15;
	document.getElementById('tooltip').style.top = mousey;
}
function hidetip(){
	showtooltip = false;
	document.onmousemove = null;
	document.onmouseout = null;
	document.getElementById('tooltip').style.visibility = "hidden";
}
function updatetip(e){
	if(showtooltip){
		getMouseXY(e);
		document.getElementById('tooltip').style.left = mousex + 15;
		document.getElementById('tooltip').style.top = mousey;
	}
	return false;
}
function checkbox(field){
	if(checked == 0){
		checked = 1;
		status = true;
	}else{
		checked = 0;
		status = false;
	}
	for($I = 0; $I < field.length; $I++){
		field[$I].checked = status;
	}
}
function Write1(){
	if((navigator.appName == "Netscape")){ // For Firefox
		document.getElementById("Write").innerHTML = '<img id="image" src="../images/icon/form_02.jpg" style="cursor:pointer; width:92px; height:128px; position:absolute; z-index:1; border:1px solid #cccccc;" /><input type="file" name="picture" id="picture" class="main file" style="cursor:pointer; direction:rtl; width:207px; height:130px;" onChange="CheckWrite1(this.value);" /><input type="hidden" name="action" value="Upload" />';
	}else{
		document.getElementById("Write").innerHTML = '<img id="image" src="../images/icon/form_02.jpg" style="cursor:pointer; width:92px; height:128px; position:absolute; z-index:1; border:1px solid #cccccc;" /><input type="file" name="picture" id="picture" class="main file" style="cursor:pointer; direction:rtl; width:0px; height:130px; margin-left:10px;" onChange="CheckWrite1(this.value);" /><input type="hidden" name="action" value="Upload" />';
	}
}
function Write2($rand, $file_name){
	document.getElementById("image").src = "../temp/" + $file_name;
		window.parent.document.getElementById("Picture_Code").value = $rand;
	window.parent.document.getElementById("Picture").value = $file_name;
}
function CheckWrite1(name){
	var $name = name.split(".");
	if($name[$name.length - 1] == "jpg" || $name[$name.length - 1] == "gif" || $name[$name.length - 1] == "jpeg" || $name[$name.length - 1] == "JPG" || $name[$name.length - 1] == "GIF" || $name[$name.length - 1] == "JPEG"){
		document.forms['form1'].submit();
	}else{
		alert("¡ÃØ³ÒãÊèÃÙ» .jpg ËÃ×Í .gif à·èÒ¹Ñé¹");	
	}
}
with(document){
	writeln('<style type="text/css">');
	writeln('#tooltip{ position:absolute; visibility:hidden; left:-1000px; top:-1000px; background:#ffffff; border:0px solid #cccccc; padding:0px; }');
	writeln('</style>');
}