var thismanagerstate;
var managererror=0
var ishavedemo=true;
var pid;
var thistype="";
 
//鍙橀噺
var hostname = location.hostname;	//鑾峰彇褰撳墠鍩熷悕
var localurl = location.href;		//鑾峰彇褰撳墠鐨剈rl鍦板潃淇℃伅
 
function settype(str)
{
	thistype=str;
}
function killErrors() 
{
	//return true;
}
//window.onerror = killErrors;
	
////////////////////////////////////////////////// 鍒濆鍖栭〉?
function  load()
{
    
    var pre=getCookie("c2");
    if (pre == "")
    {
        pre="s8";
    }
    
    //tabc('s2');
 
}

function initalert()
{
	isshow1=true;
	alert('&nbsp;&nbsp;Well Come !');
}

//////////////////////////////////////////////// 锟借褰曟瘡娆″鐞嗙殑鏃?
var ms = 0;
var state = 0;


var time0;
time0=10;
 


function getCookie(name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while(i < clen)
    {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
        {
            return getCookieVal(j);
        }
        i = document.cookie.indexOf(" ", i) + 1;
        if(i == 0) break;
    }
    return;
}
// store cookie value with optional details as needed
function setCookie(name, value, expires)
{
    //锟借幏鍙栧綋鍓嶆椂闂?
    var date=new Date();
    var expireDays=30;
    //灏哾ate璁剧疆?0锟藉ぉ浠ュ悗鐨勬椂闂?
    date.setTime(date.getTime()+expireDays*24*3600*1000);
    //灏唘serId鍜寀serName涓や釜cookie璁剧疆?0锟藉ぉ鍚庤繃鏈?

    document.cookie = name + "=" + escape(value) + "; expires=" + date.toGMTString()  + ";"; 
}
function getCookieVal(offset)
{
    var endstr = document.cookie.indexOf(";", offset);
    if(endstr == -1)
    {
        endstr = document.cookie.length;
    }
    return unescape(document.cookie.substring(offset, endstr));
}

function startstop() 
{
try
{
	if (state == 0) 
	{
		state = 1;
		ms = 0;
		then = new Date();
		then.setTime(then.getTime() - ms);
		 //jishi.innerHTML = gett(ms);
	} 
	else 
	{
		state = 0;
		now = new Date();
		ms = now.getTime() - then.getTime();
		$("jishi").innerHTML = gett(ms);
		//$("divalert").filters[0].Opacity=0;
		disshowalert("鎴愬姛!")
	}
	
		}
 catch(err)
 {}
}
var isshow=false;
var isshow1=false;
function alert2(str)
{
	alert(str)
}
function alert (str){ 
if (typeof(divalert) == "object")
{
    document.getElementById("divalert1").innerHTML=str;
    return;
}

try{
$("divalert").outerHTML="";
$("divalert1").outerHTML="";
$("bgDiv").outerHTML="";
}catch(err){}

var msgw,msgh,bordercolor,titlecolor,lefttitle; 
msgw=260;//鎻愮ず绐楀彛鐨勫?
msgh=120;//锟芥彁绀虹獥鍙ｇ殑楂?
titleheight=25 //锟芥彁绀虹獥鍙ｆ爣棰橀珮搴?
bordercolor="#619DD2";//鎻愮ず绐楀彛鐨勮竟妗嗛?
titlecolor="#99CCFF";//锟芥彁绀虹獥鍙ｇ殑鏍囬棰?
titlecolor_top="#001ea0";//锟芥彁绀虹獥鍙ｇ殑鏍囬棰?
lefttitle="WebPicTool" 
var sWidth,sHeight; 
sWidth=document.body.clientWidth; 
sHeight=document.body.clientHeight; 
var bgObj=document.createElement("div"); 
bgObj.setAttribute('id','bgDiv'); 
bgObj.style.position="absolute"; 
bgObj.style.top="0"; 
bgObj.style.background="EDEDE9";//transparent"; 
bgObj.style.filter="progid:DXImageTransform.Microsoft.Alpha(style=3,opacity=25,finishOpacity=75"; 
bgObj.style.opacity="0.6"; 
bgObj.style.left="0"; 
bgObj.style.width=sWidth + "px"; 
bgObj.style.height=sHeight + "px"; 
bgObj.style.zIndex = "10000"; 
bgObj.style.display = "none"; 
document.body.appendChild(bgObj); 

var msgObj=document.createElement("div") 
msgObj.setAttribute("id","divalert"); 
msgObj.setAttribute("align","center"); 
msgObj.style.background="#ece9d8"; 
msgObj.style.border="3px solid " + bordercolor; 
msgObj.style.position = "absolute"; 
msgObj.style.left = "50%"; 
msgObj.style.top = "50%"; 
msgObj.style.font="12px/1.6em Verdana, Geneva, Arial, Helvetica, sans-serif"; 
msgObj.style.marginLeft = "-130px" ; 
msgObj.style.marginTop = -60+document.documentElement.scrollTop+"px"; 
msgObj.style.width = msgw + "px"; 
msgObj.style.height =msgh + "px"; 
msgObj.style.textAlign = "center"; 
msgObj.style.lineHeight ="25px"; 
msgObj.style.zIndex = "10001"; 

var title=document.createElement("h4"); 
title.setAttribute("id","msgTitle"); 
title.setAttribute("align","center"); 
title.style.margin="0"; 
title.style.padding="3px"; 
title.style.background=bordercolor; 
//title.style.filter="progid:DXImageTransform.Microsoft.Alpha(startX=20, startY=20, finishX=100, finishY=100,style=1,opacity=75,finishOpacity=100);"; 
title.style.opacity="0.75"; 
title.style.border="1px solid " + bordercolor; 
title.style.height="18px"; 
title.style.font="12px Verdana, Geneva, Arial, Helvetica, sans-serif"; 
title.style.color="white"; 
title.style.cursor="pointer"; 
title.innerHTML="<b>"+lefttitle+"</b>"+"&nbsp;&nbsp;&nbsp;&nbsp;<span style='background:#e8795f;color=#fff; border:#fff solid 1px;margin 2px 2px' title='cancel'><b>脳</b></span>"; 
title.onclick=function()
	{ 
	  document.body.removeChild(bgObj); 
	  document.getElementById("divalert").removeChild(title); 
	  document.body.removeChild(msgObj); 
	} 
document.body.appendChild(msgObj); 
document.getElementById("divalert").appendChild(title); 
var txt1=document.createElement("div"); 
txt1.style.margin="1em 0" 
txt1.setAttribute("id","divalert1"); 
if ( str.indexOf("button")<1 )
{
	str = str + "<input type=button class=btn2 onclick=document.body.removeChild($('bgDiv'));document.body.removeChild($('divalert')); value='&nbsp;&nbsp;O&nbsp;K&nbsp;&nbsp;>"
 }
 try{txt1.innerHTML=str; 

var ccc=document.getElementById("divalert")
ccc.appendChild(txt1); 
 
}catch(err){}
 
$("divalert1").innerHTML=str;
	} 
	
