function ecatalog(docu, kd, dir){
	if(screen.width < 800){
		alert("The screen resolution should be over 800*600");
		return;
	}

	if(kd == "fixed"){ x = 1024; y = 768; wname = "fixed_ecatalog"; }
	else if(screen.width > 1600 || screen.height > 1200){ x = 1600; y = 1200; wname = "ecatalog"; }
	else{ x = screen.width; y = screen.height; wname = "ecatalog"; }

	x = x - 10;
	y = y - 58;

	property = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,copyhistory=no,";
	property += "width=" + x + ",height=" + y + ",left=" + 0 + ",top=" + 0;
	docu = docu + "/ecatalog.asp?Dir=" + dir;

	ecawin = window.open(docu, wname, property);
}

function newWindow(winSet,docu,width,height,left,top,winname){
	if(winSet == 1)
	    property = "toolbar=yes,location=no,directories=no,status=yes,menubar=no,resizable=no,scrollbars=yes,copyhistory=no,";
	else if(winSet == 2)
		property = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,copyhistory=no,";
	else if(winSet == 3)
		property = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,copyhistory=no,";

	property += "width=" + width +",height=" + height + ",left=" + left + ",top=" + top;
	window.open(docu,winname,property);
}

function TrmObj(Object,message){
	if(Object.value == "" || trimVal(Object.value) == ""){
		if(message != "") alert(message);
		Object.focus();
		return false;
	}
	else
		return true;
}
function trimVal(Tempo){
	Tstring = "";

	for(var i = 0;i < Tempo.length;i++){
		Temp = Tempo.substring(i,i+1);
		if(Temp != ' ' && Temp != '\n' && Temp != '\r')
			Tstring += Temp;
	}

	return Tstring;
}

function isNotnum(string){
	for(var i = 0;i < string.length;i++){
		Jstr = string.charAt(i);
		if(Jstr < "0" || Jstr > "9") return false;
	}
	return true;
}

function SeColor(tr,n){
	tr.style.backgroundColor = n;
}

function showeMenu(n){
	DivArray = new Array("","tgeneral","tskin","tlink","tfile","tmail");
	
	for(var i = 1;i < DivArray.length;i++){
		if(i == n) document.all[DivArray[i]].style.visibility = "visible";
		else document.all[DivArray[i]].style.visibility = "hidden";
	}
}
function swap_image(obj, fname, kd){
   	obj.src = (kd == 0) ? "pix/menu" + fname + "-s.gif" : "pix/menu" + fname + ".gif";
}

function cswap(num, kd){
	if(kd == 0) document.all['trx'+num].style.backgroundColor = "D2F5FF";
	else document.all['trx'+num].style.backgroundColor = "FFFFFF";
}

function newLink(winSet, width, height, docu){
	if(winSet == 1) property = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=no,copyhistory=no,";
	else property = "toolbar=no,location=no,directories=no,status=no,menubar=no,resizable=no,scrollbars=yes,copyhistory=no,";

	property += "width=" + width +", height=" + height + ", left=1, top=1";
	window.open(docu, 'ln', property);
}

function cataview(w, h, dir, param, server){
	fsrc = server + "main.swf?Dir=" + dir + "&w=" + w + "&h=" + h;
	divflash.innerHTML = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"1600\"><tr><td nowrap>" + cataHtml(fsrc, param) + "</td></tr></table>";
}

function cataviewFireFox(w, h, dir, param, server){
	fsrc = server + "main.swf?Dir=" + dir + "&w=" + w + "&h=" + h;
	divflash.innerHTML = "<table border=\"0\" cellpadding=\"0\" cellspacing=\"0\" width=\"1600\"><tr><td nowrap>" + cataHtmlFireFox(fsrc, param) + "</td></tr></table>";
}

function flashview(w, h, fname, param){
	document.writeln("<embed src=\"" + fname + "\" flashVars=\"" + param + "\" quality=high pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"" + w + "\" height=\"" + h + "\">");
}
function flashnwview(w, h, fname, param){
	param += param + "&w=" + w + "&h=" + h;
	divflash.innerHTML = "<embed id=\"confSwf\" src=\"" + fname + "\" flashVars=\"" + param + "\" quality=high pluginspage=\"http://www.macromedia.com/go/getflashplayer\" type=\"application/x-shockwave-flash\" width=\"1280\" height=\"1024\">\n";
}

function obFlashWrite(w, h, dir, param, server){
	fsrc = server + "main.swf?Dir=" + dir + "&w=" + w + "&h=" + h;
	document.write(cataHtml(fsrc, param));
}

function cataHtml(fsrc, param){
	str = "<object id=\"cataSwf\" classid=\"clsid:d27cdb6e-ae6d-11cf-96b8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0\" width=\"1600\" height=\"1200\" align=\"middle\">\n";
	str += "<param name=\"allowScriptAccess\" value=\"sameDomain\">\n";
	str += "<param name=\"movie\" value=\"" + fsrc + "\">\n";
	str += "<param name=\"quality\" value=\"high\">\n";
	str += "<param name=\"bgcolor\" value=\"#ffffff\">\n";
	str += "<param name=\"flashVars\" value=\"" + param + "\">\n";
	str += "<embed name=\"cataSwf\" src=\"" + fsrc + "\" flashVars=\"" + param + "\" quality=\"high\" bgcolor=\"#ffffff\" width=\"1600\" height=\"1200\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">\n";
	str += "</object>\n";
	return str;
}

function cataHtmlFireFox(fsrc, param){
	return "<embed id=\"cataSwf\" src=\"" + fsrc + "\" flashVars=\"" + param + "\" quality=\"high\" bgcolor=\"#ffffff\" width=\"1600\" height=\"1200\" allowScriptAccess=\"sameDomain\" type=\"application/x-shockwave-flash\" pluginspage=\"http://www.macromedia.com/go/getflashplayer\">\n";
}

function checkText(obj){
	obj.checked = (obj.checked == true) ? false : true;
}
