﻿var CompanyName = "成都龙飞科技有限公司";
var ProductName = "";
if (document.title.length > 0) document.title = "【" + document.title + "】";
document.title = CompanyName + ProductName + document.title;
function GotoUrl(url, frame)
{
	if (url.indexOf("___TimeStamp") > 0){
		var itimer = url.indexOf("___TimeStamp") - 1;
		var ntimer = url.length;
		
		for(i = itimer + 12; i < ntimer; i++){
			if (url.substring(i, i+1) == "&"){
				ntimer = i;
				i = url.length;
			}
		}
		
		url = url.replace(url.substring(itimer, ntimer), "");
	}

    var post = url.indexOf("?") == -1 ? "?" : "&";
    url = url + post + "___TimeStamp="+ Math.random();
    
	if (frame != null)
		frame.location.href = url;
	else
		window.location.href = url;
}

function winopen(sUrl,sName,swidth,sheight){
	var H=(screen.height-sheight)/2-31;
	var W=(screen.width-swidth)/2-12;
	window.open (sUrl,sName,"directories=no,height="+sheight+",width="+swidth+",top="+H+",left="+W+",location=no,menubar=no,resizable=no,scrollbars=yes,status=no,titlebar=no,toolbar=no");
}

function MaxWindow(url,wname){
	var joint,h,w;
	var str = new String(url);
	joint = str.indexOf('?') == -1 ? '?' : '&';
	h=screen.height - 16;
	w=screen.width - 10;
 	url = url + joint + '___TimeStamp='+Math.random();
	window.open(url,wname,"directories=no,height="+h+",width="+w+",top=0,left=0,location=yes,menubar=yes,resizable=yes,scrollbars=yes,status=yes,titlebar=yes,toolbar=yes");
}

function OpenDialog(url,swidth,sheight)
{
	var str = new String(url);
	var join = str.indexOf('?') == -1 ? '?' : '&';
	url = url + join + '___TimeStamp='+Math.random();
	var arr = showModalDialog(url, "dialog", "dialogWidth:"+swidth+"px; dialogHeight:"+sheight+"px; edge: raised; center: yes; help: no; resizable: no; status: no; scroll:on;");
	return arr;
}

function MaxDialog(url)
{
	var str = new String(url);
	var join = str.indexOf('?') == -1 ? '?' : '&';
	var	h=screen.height - 100;
	var w=650;
	url = url + join + '___TimeStamp='+Math.random();
	var arr = showModalDialog(url, "dialog", "dialogWidth:"+w+"px; dialogHeight:"+h+"px; edge: raised; center: yes; help: no; resizable: no; status: no; scroll:yes;");
	return arr;
}

function FilterEnterKey(){
	if (event.keyCode == 13){
		event.keyCode = 9 ;
		return false ;
	}
	else{
		return true ;
	}
}

function EraseSpace(str){
	if (str.length > 0){
		var s = str.substring(0,1);
		while (s == " "){
			str = str.substring(1);
			s = str.substring(0,1);
		}
		s = str.substring(str.length - 1);
		while (s == " "){
			str = str.substring(0, str.length - 1);
			s = str.substring(str.length - 1);
		}
	}
	return str;
}

function UpLoadFile(strpath){
	var arr = showModalDialog(UrlRoot + "/editor/upframe.asp?imgpath="+strpath, "", "dialogWidth:550px; dialogHeight:400px; status:0");
	if (arr != null) 
		return arr;
	else
		return "";
}