function showmessage(str)
{
 /*try
 {*/
 alert(str);
 return;
	$("divalert").style.display="";
	$("divalert").style.left = screen.width/2 -100
	$("divalert").style.top  = 200
	$("divalert1").innerHTML=str;
     isshow=true;
     $('divalert').filters[0].Opacity=100;
	//showalert($('divalert').filters[0].Opacity);
/* }
 catch(err)
 {
	window.status="error"
 }*/
	//setTimeout("disshowalert(100)",3000);
}
function test()
{
	var imgpath=document.all("getfile").value;
	if (imgpath != "" )
	{
		isupload();
	}
		
}
function test1()
{
	getfile_onclick()
}
function alert1(str)
{
	
	showmessage(str);
	
	//setTimeout("isshow=false;disshowalert($('divalert').filters[0].Opacity)",10000);
}

 

function showalert(str)
{
    alert(str)
    return
	if (!isshow)
	{
		$('divalert').filters[0].Opacity=0;
		return
	}
	str=parseInt(str)+10;
	 
	if (str>90 || 1==1)
	{
		$('divalert').filters[0].Opacity=100;
		return;
	}
	else
	{
		window.status=str;
		 
		$('divalert').filters[0].Opacity=str;
		var str1=str;
		//showalert(str1);
		setTimeout("showalert('" + str1 + "')",30)
	}
	
}

function disshowalert(str)
{
	isshow=false;
	//$("disalert1").innerHTML=str;
	//setTimeout("disalert()",1000)
	disalert()
 
}

function disalert()
{
    try{
	document.body.removeChild($('bgDiv'));
	document.body.removeChild($('divalert'));
	}catch(err){}
}

function gett(str)
{
	str=str/1000;
	if (str > 15)
	{
		//$("divalert").style.display="";
		//$("divalert").style.left = screen.width/2 -200
		//$("divalert").style.top  = 200
		//$("addnote").value= $("divalert").innerHTML
		//$("divalert1").innerHTML  = " 杩欐鐨勫鐞嗛€熷害宸茬粡瓒呰繃15绉掞紝閫夋嫨绛夊緟锛屾垨鑰呯偣鍙栨秷鍚庯紝鍐嶇偣涓€娆′綘闇€瑕佺殑澶勭悊鎸夐挳?br><font color=red><b>锟藉鏋滃浘鐗囧お澶э紝寤鸿浣跨敤鎺ㄨ崘鐨刧oogle鐨勬湰鍦颁綔鍥捐蒋?/b></font>,锟藉鐞嗛€熷害浼氭瘮鏈珯鏇村揩,鍔熻兘鏇村己? <br> <span id=jishi></span> <span class=btn2 onclick=cancel(); align=center  id=idcancle>锟藉彇娑堟搷浣?/span></font>&nbsp;"//<input type=button value=閲嶆柊鎻愪氦 onclick=javascript:remanager(); class=btn>"
	    // $("divalert1").innerHTML  = "<font color=red> is loading ,pleasa wait <marquee width=80>...<...<...<..<...</marquee></font><br> <br> <span id=jishi></span> <input type=button value=Try onclick=javascript:remanager(); class=btn></font>";
 
	}
	
	if (str>60)
	{
		 cancel();
		//showmessage("鏈嶅姟鍣ㄧ箒?锟借绋嶅悗鍐?\n锟藉鏋滃浘鐗囧お澶э紝寤鸿浣跨敤鎺ㄨ崘鐨刧oogle鐨勬湰鍦颁綔鍥捐蒋浠禱n澶勭悊閫熷害浼氭瘮鏈珯鏇村揩,鍔熻兘鏇村己?);
		 setTimeout("disshowalert('123')",300)
		
	}
	if (str<1)
		 str = "" + str; 
	//str=jsreplace(str,"."," 锟?");
	str="<font color=red>" + str + "</font>"  ;
	
	return str;
}

function cancel()
{
	
	startstop();
	unlock();
	state=0;
	ms = 0;
	//$("jishi").innerText = "";
	mini.location.href="_blank";
	try
	{
	document.body.removeChild($('bgDiv'));
	document.body.removeChild($('divalert'));
	}
	catch(err)
	{}
}

function swreset()
{
	state = 0;
	ms = 0;
	jishi.innerText = ms;
}

