function revin(){
	window.event.srcElement.style.filter = 'alpha(opacity=50)';
	}
function revout(){
	window.event.srcElement.style.filter = 'alpha(opacity=100)';
	}
function makesure(form,text){
   var wantDelete = confirm(text);
   if (wantDelete ) form.submit ();
}
function switch_layer(id,text,butt) {
	if(document.getElementById(id).style.zIndex ==0) {
		document.getElementById(id).style.zIndex =1;
		document.getElementById(text).style.zIndex =0;
		document.getElementById(butt).innerHTML="view code";
		}
	else {
		document.getElementById(id).style.zIndex =0;
		document.getElementById(text).style.zIndex =1;
		document.getElementById(butt).innerHTML="Preview";
		}
}
function popupBox(id,str){
	if(str) {
		document.getElementById(id).className ="popupBox";
		document.getElementById(id).innerHTML = str;
		}
	else {
		document.getElementById(id).className ="popupBoxClose";
		document.getElementById(id).innerHTML = "";
		}
	}
function td_down(id){
	document.getElementById(id).style.borderTopColor = "#000000";
	document.getElementById(id).style.borderBottomColor = "#000099";
	document.getElementById(id).style.borderLeftColor = "#000088";
	document.getElementById(id).style.borderRightColor = "#000011";
}
function td_up(id){
	document.getElementById(id).style.borderTopColor = "#000099";
	document.getElementById(id).style.borderBottomColor = "#000000";
	document.getElementById(id).style.borderLeftColor = "#000011";
	document.getElementById(id).style.borderRightColor = "#000088";
}
function visible_div(id){	document.getElementById(id).style.zIndex =1
	document.getElementById(id).style.visibility = "visible";
}
function hidden_div(id){	document.getElementById(id).style.zIndex =-10
	document.getElementById(id).style.visibility = "hidden";
}
function view_switch(id) {
var e = document.getElementById(id);
if(e.style.display == 'none')
	e.style.display = 'block';
else
	e.style.display = 'none';
}
function bookmark(bookmarkurl,bookmarktitle){
	if (document.all) window.external.AddFavorite(bookmarkurl,bookmarktitle);
}
function keywords_search(key){	search.q.value = key;
	search.submit();
	}
function print_div(id,css_file,js_file){
	var css = '<link rel="stylesheet" type="text/css" href="'+css_file+'" />';
	var js = '<'+'script type="text/javascript" src="'+js_file+'"></'+'script'+'>';
	var print_window = window.open('','_new','width=800,height=900,scrollbars=1,resizable=1');
	var print_html = document.getElementById(id).innerHTML;
	print_html = '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html><head>'+
		css+js+
		'</head><body><div>'+
		print_html+
		'</div><button id = "printButton" onclick="hidePrint('+
		"'printButton'"+
		');">Print</button></body></htm>';
	print_window.document.open();
	print_window.document.write(print_html);
	print_window.document.close();
	}
function PrintDiv(div_id)
    {
        var DocumentContainer = document.getElementById(div_id);
        var WindowObject = window.open('', "PrintDiv",
                              "width=740,height=600,top=200,left=250,toolbars=no,scrollbars=yes,status=no,resizable=no");
        WindowObject.document.writeln(DocumentContainer.innerHTML);
        WindowObject.document.close();
        WindowObject.focus();
        WindowObject.print();
        WindowObject.close();
    }
function hidePrint (id) {
	document.getElementById(id).style.display = 'none';
	window.print();
	setTimeout("view_switch('"+id+"')",3000);
}
function ajaxFunction(url,returnDiv,parameters)
  {
  var Http;
  try
    {    // Firefox, Opera 8.0+, Safari
    Http=new XMLHttpRequest();
    }
  catch (e)
    {    // Internet Explorer
    try
      {
      Http=new ActiveXObject("Msxml2.XMLHTTP");
      }
    catch (e)
      {
      try
        {
        Http=new ActiveXObject("Microsoft.XMLHTTP");
        }
      catch (e)
        {
        alert("Your browser does not support AJAX!");
        return false;
        }
       }
      }
    Http.onreadystatechange=function()
      {
      if(Http.readyState==4)
        {
        //document.myForm.time.value=xmlHttp.responseText;
        if(returnDiv) document.getElementById(returnDiv).innerHTML = Http.responseText;
        }
      }

      Http.open('POST', url, true);
      Http.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      Http.setRequestHeader("Content-length", parameters.length);
      Http.setRequestHeader("Connection", "close");
      Http.send(parameters);
    }
function SaveChange(id,table,field,value){
	var i;
	var parameters ="id="+ id +
					"&table=" + encodeURI( table )+
					"&field=" + encodeURI( field )+
					"&value=" + encodeURI( value );
 	var url = "admin_system/mySQL_ajax.php";
 	var returnDiv = "message";
  	ajaxFunction(url,returnDiv,parameters);
	}