//Config ---

var sFilePath="";
var sPicturePath="http://www.u8u.com/imgu8"
var ProgramPath="http://s.u8u.com/";
var SendUrl="http://www.u8u.com/mSend/2/";
var SearchUrl="http://www.u8u.com/MediaSearch/sList.aspx";
var burl="http://send.u8u.com/web/List_u.aspx";
var SearchPage = "http://so.u8u.com/S.aspx";

function gt(a){return document.getElementById(a)}
//----------

var p=new function(){
	this.q=function(r,df){
		var url="&"+((location.toString().toLowerCase().indexOf("?")<0)?"":location.toString().toLowerCase().split("?")[1]);
		var re=(url.indexOf("&"+r.toLowerCase()+"=")<0)?"":url.split("&"+r.toLowerCase()+"=")[1].split("&")[0];
		return (re=="")?((df==null)?"":df):re;
	}
	this.j=function(){
		var str="";
		for(var i=0;i<arguments.length;i++)
			str += "&" + arguments[i] + "=" + this.q(arguments[i]);
		return str;
	}
	this.ls=function(){
		for(pi=0;pi<arguments.length;pi++)document.write('<'+'script language=javascript src="'+arguments[pi]+'"><'+'/script>');
	}
	this.args=this.j("a","b","c","e") + "&d=119";
	this.gt=new function(a){return document.getElementById(a)}
	
}

function getsendURL(fi,t){
	var add ="";
	switch(((t==null)?"":t).toLowerCase()){
		case "hx":add="4";break;
		case "tx":add="3";break;
		case "ct":add="2";break;
		case "dh":add="1";break;
	}
	switch(fi.toString().length){
		case 1:fi=add+"000"+fi;break;
		case 2:fi=add+"00"+fi;break;
		case 3:fi=add+"0"+fi;break;
		case 4:fi=add+fi;break;
	}
	var site = "";
	if(location.href.toLowerCase().indexOf("zt/")>-1) site="&page=zt";
	return(SendUrl + "?f=" + fi + p.args + site );
}

function send3(fi,t){
	var width=screen.width,height=screen.height;
	window.open(getsendURL(fi,t),'',"toolbar=1,menubar=1,location=1,status=1,resizable=1, top=0,left=0,width="+ width +",height="+ height);
}

function send(fi,t){
	var width=418,height=330;
	var left = (screen.width-width)/2;
	var top  = (screen.height-height)/2;	
	window.open(getsendURL(fi,t),'',"top="+ top +",left="+left+",toolbar=1,status=1,location=1,resizable=1,width="+ width +",height="+ height);
}

function send1(c){
	var width=500,height=300;
	var left = (screen.width-width)/2;
	var top  = (screen.height-height)/2;	
	window.open("http://u.7887.com/mSend/1/show.htm?filename=" + c.innerText.replace(" ","") + p.args,'',"top="+ top +",left="+left+",toolbar=0,status=1,resizable=0,width="+ width +",height="+ height);
}

function sendMusic(fn, mb){
	var width=418,height=330;
	var left = (screen.width-width)/2;
	var top  = (screen.height-height)/2;
	
	var url = SendUrl + "?fn=" + fn + "&m=" + mb + p.args;
	
	window.open(url,'',"top="+ top +",left="+left+",toolbar=1,status=1,location=1,resizable=1,width="+ width +",height="+ height);
}


function t(typeid,type,target){	
	var url;
	if(type!=1)
	{
		url = "http://so.u8u.com/ShowCategory.aspx?catcode="
	}
	else
	{
		url = "http://so.u8u.com/ShowTpCategory.aspx?catcode="
	}	
	url += typeid + p.args;
	window.open(url);
}

function lh(url,type){
	if(type==0) location.href=url+ "?" + p.args.replace(/^&/,"");
	if(type==1) a = window.open(url+ "?" + p.args.replace(/^&/,""));
	if(type==2) var a = window.open(url,"lele","");
	a.focus();
}

function a(key){	
	url = SearchPage + "?KeyWords=" + key + p.args;
	var a = window.open(url,"lele","");
	a.focus();
}

var a2 = a;
var a3 = a;

function l(url,a){
	if(a!=null&&a==1) url=url+"?"+p.args;
	if(a!=null&&a==2) url="zt.htm?ref=goto&goto="+escape(url+"?") +  p.args;
	window.open(url);
}

var des="ÇëÊäÈë¸èÊÖ»ò¸èÃû";
function cf(e){if(e.value==des){e.value="";e.select();}}
function cl(e){if(e.value.replace(/ /g,"").replace(/ /g,"")==''){e.value=des;}}

function p_s(e){
	if(e.nodeName.toLowerCase()=="input") e=e.parentNode.previousSibling.firstChild;
	if(e.value==des||e.value.replace(/ /g,"")==''){
		e.select();
		return false;
	}
	else
		if(location.href.toString().indexOf("/zt/6")>0)a3(e.value);else a(e.value);
}

function p_s2(e){
	if(typeof(e.value)=="undefined") e=e.parentElement.previousSibling.firstChild;
	if(e.value==des||e.value.replace(/ /g,"")==''){
		e.select();
		return false;
	}
	else
		a2(e.value);
}

function subArray(array,start,count){
	
	if(typeof(count)=="undefined")count=array.length;
	if(start+count>=array.length)count=array.length-start;
	var ar = new Array(count);
	for(var i=start;i<start+count;i++) ar[i-start]=array[i];
	return ar; 
}

function ArrayClone(array){
	var ar = new Array(array.length);
	for(var i=0;i<ar.length;i++){
		if(typeof(array[i][0])=="undefined")
			ar[i]=array[i];
		else
			ar[i]=ArrayClone(array[i]);
	}
	return ar;
}

function ArrayJoin(){
	var length = 0, clen = 0;	
	for(var c=0;c<arguments.length;c++){
		length+=arguments[c].length;
	}		
	var ar = new Array(length);	
	for(var c=0;c<arguments.length;c++){
		for(var i=0;i<arguments[c].length;i++){
			ar[clen+i]=arguments[c][i];
		}
		clen += arguments[c].length;
	}	
	return ar;
}