function display() 
{
    setTimeout("display();", 500);
	if (state == 1)  
	{
		now = new Date();
		ms = now.getTime() - then.getTime();
		try{
		$("jishi").innerHTML = gett(ms); }
		catch(err){}
	} 
}
 
 
 function openpic1(strname,intid,strdesc)
 {	
 	stra="http://" + hostname + "/managerpic.asp?pname="
	stra=stra + strname + "&state=1&" + getfreecode1(3)
	straa="<font color=red>Load Image ,Wait<marquee width=80>...<...<...<..<...</marquee></font>"
	$("imgMain").innerHTML=straa
	mini.location.href=stra
	//$("divcommend").style.display="none";
	//$("tblcommend").style.display="none";
	//$("divDemopic").style.display="none";
	$("divNoteList").innerHTML=strdesc + getXMLData("noteslist.asp?div=divNoteList&id=800000" + intid,"");
	 settab("s2");
	 tabc($("s2"));
}

/////////////////////////////////////////////////////
///////////////////////////////////////////////////// 锟借缃綋鍓嶅浘鍍忓搴﹂珮搴?
function setwhvalue(obj)
{
	managererror=0
	setTimeout('setwhvalue1()',20);
} 
function copyurl()
{
	//var textRange=txtUrl/ateTextRange();
//	/textRange.execCommand("Copy");
	var clipBoardContent='';//鍒濆娓呯┖
	
	clipBoardContent = $("txtUrl").value;//鎹㈣锛屽啓鍏RL
	
	copyToClipboard(clipBoardContent);
	//window.clipboardData.setData("Text",clipBoardContent);//鍐欏叆ClipBoard
	alert("Copy OK,You Can Sent it To Your Friend with icq , msn !")
}
function copyurl1()
{
	//var textRange=txtUrl/ateTextRange();
//	/textRange.execCommand("Copy");
	var clipBoardContent='';//鍒濆娓呯┖
	 
	 
	clipBoardContent = $("divtuiguang").innerText;//鎹㈣锛屽啓鍏RL
	window.clipboardData.setData("Text",clipBoardContent);//鍐欏叆ClipBoard
	//alert("鎴愬姛澶嶅埗鏍囬鍙婇摼?锟界幇鍦ㄥ彲浠ョ矘璐村埌UC/MSN鍙戠粰濂藉弸?");//锟藉脊鍑烘彁绀猴紝濡備笉闇€瑕佸彲鍒犻櫎鎴栧睆钄芥?
	alert("Copy OK,You Can Sent it To Your Friend with icq , msn !")
}

function copyToClipboard(txt) {     

     if(window.clipboardData) {        
             window.clipboardData.clearData();        
             window.clipboardData.setData("Text", txt);        
     } else if(navigator.userAgent.indexOf("Opera") != -1) {        
          window.location = txt;        
     } else  {        
          try {        
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");        
          } catch (e) {        
               //alert("琚祻瑙堝櫒鎷掔粷锛乗n璇峰湪娴忚鍣ㄥ湴鍧€鏍忚緭鍏?about:config'骞跺洖杞n鐒跺悗灏?signed.applets.codebase_principal_support'璁剧疆涓?true'");        
          }        
          var clip = Components.classes['@mozilla.org/widget/clipboard;1'].createInstance(Components.interfaces.nsIClipboard);        
          if (!clip)        
               return;        
          var trans = Components.classes['@mozilla.org/widget/transferable;1'].createInstance(Components.interfaces.nsITransferable);        
          if (!trans)        
               return;        
          trans.addDataFlavor('text/unicode');        
          var str = new Object();        
          var len = new Object();        
          var str = Components.classes["@mozilla.org/supports-string;1"].createInstance(Components.interfaces.nsISupportsString);        
          var copytext = txt;        
          str.data = copytext;        
          trans.setTransferData("text/unicode",str,copytext.length*2);        
          var clipid = Components.interfaces.nsIClipboard;        
          if (!clip)        
               return false;        
          clip.setData(trans,null,clipid.kGlobalClipboard);        
          //alert("澶嶅埗鎴愬姛锛?)        
     }        
}      


function CopyOLEObj1()
{
 
	var div = document.getElementById('imgthis');
	div.contentEditable = 'true';
	var controlRange;
	if (document.body.createControlRange) {
	controlRange = document.body.createControlRange();
	controlRange.addElement(div);
	controlRange.execCommand('Copy');
	}
	div.contentEditable = 'false';
 
}

function CopyOLEObj(obj,flag)
{
	//if (!obj.tagName || obj.tagName == '') return false;
	if (typeof obj.contentEditable == 'undefined') return false;
	if (!document.body.createControlRange) return false;
	
	obj.contentEditable = true;
	//alert(obj.outerHTML)
	setTimeout('copyole(obj)',1000);
}

function copyole(obj)
{
	var obj=document.getElementById('imgthis')
	var ctrl = document.body.createControlRange();
	ctrl.addElement(obj);
	ctrl.execCommand('Copy');
	obj.contentEditable = false;
	if(1)alert('Copy Success !');
}

function sendemail()
{
	showmessage( "<table width=100% height=60%><tr><Td>Email:</td><td><input type=text id=txtMailto name=txtMainto value='' style='width:150px;background:#e9e9ec' class='VIEW4'>	</td></tr><tr><Td align=center colspan=2>  <input type=button id=sendmail value=SendMail class=btn onclick='javascript:mailfile()' NAME='sendmail'></td></tr></table>");
}
 

