﻿function selectall(obj){ 
	obj.select(); 
} 
function toggletab(set,id){
	var tabs = document.getElementById(set).getElementsByTagName("div");
	for (var t=0;t<tabs.length;t++){
		if(tabs[t].className == "tab"){
			tabs[t].style.display = "none";
			if(tabs[t].id == "tab" + id){
				tabs[t].style.display = "block";
			}
		}
	}	
	var layers = document.getElementById(set).getElementsByTagName("li");
	for (var t=0;t<layers.length;t++){
		layers[t].className = "";
		if(layers[t].id == "li" + id){
			layers[t].className = "on";
		}
	}

}
function popuphis(mylink, windowname,width,height)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=520,height=150,scrollbars=no,resizable=no');
return false;
}
function popupthis(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=520,height=600,scrollbars=yes,resizable=yes');
return false;
}
function popupcert(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=490,height=520,scrollbars=yes,resizable=yes');
return false;
}
function popupthis1(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=520,height=200,scrollbars=yes,resizable=yes');
return false;
}

function popupthis_other(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=950,height=600,scrollbars=yes,resizable=yes');
return false;
}

function popupthis_other1(mylink, windowname)
{
if (! window.focus)return true;
var href;
if (typeof(mylink) == 'string')
   href=mylink;
else
   href=mylink.href;
window.open(href, windowname, 'width=950,height=670,scrollbars=yes,resizable=yes');
return false;
}

function view(script, width, height) {
	var scr = window
			.open(
					script,
					"wnd",
					"channelmode=no,directories=no,fullscreen=no,width="
							+ width
							+ ",height="
							+ height
							+ ",location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=yes,toolbar=0");
}
function cfmform(lang) {
	if(lang == 'zh-CN'){
		return confirm("你确定吗?");
	}
	else{
		return confirm("Are you sure?");
	}
}
var marked_row = new Array;
function setPointer(theRow, theRowNum, theAction, theDefaultColor,
		thePointerColor, theMarkColor) {
	/*var theCells = null;
	if ((thePointerColor == '' && theMarkColor == '')
			|| typeof (theRow.style) == 'undefined') {
		return false;
	}
	if (typeof (document.getElementsByTagName) != 'undefined') {
		theCells = theRow.getElementsByTagName('td');
	} else if (typeof (theRow.cells) != 'undefined') {
		theCells = theRow.cells;
	} else {
		return false;
	}
	var rowCellsCnt = theCells.length;
	var domDetect = null;
	var currentColor = null;
	var newColor = null;
	if (typeof (window.opera) == 'undefined'
			&& typeof (theCells[0].getAttribute) != 'undefined') {
		currentColor = theCells[0].getAttribute('bgcolor');
		domDetect = true;
	} else {
		currentColor = theCells[0].style.backgroundColor;
		domDetect = false;
	}
	if (currentColor == ''
			|| currentColor.toLowerCase() == theDefaultColor.toLowerCase()) {
		if (theAction == 'over' && thePointerColor != '') {
			newColor = thePointerColor;
		} else if (theAction == 'click' && theMarkColor != '') {
			newColor = theMarkColor;
			marked_row[theRowNum] = true;
		}
	} else if (currentColor.toLowerCase() == thePointerColor.toLowerCase()
			&& (typeof (marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum])) {
		if (theAction == 'out') {
			newColor = theDefaultColor;
		} else if (theAction == 'click' && theMarkColor != '') {
			newColor = theMarkColor;
			marked_row[theRowNum] = true;
		}
	} else if (currentColor.toLowerCase() == theMarkColor.toLowerCase()) {
		if (theAction == 'click') {
			newColor = (thePointerColor != '') ? thePointerColor
					: theDefaultColor;
			marked_row[theRowNum] = (typeof (marked_row[theRowNum]) == 'undefined' || !marked_row[theRowNum]) ? true
					: null;
		}
	}
	if (newColor) {
		var c = null;
		if (domDetect) {
			for (c = 0; c < rowCellsCnt; c++) {
				theCells[c].setAttribute('bgcolor', newColor, 0);
			}
		} else {
			for (c = 0; c < rowCellsCnt; c++) {
				theCells[c].style.backgroundColor = newColor;
			}
		}
	}
	return true;*/
}

<!--
function s(){window.status="<?=prntext($data['SiteTitle'])?>";return true};if(document.layers)document.captureEvents(Event.MOUSEOVER|Event.MOUSEOUT|Event.CLICK|Event.DBLCLICK);document.onmouseover=s;document.onmouseout=s;
function changelanguage()
{
	//alert(document.form2.continent.options[document.form2.continent.selectedIndex].value)
	window.location='<?=$PHP_SELF ?>.do?lang=' + document.form2.language.options[document.form2.language.selectedIndex].value;
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
//-->
function formcheck() 
{
	
	var errStr = "";
	
	if(document.getElementById("comments").value == ""){
		errStr = "Comments is empty" + '\n';
	}
	
		
	if (errStr != "")
	{	
		alert("The Form contains some errors" + ':' + '\n' + errStr);
	}
	else{
		document.getElementById('form1').submit();
	}
}
function numbersonly(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1))
   return true;

// decimal point jump
else if (dec && (keychar == "."))
   {
   myfield.form.elements[dec].focus();
   return false;
   }
else
   return false;
}
function numberspoint(myfield, e, dec)
{
var key;
var keychar;

if (window.event)
   key = window.event.keyCode;
else if (e)
   key = e.which;
else
   return true;
keychar = String.fromCharCode(key);

// control keys
if ((key==null) || (key==0) || (key==8) || 
    (key==9) || (key==13) || (key==27) )
   return true;

// numbers
else if ((("0123456789").indexOf(keychar) > -1) || (keychar == ".")){
   return true;
}
else
   return false;
}