function setwhvalue1()
{
	
	managererror=0;
	var obj=$("imgthis");
	intw=$("imgthis").clientWidth;
	obj.contentEditable=true;
	if (intw == 0 )
	{
		setTimeout('setwhvalue1()',500);
		return;
	}
  
	inth=$("imgthis").clientHeight;
	ints=Math.floor(obj.fileSize/1024);
	strA="W:<font color=red>" + intw + "</font> H:<font color=red>" + inth + "</font>   Size:<font id=imgsize color=red>" + ints + "K</font> ";
	
	strA=strA + "&nbsp;&nbsp;<input type=button class=btn  onclick='javascript:savefile()' value= Save />&nbsp;"
	//strA = strA + "&nbsp;<a id=sendmbl target=_blank  href='http://www.xuncai.com/toolbar/pic2_to/imagedown.asp?imageUrl=&publisher=KF2@nittystone_C'><font style='color:#888;cursor:hand;text-decoration: underline;background:#'>锟藉彂鍒版墜鏈?/font></a> "
	//strA = strA + "<input type=button onclick='javascript:sendemail();' class=btn value=Mail /> "
	//strA = strA + "<input type=button  id=copyqq onclick=CopyOLEObj(document.getElementById('imgthis'),1)  class=btn value='Copy Pic'/>&nbsp;"
	 //strA = strA + "<input type=button  class=btn onclick='javascript:copyurl();' value='Copy Link'/>&nbsp;"
	  if ( $("imgthis").src.indexOf("demo")>0 ||  $("imgthis").src.indexOf("sample")>0 )
	 {
	    
	 }
	 else
	 {
	    strA = strA + "&nbsp;<input type=button class=btn onclick='javascript:delpic();' value=Delete>"
	 }
	 
	 
	
	intb="100";
	
	//parent.$("bili").value=intb;
	 
	$("chklock").value=intw/inth;
	$("imgDetail").innerHTML=strA;
	$("txtWidth").value=intw;
	$("txtHeight").value=inth;
	
	$("txtWidthTrue").value=intw;
	$("txtHeightTrue").value=inth;
	
	if (thistype != "")
	{
	 	$("framesample").style.height=inth-20;
	}

	var obj1=$("imgthis");
	var mytop=obj1.offsetTop; 
	var myleft=obj1.offsetLeft;
	//渚濇璇诲彇鐖跺鍣ㄥ湪鏇撮珮涓€绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj1=obj1.offsetParent){
		myleft+=obj1.offsetLeft; 
		mytop+=obj1.offsetTop; 
	}
	unlock();
	state=1;
	startstop();
	disshowalert(3)
	var path= $("txtThis").value.replace(".jpg","");
	var arj;
	var fh="";
	if ( path.indexOf("demo") > 0 )
	{
	    arj=path.split('_');
	    fh="_";
	}
	else
	{
	    arj=path.split('-');
	    fh="-";
	}
	var path1=arj[0];
	var name1="";
	 
	if ( arj.length != 1 )
	{
	     
	    $("history1").innerHTML="<input type=image onclick=openpic('" + path1 + ".jpg') src=photo/" + path1 + ".jpg width=50>" 
	    for (i=1;i<arj.length;i++)
	    {
	       name1= name1+ fh + arj[i] 
	       var name2= path1+name1 + ".jpg"
	       name2="<input type=image onclick=openpic('" + name2 + "') src=photo/" + name2 + " width=50>"
	        $("history1").innerHTML=$("history1").innerHTML  + name2;
	    }
	    
	}
	else
	{
	// $("history1").innerHTML="<input type=image onclick=openpic('" + path1 + ".jpg') src=photo/" + path1 + ".jpg width=30>" 
	   
	}
	
     try
	{
			$("divText2").style.left=myleft+50;
			$("divText2").style.top=mytop+50;
		 	strimgurl="http://" + hostname + "/photo/" +  $("txtThis").value;
		  
		 	$("divshow").href="show.asp?img=" +  $("txtThis").value;
			 setTimeout('settuiguang()',3000); 
			 
	}
	catch(err){
		//alert("err");
	}
}
function settuiguang()
{
	try
	{
		var editurl="http://" + hostname + "/index.asp?img1=" + txtThis.value;
		parent.$("divtuiguang").innerHTML="<a href=" + editurl + "><font color=black>" + editurl + "</font></a>";
	}
	catch(err){}
}
function UrlEncode(str)
{
  var ret="";
  var strSpecial="!#$%&'()*+,/:;<=>?[]^`{|}~%";
  for(var i=0;i<str.length;i++){
   var chr = str.charAt(i);
    var c=str2asc(chr);
    tt += chr+":"+c+"n";
    if(parseInt("0x"+c) > 0x7f){
      ret+="%"+c.slice(0,2)+"%"+c.slice(-2);
    }else{
      if(chr==" ")
        ret+="+";
      else if(strSpecial.indexOf(chr)!=-1)
        ret+="%"+c.toString(16);
      else
        ret+=chr;
    }
  }
  return ret;
}

 /////////////////////////////////////////////////////  锟借绠楁帶浠朵綅缃?
function lock()
{
	//document.body.disabled=true;
	var arjobj=document.all.tags("input");
	for (var jsi=0;jsi<arjobj.length;jsi++)
	{
		arjobj[jsi].disabled=true;
	};
}
function unlock()
{
	try
	{
		document.body.disabled=false;
		//var arjobj=document.all.tags("input");
		//for (var jsi=0;jsi<arjobj.length;jsi++)
		//{
		//	 arjobj[jsi].disabled=false;
		//	
		//};
		$("s3").value="00";
		$("s2").value="00";
		$("s4").value="00";
		//mini.location.href="";
		//$("divalert").style.display="none";
		
		disshowalert("Success!");
		settips("");
	}
	catch(err){}
}
var mytop=0;
var myleft=0;

function setwh()
{
	var x,y;
	x=window.event.clientX;
	y=window.event.clientY;
 	var t,l;
	obj=imgthis;
	mytop=obj.offsetTop; 
	myleft=obj.offsetLeft;
	//渚濇璇诲彇鐖跺鍣ㄥ湪鏇撮珮涓€绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent)
	{
		myleft+=obj.offsetLeft; 
		mytop+=obj.offsetTop; 
	}
	    t=mytop;    l=myleft;


	txtwd.value=x-l+document.body.scrollLeft;//锟芥樉绀洪紶鏍囩殑x鍧愭爣
	txthd.value=y-t+document.body.scrollTop;//鏄剧ず榧犳爣鐨剏鍧愭爣 
}
function md()
{

	if ($("isselect").value=="1")
	{
	$("isselect").value="0";
	return;
	}

	$("isselect").value="1";

	var x,y;
	x=window.event.clientX;
	y=window.event.clientY;
	divSelect.style.left=x+1+document.body.scrollLeft;
	divSelect.style.top=y+1+document.body.scrollTop;
	divSelect.style.width=4;
	divSelect.style.height=4;
 }

function mo()
{

	if (isselect.value=="1") 
	{
	try{
		var x,y;
		x=window.event.clientX+document.body.scrollLeft;
		y=window.event.clientY+document.body.scrollTop;
		window.status=divSelect.style.left;
		divSelect.style.width=x-jsreplace(divSelect.style.left,"px","")-3;
		divSelect.style.height=y-jsreplace(divSelect.style.top,"px","")-3;
	}
	catch(err){}
	}
}
function cut()
{
	if (divSelect.style.display!="none")
	{
		manager(51);
 		return;
	};

}

function getLeft()
{
	obj=$("imgthis");
	 
	var mytop=obj.offsetTop; 
	var myleft=obj.offsetLeft;
	//渚濇璇诲彇鐖跺鍣ㄥ湪鏇撮珮涓€绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent){
		myleft+=obj.offsetLeft; 
//		mytop+=obj.offsetTop; 
	}
	return myleft;
}

function getLeft1()
{
	obj=bili;
	var mytop=obj.offsetTop; 
	var myleft=obj.offsetLeft;
	//锟戒緷娆¤鍙栫埗瀹瑰櫒鍦ㄦ洿楂樹竴绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent){
		myleft+=obj.offsetLeft; 
//		mytop+=obj.offsetTop; 
	}
	return myleft;
}


function getTop1()
{
	obj=bili;
	var mytop=obj.offsetTop; 
	var myleft=obj.offsetLeft;
	//锟戒緷娆¤鍙栫埗瀹瑰櫒鍦ㄦ洿楂樹竴绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent){
		myleft+=obj.offsetLeft; 
 		mytop+=obj.offsetTop; 
	}
	return mytop;
}

function getTop()
{
	obj=$("imgthis");
	var mytop=obj.offsetTop; 
	var myleft=obj.offsetLeft;
	//锟戒緷娆¤鍙栫埗瀹瑰櫒鍦ㄦ洿楂樹竴绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent){
		myleft+=obj.offsetLeft; 
 		mytop+=obj.offsetTop; 
	}
	return mytop;
}

function getobjTop(str)
{
	obj=$(str);
	var mytop=obj.offsetTop; 
	var myleft=obj.offsetLeft;
	//锟戒緷娆¤鍙栫埗瀹瑰櫒鍦ㄦ洿楂樹竴绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent){
		myleft+=obj.offsetLeft; 
 		mytop+=obj.offsetTop; 
	}
	return mytop;
}

function getobjLeft(str)
{
	obj=$(str);
	var mytop=obj.offsetTop; 
	var myleft=obj.offsetLeft;
	//锟戒緷娆¤鍙栫埗瀹瑰櫒鍦ㄦ洿楂樹竴绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent){
		myleft+=obj.offsetLeft; 
//		mytop+=obj.offsetTop; 
	}
	return myleft;
}

/////////////////////////////////////////////////////
///////////////////////////////////////////////////// 锟藉姩鎬佹樉绀烘枃?
function showtext()
{
	try
	{
    obj=imgthis;
	var mytop=obj.offsetTop; 
	var myleft=obj.offsetLeft;
	//锟戒緷娆¤鍙栫埗瀹瑰櫒鍦ㄦ洿楂樹竴绾х埗瀹瑰櫒涓殑鐩稿浣嶇疆?
	while(obj=obj.offsetParent){
		myleft+=obj.offsetLeft; 
		mytop+=obj.offsetTop; 
	}
	 
	var l=$("txtText").value.length;
		dd.elements.divText2.moveTo(getLeft()+$("imgthis").width/4,getTop()+$("imgthis").height/4)
	dd.elements.divText2.resizeTo($("imgthis").width/2,$("imgthis").height/2)
	
	 dd.elements.divText2.show();
    dd.elements.lefttop.show();
    dd.elements.righttop.show();
    dd.elements.rightbottom.show();
    dd.elements.leftbottom.show();
     
    w1=txtlen()  * txts.value * 2/3 
	//$("divText2").style.width=txtlen()  * txts.value * 2/3 ;
	h1=txts.value/1.3;
    //dd.elements.divText2.resizeTo(w1,h1)
    
	var txta="<div align=left";
	txtstyle="font-family:" + txttype.value + ";font-size:" + txts.value/1.5 + ";";
	txta = txta + " style='" + txtstyle + "'";
	txta = txta + ">";
	txta = txta + txtText.value + "</div> ";
    
      $("divText2").style.fontSize=txts.value/1.5;
	$("divText2").innerHTML=txta;
	
	setcolor(txtcolor.value,"divText2") 
	return;
	}
	catch(err)
	{}
}

function changesize(inta)
{
	$("txtWidth").value=inta;
	getheight(inta);
	manager(4);
}
 ///////////////////////////////////////////////////// 锟戒粯棰?

function showmcolor()
{
	var w=399;
	var h=399;
	var xxx;
	var l;
	l=(screen.width-w)/2;
	t=(screen.height-h)/2;
	xxx=showModalDialog("selectcolor.htm",obj,"status:no;dialogHeight: " + h + "px; dialogWidth: " + w + "px; status:no;scroll:no;dialogTop: " + t + "px; dialogLeft: " + l + "px'");
	arjx=xxx.split(',');
	txtcolor.style.backgroundColor="rgb(" + arjx[0] + "," + arjx[1] + "," + arjx[2] + ")";
	txtcolor.value=xxx;
	showtext();
}
function doSetColor(str)
{
   	//txtcolor.style.backgroundColor="rgb(" + arjx[0] + "," + arjx[1] + "," + arjx[2] + ")";
   	txtcolor.style.background=str;
   	txtcolor.style.color=str;
	txtcolor.value=str.replace("#","");
	showtext();

}
function parseColor(vValue) {
  var oColorParser = document.createElement("body");
  oColorParser.bgColor = vValue;
  return oColorParser.bgColor;
}
//todo
function setcolor(stra,ctrlid)
 {
	 var arjx=stra.split(',');
	 //alert("rgb(" + arjx[2] + "," + arjx[1] + "," + arjx[0] + ")")
	 //$(ctrlid).style.color="rgb(" + arjx[0] + "," + arjx[1] + "," + arjx[2] + ")";
	 
	 $(ctrlid).style.color=stra;
}
///////////////////////////////////////////////////// save file maile file
function savefile()
{
	
	var name;
 
	name=$("txtThis").value;
 
	url="http://" + hostname + "/manager_download.asp?pname=" + name + "&state=download";
	mini.location.href=url;
}

function delpic()
{
    var name=$("txtThis").value;
	
	 url="http://" + hostname + "/manager_delfile.asp?pname=" + name + "&state=100" ;
	mini.location.href=url;
}

function mailfile()
{   var name=$("txtThis").value;
	//if  (checkMail($("txtMainto").value) || 1==1 )
	//{
	//	alert("锟戒笉鏄竴涓爣鍑嗙殑email鍦板潃");
	//	return;
	//}
 
	$("divalert").style.display="";
	url="http://" + hostname + "/manager_sendmail.asp?pname=" + name + "&state=100&mto=" + $("txtMailto").value;
	mini.location.href=url;
}
function CheckPage(url)
{
	var h = new ActiveXObject("Microsoft.XMLHTTP")
	h.open("HEAD",url,false)
	h.send()
	alert()
	return h.responseText;
}

/////////////////////////////////////////////////////
///////////////////////////////////////////////////// manager
function demoload(str)
{
	 $("imgthis").src=str;
	 
	$("txtUrl").value = str
	$("txtThis").value  = jsreplace(str,"http://" + hostname + "/photo/","") ;
	parent.$("history").innerHTML = "<input type=button class=btn onclick=openpic('demo/demo3.jpg') value=First > "
}
function remanager()
{
	cancel();
	setTimeout("manager(thismanagerstate)",1000)
}
function manager(stra)
{
	thismanagerstate = stra ;
	var name1;
	//alert($("txtThis").value)
	name1=$("txtThis").value; 
	
	//var arj = name1.split('/')
	//name1 = arj[arj.length-1]
	 
	if (  name1.indexOf("demo")> -1  && ishavedemo == true  && stra != "52" && stra != "t1" && stra != 26 && stra != "51" && stra != "80" && stra != "4" && stra != "1"  && stra != "9" ) 
	{
	     
		var name2= jsreplace( name1 , ".jpg" , "_" + stra +  ".jpg")
		var path2="http://" + hostname + "/photo/catch/" + jsreplace(name2,"demo/","") 
		path2=jsreplace(path2,"catch/catch/","catch/")
		/*if (getXMLData(path2+ "?asdf")!="404")
		{
			$("imgthis").src=path2;
			$("txtUrl").value = path2
			$("txtThis").value  = "catch/" + jsreplace(name2,"demo/","")
			return;
		}*/
		if ( stra != 26 )
		{
			//$("imgtest").src=path2;
			//return;
		}
		//$("txtThis").value  = "catch/" + jsreplace(name2,"demo/","")
		
	}
	ishavedemo = true ;
	var compress=0;
	var txtelse="";
	//if ($("zip").checked)
	//{
		compress=1;
	//}
 
	 
	 alert2("<font color=red> psing ,wait<marquee width=80>...<...<...<..<...</marquee></font>  <span id=jishi></span> <input type=button class=btn2 onclick=cancel(); align=center  id=idcancle value=cancel></font>&nbsp;");
 
	if (stra=="4")
	{
		viewbili(100);
		if (v("txtWidth")>1324 ||
			v("txtHeight")>1324)
		{
			alert("Sorry Max is 1024");
			return;
		}
		txtelse="width=" + v("txtWidth");
		txtelse=txtelse + "&height=" + v("txtHeight")  ;
	}
	else
	{
	 
		if ($("txtWidth").value>1024 ||
			$("txtHeight").value>1024)
		{
			alert("Sorry Max is 1024");
			return;
		}
		
	}
 
	//'锟芥坊鍔犳枃瀛?
	if (stra=="t1")
	{
		 x=dd.elements.divText2.x
        y=dd.elements.divText2.y
  
        var wd=x-getLeft()+document.body.scrollLeft;//鏄剧ず榧犳爣鐨剎鍧愭爣
        var hd=y-getTop()+document.body.scrollTop;//鏄剧ず榧犳爣鐨剏鍧愭爣 
        if (wd<0)
          wd=0;
        if (hd<0)
          hd=0;
	    $("txtwd").value=wd;
	    $("txthd").value=hd;
	
		stra="26" + "&inputtext=" + jsreplace(txtText.value,"&","");
		stra=stra + "&fontcolor=" + txtcolor.value + "&";
		stra=stra + "fontsize=" + txts.value ;
		
		stra=stra + "&fonttm=" + txtm.value ;
		stra=stra + "&fontx=" + v("txtwd");
		stra=stra + "&fonty=" + v("txthd");
		
		stra=stra + "&fontt=" +  $("txttype").options[$("txttype").selectedIndex].text;
		//txtText.value=""
		//showtext()
	}
 
	//
	if (stra=="51")
	{
		sl=jsreplace(divSelect.style.left,"px","")-getLeft();
		st=jsreplace(divSelect.style.top,"px","")-getTop();
		 
		sw=divSelect.style.width;
		sh=divSelect.style.height;
		 
		//sl=sl * cint(100 /v("bili"));
		//st=st * cint(100 /bili.value);
		sw=jsreplace(sw,"px","");
		sh=jsreplace(sh,"px","");

		//sw=sw * cint(100 /bili.value) ;
		//sh=sh * cint(100 /bili.value);

		stra ="51" + "&left=" + sl;
		stra=stra  + "&top=" + st;
		stra=stra  + "&width=" + sw;
		stra=stra  + "&height=" + sh;
		if (v("txtWidth") != v("txtWidthTrue"))
		{
		    stra=stra + "&size=true&truewidth=" + v("txtWidth") + "&trueheight=" + v("txtHeight") 
		   // alert("淇敼浜嗗搴?)
		}
	}
	
	if (stra=="80")
	{
 
	   
		sl=jsreplace($("Pic2").style.left,"px","")-getLeft();
		
		st=jsreplace($("Pic2").style.top,"px","")-getTop();
		 
		 
		sw=$("Pic2").style.width;
		sh=$("Pic2").style.height;
		 
		//sl=sl * cint(100 /bili.value) ;
		//st=st * cint(100 /bili.value);
		sw=jsreplace(sw,"px","");
		sh=jsreplace(sh,"px","");
 
		//sw=sw * cint(100 /bili.value) ;
		//sh=sh * cint(100 /bili.value);
        
		stra ="80" + "&left=" + sl;
		stra=stra  + "&top=" + st;
		stra=stra  + "&width=" + sw;
		stra=stra  + "&height=" + sh;
		stra=stra  + "&path2=" + txtimgthis2.value;
	}
	if (stra=="9")
	{
	 	stra ="9" + "&chunse=" + v("chunse");
	}
	if (stra == "52")
	{
		if ($("framename").innerText=="")
		{
		     return;
		}
 
		stra = "52" + "&framename=" + $("framename").innerHTML;
	}
  
	var scale=getvalue("scalejpeg","95");
 	var vqianming=getvalue("qianming","");
  
 	if ( thismanagerstate=="51" || thismanagerstate=="80" || 1==1)
 	{
 	 
 		url="http://" + hostname + "/managerpic.asp?qianming=" + vqianming + "   &pname=" + name1 + "&state=" + stra + "&compress=" + compress + "&scalejpeg=" + scale + "&" + txtelse + "&" + "&" + getfreecode1(3);
 		  
 	}
 	else
 	{
 		url="http://" + hostname + "/mic.asp?qianming=" + vqianming + "   &pname=" + name1 + "&state=" + stra + "&compress=" + compress + "&scalejpeg=" + scale + "&" + txtelse + "&" + "&" + getfreecode1(3);
 	}
	
	 
    if (stra=="38")
	{	
		frmaddtext.action =url;
		frmaddtext.submit ();
		return;
    }
    //disp()
    display();
    startstop();
  
    if (cint(stra)>100 && cint(stra) <131)
    {
		//settab("s2");
	    //tabc($("s2"));
    }
    
 
	mini.location.href=url;
	//divNoteList.innerHTML="";
	//lock();
	//idcancle.disabled=false
}

function getvalue(str,str1)
{
	try
	{
		return $("str").value;
	}
	catch(err)
	{
		return str1;
	}
}
var thisframe=1;
var thisframename="";
function setframe(stra,strname)
{
	$("tips").innerHTML="<img src=frame/thumbnail/" + strname + ">";
	$("framename").innerHTML=strname;
	thisframe=stra;
	 
	manager(52);
}

 
function txtlen()
{
	
	var i=0;
	var j=0;
	var t;
	t=v("txtText");
	
	for (i=0;i<=t.length;i++)
	{
		z=t.substr(i,i+1);
		j=j+1;
		if ( z.charCodeAt(1)<0 )
		{
			j=j+1;
		}
		
	}
	return j;
}

 

function  viewbili(inta)
{
	var strww=parseInt((v("txtWidth") * inta)/100) + "px";
	var strhh=parseInt((v("txtHeight") * inta)/100) + "px";

	//$("imgthis").style.width=strww;
	//$("imgthis").style.height=strhh;
}



function getfile_onclick()
{
//alert(document.all.getfile.innertext)
}

 

function getheight(strA)
{
	if ( strA !="")
	{
		 
		$("txtWidth").value=strA;//
	}
	
	if ($("chklock").checked)
	{
		$("txtHeight").value=parseInt(v("txtWidth")/v("chklock"));
	}
}

function getheight1(strA)
{
	if ( strA !="")
	{
		$("txtHeight").value=strA;//left(strA,len(strA)-1)
	}
	if ($("chklock").checked)
	{
		$("txtWidth").value=cint(v("txtHeight")  * v("chklock"));
	}
	 
}
function setUpload(obj,str)
{
if (obj.value != "")
{
	$(str).src=obj.value
	$(str).style.display="";
	//window.status = "璇风偣<涓婁紶鎵€閫夊浘?锟芥寜閽笂浼犳鍥?
	//pid=getXMLData("js/getuploadid.asp");
	//alert(pid)
	//upload.action="managerpic.asp?state=99&pid=" + pid
	//upload2.action="managerpic.asp?state=199&pid=" + pid
}
}



function openpic(strname)
 {
	//showmessage("锟芥鍦ㄨ浇鍏ュ綋鍓嶅浘鐗?..") 	
	alert("loading...")
	var path2="/photo/" + strname
	path2=jsreplace(path2,"//","/")
	path2=jsreplace(path2,strname + "/" + strname,strname +"/")
	$("imgthis").src=path2;
	$("txtUrl").value = path2
	$("txtThis").value  = strname
 
	imgMain.style.display="";
	//ss12.style.display="none";
	//settab("s2");
	//tabc($("s2"));
}
/////////////////////////////////////////////////////
///////////////////////////////////////////////////// setTab
function settab(stra)
{
	 if ($("txttabc").value != "")
    {
        $($("txttabc").value).className="now";    
    }
    $("txttabc").value=stra;
    document.all(stra).className="oth";
}

function tabc(obj)
{
try{
    setCookie("c2",obj.id,"30");
	if (obj.id=="s11")
	{
		showPic2();
	}

	 if(obj.id=="s5") 
	{
		
	     dd.elements.divText2.hide();
	    
		showSelect();
	}
	else
	{ 	
	 
		dd.elements.divSelect.hide();
	} 
	
	if(obj.id=="s4") 
	{
	    
		dd.elements.divSelect.hide();
		showtext();
	}
    else
	{
	    dd.elements.divText2.hide();
	}
	 
	
	
	if (obj.id!="s5" && obj.id!="s4")
	{
	    dd.elements.lefttop.hide();
        dd.elements.righttop.hide();
        dd.elements.rightbottom.hide();
        dd.elements.leftbottom.hide();
	}
	settab(obj.id);
	//obj.style.border-bottom="1px";
	$("imgMain").style.display="";
	obj.style.border.top=0;	
	 
	for (i=1;i<12;i++)
    {
	     $("divss" + i).style.display="none";
	    // alert(i)
		// $("ss" + i).style.display="none";
	}
	  
	  
	//  jsmsgbox("err")
	//alert($("divs" + obj.id) )
	 if ($("divs" + obj.id).innerHTML == "")
	 {
	 	 var ul=jsreplace(obj.id,"s","catch/edit_") + ".htm?s8d2ddd18";// + getfreecode1(3)
		 
	 	 setdivdata($("divs" + obj.id),ul,"")
	 }
	
    // $("divs" + obj.id).style.display="";
    try
    {
    // $("s" + obj.id).style.display="";
     $("divs" + obj.id).style.display="";
   }
   catch(err)
   {
	alert("err")
   }

	 $("Pic2").style.display="none";
	
			
	if (obj.id=="s11")
	{
		showPic2();
	}
     
	
	  if (obj.id=="s12")
	{
		$("imgMain").style.display="none";
		//ss88.style.display="";
	}
	else
	{
		$("imgMain").style.display="";
		//ss88.style.display="none";
	}
	
	}catch(err)
   {
	//alert("err")
   }
  
}

function showframe()
{
	$("divframe").style.display="";
}
function showPic2()
{
		$("divText2").style.display="none";
		$("Pic2").style.left=getLeft()+250;
		$("Pic2").style.top=getTop()+50;
		$("Pic2").style.display="";
		init_crop1();
}
function setlogo(str,obj)
{
    $("Pic2").style.display="";
	$("txtimgthis2").value=str;
	$("Pic2").style.width=obj.width*2;
	$("Pic2").style.height=obj.height*2;
	$("imgthis2").style.width=obj.width*2;
	$("imgthis2").style.height=obj.height*2;
	$("imgthis2").src="logo/" + str;
}
function showSelect()
{
	dd.elements.divSelect.show();
	dd.elements.divSelect.moveTo(getLeft()+$("imgthis").width/4,getTop()+$("imgthis").height/4)
	dd.elements.divSelect.resizeTo($("imgthis").width/2,$("imgthis").height/2)
    dd.elements.lefttop.show();
    dd.elements.righttop.show();
    dd.elements.rightbottom.show();
    dd.elements.leftbottom.show();
	my_DropFunc()
	dd.elements.divSelect.show();
}

 var titlePopup
   var len;
   
   function settips(stra)
   {
		
		stra="&nbsp;&nbsp;" + stra ;
		$("tipbody").innerHTML=stra;
   }
   
   function InitMsgBox1(stra)
	{ 
		$("idtips").style.display="";
		//setTimeout('tiprdisp("' + stra + '")',20);
		//tipdisp();
		settips(stra);
   }
   
   function InitMsgBox(stra)
   { 
		 settips(stra);
   }
   
  
   

 
function getfreecode1(i) { 
return "123";
	/* 
	getfreecode1.today=new Date(); 
    getfreecode1.seed=getfreecode1.today.getTime(); 
	getfreecode1.seed = (getfreecode1.seed*9301+49297) % 233280; 
锟姐€€return (getfreecode1.seed/(233280.0)).toString().substr(2,i-2);
*/
 }; 
 
 //妫€楠孍MAIL鏄惁鍚堟硶
function checkMail(s)
{
   if (s!="")
	{
		return true;
	}
	else
	{
		return false;
	}
}
 
function checkCvrUpForm(str) 
{
	 
	 var uf = $(str);
	  
		var p = uf.value.toLowerCase();
		if ( p == "" || 
			!(p.indexOf(".jpg") > 0 || p.indexOf(".gif") > 0 || p.indexOf(".bmp") > 0 || p.indexOf(".jpeg") > 0) ) 
		{
			alert("only support JPG/GIF/BMP");
			//upload.getfile.value="";
			//upload.getfile.focus();
			return false;
		}
		return true;
}
 
function alert33(str)
{
	InitMsgBox(str);
}

function getParam(pname)
{
	var url=localurl;
	var inta=url.indexOf("?");
	url=url.substr(inta+1,url.length-inta);
	var arj=url.split('&');
	for (i=0;i<arj.length;i++)
	{
		var arj1=arj[i].split('=');
		if (arj1[0]==pname)
		{
			return arj1[1];
		}
	}
} 



