function goto(anchorStr)
{
	window.location.hash=anchorStr;
}
function hiddenObj(obj)
{
	window.document.getElementById(obj).style.display = 'none';
}
var iTipTrue = 0;
function tipTrue()
{
	hiddenObj('tipDiv');
	hiddenObj('tipDivTryDownload');
	hiddenObj('divbackblack');
	if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');
}
function locationTo()
{
	window.location = 'mofundownload.php';
}
function tipDivCancel(objid)
{
	hiddenObj(objid);
	//hiddenObj('tipDiv');
	//hiddenObj('tipDivTryDownload');
	hiddenObj('divbackblack');
	if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');
		
	var s = document.getElementsByTagName("select");
   for( var i=0;i<s.length;i++){
    //s[i].style.display="";
    //s[i].style.width='auto';
   	//s[i].style.Height='auto'
   	s[i].style.visibility = '';
   }
}
function hiddenstriptransmitter()
{
	hiddenObj('hiddenStripTransmitter');
}
function alertOut(){
	
   document.getElementById("divlogin").innerHTML="";
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
			myWidth = document.documentElement.clientWidth;
			myHeight = document.documentElement.clientHeight;
	} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
			myWidth = document.body.clientWidth;
			myHeight = document.body.clientHeight;
	}
	
	h = window.document.body.scrollHeight;
	if(h<document.body.clientHeight){
    h=document.body.clientHeight ;
	}

  w = window.document.body.scrollWidth;
  
   var div_type = document.getElementById("alertshow");
   var div_hei = document.getElementById("divbackblack");

   if ( myWidth > 352 )
   div_type.style.left = (myWidth-352)/2 + "px";
   else div_type.style.left = 0 + "px";
   if ( myHeight > 178 )
   div_type.style.top = (myHeight-178)/2 + "px";
   else div_type.style.top = 0 + "px";
  
   var s = document.getElementsByTagName("select");
   for( var i=0;i<s.length;i++){
   	//s[i].style.display="none";
   	//s[i].style.width=0;
   	//s[i].style.height=0;
   	s[i].style.visibility = 'hidden';
   }
	div_hei.style.height=h+"px";
	div_hei.style.width=myWidth;
	div_hei.style.display = "block";
	div_type.style.display = "block";
	
	/*
  if ( document.getElementById("username").value != "") 
  	document.getElementById("password").focus();
  else document.getElementById("username").focus();*/

	document.getElementById("password").value="";
	if((document.getElementById("re").value + '')!="0") 
	{
		document.getElementById("username").focus();
		document.getElementById("username").value="";	
		document.getElementById("remember").checked=false;
	}
	else
	{
		document.getElementById("password").value="";
		document.getElementById("password").focus();
		document.getElementById("remember").checked=true;
	}
	
	
	
}

function cencelDiv(){   
    
    var alertshow = document.getElementById("alertshow");
    var divbackblack = document.getElementById("divbackblack");
    var s = document.getElementsByTagName("select");
   
    for( var i=0;i<s.length;i++){
    //s[i].style.display="";
    //s[i].style.width='auto';
   	//s[i].style.Height='auto';
   	s[i].style.visibility = '';
   }
   
   alertshow.style.display="none";
   divbackblack.style.display="none";
   
   if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');
}
   
function dologin() {
	if(document.getElementById("username").value==""||document.getElementById("password").value=="")
	{
		document.getElementById("divlogin").innerHTML="用户名或密码不能为空";
		document.getElementById("re").value="";
		if(document.getElementById("username").value=="")
		{
			document.getElementById("username").focus();
		}
		else
		{
			document.getElementById("password").focus();
		}
		return;
	}
	document.getElementById("re").value = document.getElementById("remember").checked;
	document.getElementById("username").value = document.getElementById("username").value.trim();
	$.post( "login.php",                
	{
		username: document.getElementById("username").value.trim(), password:document.getElementById("password").value, re:document.getElementById("re").value}, 
		function(data) {  
		if (data ==1){
			document.getElementById("login").action = "login.php?ReturnUrl=" + window.location.href;
			document.getElementById("login").submit();			
		}
		else
			document.getElementById("divlogin").innerHTML=data; 
			document.getElementById("password").value="";
			document.getElementById("password").focus();
		}   
	);  
			
}

function AdminRepl(CommentId) {
	
	 var AdminRepldiv = document.getElementById("AdminRepldiv"+CommentId);
	      AdminRepldiv.style.display = "";
}

function Repl(CommentId) {
	
	
	$.post( "Repl.php",                
	{id: CommentId, AdminReply:document.getElementById("AdminRepltxt"+CommentId).value}, 
	function(data) { 
			document.getElementById("AdminRepldiv"+CommentId).innerHTML=data; 
		}   
	);  
	

}

function vote() {	

	var d = document.getElementsByName("sugest"); 
	var v_sugest;
	for(var i = 0; i < d.length; i++)
	{ 
	  if(d[i].checked) 	v_sugest=d[i].value; 
	} 
	
	$.post( "vote.php",                
	{sugest:v_sugest,ready:document.getElementById("ready").value}, 
	function(data) { 
			document.getElementById("votediv").innerHTML=data; 
		}   
	);  
	

}
//recommendedwidgets.php
function hotborder(ID)
{

	document.getElementById('widget_1').style.display='none';
	document.getElementById('widget_2').style.display='none';
	document.getElementById('widget_3').style.display='none';
	document.getElementById('widget_4').style.display='none';	
	
	document.getElementById('widget_'+ID).style.display='block';

	document.getElementById('dot_1').className='dotnone';
	document.getElementById('dot_2').className='dotnone';
	document.getElementById('dot_3').className='dotnone';
	document.getElementById('dot_4').className='dotnone';
	
	document.getElementById('dot_'+ID).className='dotshow';
}

//downstep.php
var curstep = 0;
function steps()
{
	curstep++;
	var img1 = window.document.getElementById("step1");
	var img2 = window.document.getElementById("step2");
	var img3 = window.document.getElementById("step3");
	
	if( curstep == 1 )
	{
		img1.style.display = '';
		img2.style.display = 'none';
		img3.style.display = 'none';
	}
	if( curstep == 2 )
	{
		img1.style.display = 'none';
		img2.style.display = '';
		img3.style.display = 'none';
	}
	if( curstep == 3 )
	{
		img1.style.display = 'none';
		img2.style.display = 'none';
		img3.style.display = '';
		curstep = 0;
	}

	window.setTimeout("steps()", 1500);
}


// widget download script functions
function hiddenStripTransmitter()
{
	if( document.getElementById("hiddenStripTransmitter") != null)
		document.getElementById("hiddenStripTransmitter").style.display = '';
}

	function checkSI() {
		var isIE = (navigator.appVersion.indexOf("MSIE") >= 0);
		var has = true;
	
		if(isIE) {
			try{
				//embed = new ActiveXObject("SIHelper.HelperActiveX.1");
			} catch(e) {
				has = false;
			}
		} else {
			if(!navigator.plugins["SIHelper Plugin for Mozilla"]) {
				has = false;
			}
		}
		
		
		return has;
	}
	        
    // 试图标记用户要下载此组件
	function SignDownload(url, _wid, version, userid) {
				$.ajax({url:'signdownload.php',
					type:"get",
					data:"wid=" + _wid + "&uid=" + userid + "&version=" + version,
					async: false,
					error: function(xmlHttpRequest, error, errorThrown){
						dlg = new commonDialog("test", "系统提示", "写数据库失败！", "", "", "","" ,"none" ,"none");
					},
					success: function(msg){
						
					}
					
					});
					
	}
	
  // 试图标记用户要下载此组件
	function CheckLoginUser(uid) {
			  var result = $.ajax({                              
            url:'util.php?cmd=checkloginuser&uid='+uid,
            async: false
          });
          
          return result.responseText;
          /*
          if (result.responseText == 1)
          {
          	return true;
          }
          else 
          {
          	return false;
          }*/
	}
		
	function TryDownload(url, wid, version, userid,embed) {         
		var cs = embed.GetClientStatus();
		
		switch(cs) {
			case 0: //魔方正常运行中				
				break;
			case 1:	// 客户安装的魔方，但是没有运行				
				dlg = new commonDialog("test", "系统提示", "魔方尚未启动，是否让魔方下次启动时自动安装该组件？", "SignDownload(\'" + url + "\', \'" + wid + "\',\'" + version + "\',\'" + userid + "\')", "", "","","none","");
				
				/*if (confirm('魔方尚未启动，是否让魔方下次启动时自动安装该组件？') == true) {
					// 发送安装记录
					SignDownload(url, wid, version, userid);
				}*/
					
				return false;
			case 2: //客户没有安装魔方
				dlg = new commonDialog("test", "系统提示", "魔方尚未安装，是否让安装魔方后自动安装该组件？", "SignDownload(\'" + url + "\', \'" + wid + "\',\'" + version + "\',\'" + userid + "\')", "", "", "", "none", "");
				/*if (confirm('魔方尚未安装，是否让安装魔方后自动下载该组件？') == true) {
					// 发送安装记录
					SignDownload(url, wid, version, userid);
				}*/
			 
				return false;
		} 
		
		var e_uid = embed.GetUserID();		
		if (e_uid == "")
		{
			dlg = new commonDialog("test", "系统提示", "客户端未登录，是否让魔方网站当前登录用户下次登录魔方时自动安装该组件", "SignDownload(\'" + url + "\', \'" + wid + "\',\'" + version + "\',\'" + userid + "\')", "", "", "", "none", "");
			return false;
		}
		var checkresult = CheckLoginUser(e_uid);
		if (checkresult == 0)
		{
		//if (e_uid != userid) {
			dlg = new commonDialog("test", "系统提示", "登录用户与魔方用户不一致。是否让魔方网站当前登录用户下次登录魔方时自动安装该组件？", "SignDownload(\'" + url + "\', \'" + wid + "\',\'" + version + "\',\'" + userid + "\')", "", "", "", "none", "");
			/*
			if (confirm('登录用户与魔方用户不一致。确认是否让登陆用户安装该组件？'))
				SignDownload(url, wid, version, userid);
			*/
					
			return false;
		}
		else if (checkresult == 2)
		{
			alertOut();
			return false;
		}
		
		var res = embed.Download(url, wid, version, userid);
		switch(res) {
			case 0:
				// 开始安装
				//ShowProgressBar();// 显示进度条
				return true;
			case 1:
				// 该插件已经安装
				dlg = new commonDialog("test", "系统提示", "您已经安装了该组件", "", "embed.Execute(\'" + wid + "\', \'" + userid + "\');", "", "none","","none");
				//alert('此插件已经安装');
				
				break;
			case 2:
				// 魔方还未安装
				dlg = new commonDialog("test", "系统提示", "您还未安装魔方，请先安装魔方!", "", "", "", "", "none", "none");
				//alert('魔方还未安装，请先安装魔方!');
				break;		
		}
		return false;		
	}
		
	function OnCancel(embed, barId)
	{
        document.getElementById(barId).style.display='none';        
	    embed.Cancel();
	}
	
	function OnProgress(embed)
	{
	  var strText = embed.GetProgress();
	}
	
	function OnFinish(embed)
	{
	  var strText = embed.Finished;
	}
	
	function OnStatus(embed)
	{
	  var strText = embed.GetStatus();
	}
	
	function getTop(e){ 
		var offset=e.offsetTop; 
		if(e.offsetParent!=null) offset+=getTop(e.offsetParent); 
		return offset; 
	}
	function getLeft(e){ 
		var offset=e.offsetLeft; 
		if(e.offsetParent!=null) offset+=getLeft(e.offsetParent); 
		return offset; 
	}


function DoubleAnimation(target,targetProperty,from,to,Duration)
{
    this.Begin=function anonymous()
    {
        target[targetProperty]=from;
        var starttime=new Date();
        setTimeout(StoryBoard(),1);
        function StoryBoard()
        {
            return function()
            {                 
                var now=new Date();
                var d=now.getTime()-starttime.getTime();
                target[targetProperty]=Math.round(from+(to-from)*d/Duration);
                if(d<Duration)setTimeout(StoryBoard(),10);
            }
        }
    }
    this.setTo=function(val){to=val;}
    this.setFrom=function(val){from=val;}
} 

var _st = window.setTimeout; 
window.setTimeout = function(fRef, mDelay) { 
	if(typeof fRef == 'function'){ 
		var argu = Array.prototype.slice.call(arguments,2); 
		var f = (function(){ fRef.apply(null, argu); }); 
		return _st(f, mDelay); 
	} 
 	return _st(fRef,mDelay); 
} 



function ProcessMonitor( percent, ID, processBarObj, embed )
	{
		if (embed.GetStatus(processBarObj.wid)==10) {
			document.getElementById('btnCancel' + ID).style.display='none';
			document.getElementById('CG' + ID).style.display='';
			document.getElementById('Loading' + ID).style.display='none';
			document.getElementById('mofunclose' + ID).style.display='';
			document.getElementById('XZ' + ID).style.display='none';
			var e_uid = embed.GetUserID();				
			if (processBarObj.userid!='' && processBarObj.userid==e_uid) 	
				if (document.getElementById('mofunstart' + ID ) != null)	
					document.getElementById('mofunstart' + ID).style.display='';
			processBarObj.set(100);        
			SignDownload(processBarObj.url, processBarObj.wid, processBarObj.version, processBarObj.userid);
			//setTimeout('mofunclose()', 3000);
			if (document.getElementById('btnCancel' + ID ) != null)
				document.getElementById('btnCancel'+ ID).style.display='none';
			if (document.getElementById('mofunclose' + ID ) != null)
				document.getElementById('mofunclose'+ ID).style.display='';
			if (document.getElementById('mofunstart' + ID ) != null)
				document.getElementById('mofunstart'+ ID).style.display='';
				
			return;
    	}

		if (embed.GetStatus(processBarObj.wid)==9) {
			processBarObj.set(0);        
			SignDownload(processBarObj.url, processBarObj.wid, processBarObj.version, processBarObj.userid);
			document.getElementById('btnCancel' + ID).style.display='none';
			document.getElementById('CG' + ID).style.display='none';
			document.getElementById('Loading' + ID).style.display='none';
			document.getElementById('XZ' + ID).style.display='';
			document.getElementById('mofunclose' + ID).style.display='';
			document.getElementById('mofunstart'+ ID).style.display='none';
			return;
		}
		percent =embed.GetProgress(processBarObj.wid);
		processBarObj.set(percent, ID);
	
		
		if(percent<100)
		{
			window.setTimeout(ProcessMonitor, 100, percent, ID, processBarObj, embed);
			if (document.getElementById('divSetup' + ID ) != null)
				document.getElementById('divSetup' + ID ).style.display='';
			if (document.getElementById('btnCancel' + ID ) != null)
				document.getElementById('btnCancel' + ID).style.display='';
			if (document.getElementById('mofunclose' + ID ) != null)
				document.getElementById('mofunclose' + ID).style.display='none';
			if (document.getElementById('mofunstart' + ID ) != null)
				document.getElementById('mofunstart' + ID).style.display='none';
		}
		else
		{
			percent=0;   
			if (document.getElementById('btnCancel' + ID ) != null)
				document.getElementById('btnCancel'+ ID).style.display='none';
			if (document.getElementById('mofunclose' + ID ) != null)
				document.getElementById('mofunclose'+ ID).style.display='';
			if (document.getElementById('mofunstart' + ID ) != null)
				document.getElementById('mofunstart'+ ID).style.display='';				
		}
	}


function loadingF(url, wid, version, userid, embed)
{
	if (userid=='') {
        alertOut();
        return;
  }
  if (TryDownload(url, wid, version, userid, embed) ) {
  	document.getElementById("zjMKDown" + wid).style.display = 'none';
		document.getElementById("zjMKProcessBar" + wid).style.display = '';
		pb1 = null;
		pb1=new ProgressBar(wid, url, wid, version, userid, embed);
		ProcessMonitor( 0, wid, pb1, embed);	
  }	
}

function ProgressBar(ID,url, wid, version, userid, embed)
{ 
this.url = url;
this.wid = wid;
this.version = version;
this.userid = userid;
document.getElementById("zjMKProcessBar" + ID).innerHTML =  
    "<div style=\"margin-left:5px;\" id=\"Loading"+ ID +"\">组件安装中，请稍候......</div>"
    +"<div style=\"margin-left:5px;\" id=\"CG"+ ID +"\" style='display:none'>安装组件成功</div>"
    +"<div style=\"margin-left:5px;\" id=\"XZ"+ ID +"\" style='display:none'>下载失败</div>"
    +"<div id=\"divSetup" + ID + "\" style=\"width:330px;height:23px;margin-top:0px; margin-left:3px;\">"
    +"	<div id=\""+ID+"\" style=\"width:330;\"><image src=\"./images/emptypb.jpg\" style=\"width:323px\" /></div>"
    +"	<div id=\""+ID+"pb\" style=\" margin-top:-20px;overflow:hidden;width:330px;\" ><img src=\"./images/icon_fullpb.jpg\"/></div>"
    +"	<div id=\""+ID+"highlight\" style=\"margin-top:-20px;width:327;height:20;filter:Alpha(Opacity=75,FinishOpacity=0,Style=2)\"></div>"
    +"</div>"
    +"<div style='margin-left:330px;margin-top:-25px;z-index:999999;'>"
    +"	<input type=\"submit\" name=\"btnCancel\" id=\"btnCancel" + ID + "\" value=\"取消\"  class=\"btn3_mouseout\" onmouseover=\"this.className='btn3_mouseover'\" onmouseout=\"this.className='btn3_mouseout'\" onmousedown=\"this.className='btn3_mousedown'\"onmouseup=\"this.className='btn3_mouseup'\" onClick=\"mofunCancel('" + ID + "', '" + wid + "', embed)\" />&nbsp;"
    +"	<input type=\"submit\" name=\"mofunclose\" id=\"mofunclose" + ID + "\" value=\"关闭\"  class=\"btn3_mouseout\" onmouseover=\"this.className='btn3_mouseover'\" onmouseout=\"this.className='btn3_mouseout'\" onmousedown=\"this.className='btn3_mousedown'\"onmouseup=\"this.className='btn3_mouseup'\" OnClick=\"mofunclose('" + ID + "')\" />&nbsp;"
    +"	<input type=\"submit\" name=\"mofunstart\" id=\"mofunstart" + ID + "\" value=\"使用本组件\"  class=\"btn3_mouseout\" onmouseover=\"this.className='btn3_mouseover'\" onmouseout=\"this.className='btn3_mouseout'\" onmousedown=\"this.className='btn3_mousedown'\"onmouseup=\"this.className='btn3_mouseup'\" OnClick=\"mofunstart('" + ID + "','" + wid + "','" + userid + "', embed)\" />"
    +"</div>";	

			document.getElementById('CG' + ID).style.display='none';
			document.getElementById('Loading' + ID).style.display='';
			document.getElementById('mofunclose' + ID).style.display='none';
			document.getElementById('XZ' + ID).style.display='none';
    var story=new DoubleAnimation(document.getElementById(ID+"highlight").style,"left",-100,324,2000)
    var stophandle=setInterval(story.Begin,2000);
    this.set=function(percentage, ID)
    {
			if (document.getElementById('ID' + ID ) != null)
        	document.getElementById(ID+"pb").style.width=Math.round(percentage*329/100);
    }
}


function login_down(obj, url, wid, version, userid, embed)
{	
	var cs = embed.GetClientStatus();
	if( cs == 2 )
	{
		dlg = new commonDialog("test", "系统提示", "魔方尚未安装，是否进入下载魔方页面？", "locationTo()", "", "", "", "none", "");
		return;
	}
		
	if (userid=='') {
		alertOut();
	}
}

function mofunCancel(ID, wid, embed)
{
	embed.Cancel(wid);
	if (document.getElementById("zjMKProcessBar" + ID ) != null)
		document.getElementById("zjMKProcessBar" + ID ).style.display='none';
	if (document.getElementById('zjMKNotDown' + ID ) != null)
		document.getElementById("zjMKNotDown" + ID ).style.display='';
	if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');
	p=100;
}
function mofunclose(ID)
{
if (document.getElementById('zjMKProcessBar' + ID ) != null)
	document.getElementById("zjMKProcessBar" + ID ).style.display='none';
if (document.getElementById('zjMKDown' + ID ) != null)
	document.getElementById("zjMKDown" + ID ).style.display='';
if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');
}
function mofunstart(ID, wid, userid, embed)
{
	embed.Execute(wid, userid);
	if (document.getElementById('zjMKProcessBar' + ID ) != null)
		document.getElementById("zjMKProcessBar" + ID ).style.display='none';
	if (document.getElementById('zjMKDown' + ID ) != null)
		document.getElementById("zjMKDown" + ID ).style.display='';
	if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');	
}

function makeSure(ID)
{
	if (document.getElementById('zjMKNotDown' + ID ) != null)
		document.getElementById("zjMKNotDown" + ID ).style.display='none';
	if (document.getElementById('zjMKDown' + ID ) != null)
		document.getElementById("zjMKDown" + ID ).style.display='';
	if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');	
}


function ProgressBarDemo(ID,url, wid, version, userid, embed)
{
	this.url = url;
	this.wid = wid;
	this.version = version;
	this.userid = userid;

	var topPos =  getTop(document.getElementById('widgetdemo')) + 245;
	var leftPos = getLeft(document.getElementById('widgetdemo')) + 350;

	document.getElementById('Bar').innerHTML =  "<div id=\"divSetup\" style=\"text-align:left;position:absolute;top:" + topPos +"px;left:" + leftPos + "px;width:360px;height:50px;\"><div id='Loading' style='font-size:12px;margin-left:5px;margin-bottom:-20px;'>组件安装中，请稍候......</div><div id='CG' style='display:none;margin-left:5px;margin-bottom:-20px;font-size:12px;'>组件安装成功</div><div id='XZ' style='display:none;margin-left:5px;margin-bottom:-20px;font-size:12px;'>下载失败</div><div id=\""+ID+"\" style=\"position:absolute;width:100px;left:0px;\"><image src=\"./images/emptypb.jpg\" style=\"position: absolute;left:0px; top: 25px;\" /><div id=\""+ID+"pb\" style=\"position: absolute; left: 0px; top: 25px;z-index:5;overflow:hidden;width:0;\" ><img src=\"./images/icon_fullpb.jpg\"/><div id=\""+ID+"highlight\" style=\"background:#ffffff;left: -500px; position: absolute; top: -1px;width:30px;height:20;filter:Alpha(Opacity=75,FinishOpacity=0,Style=2)\"></div></div><div  style=\"position:absolute;font-size:12px;top:0px;left:182px;width:138px;\"><input type=\"submit\" name=\"btnCancel\" id=\"btnCancel\" value=\"取消\"  class=\"btn3_mouseout\" onmouseover=\"this.className='btn3_mouseover'\" onmouseout=\"this.className='btn3_mouseout'\" onmousedown=\"this.className='btn3_mousedown'\"onmouseup=\"this.className='btn3_mouseup'\" onClick=\"mofunDemoCancel('" + wid + "', embed)\" /><input type=\"submit\" name=\"mofunclose\" id=\"mofunclose\" value=\"关闭\"  class=\"btn3_mouseout\" onmouseover=\"this.className='btn3_mouseover'\" onmouseout=\"this.className='btn3_mouseout'\" onmousedown=\"this.className='btn3_mousedown'\"onmouseup=\"this.className='btn3_mouseup'\" OnClick=\"mofunDemoClose('" + wid + "', embed)\" />&nbsp;<input type=\"submit\" name=\"mofunstart\" id=\"mofunstart\" value=\"使用本组件\"  class=\"btn3_mouseout\" onmouseover=\"this.className='btn3_mouseover'\" onmouseout=\"this.className='btn3_mouseout'\" onmousedown=\"this.className='btn3_mousedown'\"onmouseup=\"this.className='btn3_mouseup'\" OnClick=\"mofunDemoStart('" + wid + "', '" + userid + "', embed)\" /></div></div></div>";
	

	document.getElementById('Bar').style.display='';
	document.getElementById('btnCancel').style.display='';
	document.getElementById('mofunclose').style.display='none';
	document.getElementById('mofunstart').style.display='none';
	document.getElementById('DemoDownLoad' + wid).style.display='none';
    var story=new DoubleAnimation(document.getElementById(ID+"highlight").style,"left",-100,324,2000)
    var stophandle=setInterval(story.Begin,2000);
    this.set=function(percentage)
    {
			if (percentage > 0)
			{
				var ctl = document.getElementById(ID+"pb");
				if (ctl != null)
		        	document.getElementById(ID+"pb").style.width=Math.round(percentage*329/100)+"px";
			}
    }
}

function DemoProcessMonitor( percent, ID, processBarObj, embed )
	{
		if (embed.GetStatus(processBarObj.wid)==10) {
			document.getElementById('btnCancel').style.display='none';
			document.getElementById('CG').style.display='';
			document.getElementById('Loading').style.display='none';
			document.getElementById('mofunclose').style.display='';
			document.getElementById('mofunstart').style.display='';
			document.getElementById( ID + 'pb').style.display='';

			processBarObj.set(100);        
			SignDownload(processBarObj.url, processBarObj.wid, processBarObj.version, processBarObj.userid);
			return;
    }

		if (embed.GetStatus(processBarObj.wid)==9) {
			processBarObj.set(0);        
			SignDownload(processBarObj.url, processBarObj.wid, processBarObj.version, processBarObj.userid);
			document.getElementById('btnCancel').style.display='none';
			document.getElementById('CG').style.display='none';
			document.getElementById('Loading').style.display='none';
			document.getElementById('XZ').style.display='';
			document.getElementById('mofunclose').style.display='';
			document.getElementById('mofunstart').style.display='none';
			
			return;
		}
		percent =embed.GetProgress(processBarObj.wid);
		processBarObj.set(percent, ID);
		
		window.setTimeout(DemoProcessMonitor, 100, percent, ID, processBarObj, embed);
	}
function loadingFDemo(ID, url, wid, version, userid, embed)
{
	if (userid=='') {
        alertOut();
        return;
  }
  if (TryDownload(url, wid, version, userid, embed) ) {
		pb1 = null;
		pb1=new ProgressBarDemo(ID, url, wid, version, userid, embed);
		DemoProcessMonitor( 0, ID, pb1, embed);	
  }
}



function mofunDemoCancel(wid, embed){
	document.getElementById('divSetup').style.display='none';
	document.getElementById('DemoDownLoad' + wid).style.display='';
	if( document.getElementById("hiddenStripTransmitter") != null)
		hiddenObj('hiddenStripTransmitter');
	embed.Cancel(wid);	
}
function mofunDemoClose(wid, embed){
	document.getElementById('divSetup').style.display='none';
	if( document.getElementById("hiddenStripTransmitter") != null)
		document.getElementById("hiddenStripTransmitter").style.display = 'none';
	document.getElementById('DemoDownLoad' + wid).style.display='';
}
function mofunDemoStart(wid, userid, embed) {
	embed.Execute(wid, userid);
	document.getElementById('divSetup').style.display='none';
	if( document.getElementById("hiddenStripTransmitter") != null)
		document.getElementById("hiddenStripTransmitter").style.display = 'none';
	document.getElementById('DemoDownLoad' + wid).style.display='';
}


function setcopy(txt, alertmsg){
    if(window.clipboardData) {   
            window.clipboardData.clearData();   
            window.clipboardData.setData("Text", txt);   
    } else if(navigator.userAgent.indexOf("Opera") != -1) {   
         window.location = txt;   
    } else if (window.netscape) {   
	
	 var flashcopier = 'flashcopier';
    if(!document.getElementById(flashcopier)) {
      var divholder = document.createElement('div');
      divholder.id = flashcopier;
      document.body.appendChild(divholder);
    }
    document.getElementById(flashcopier).innerHTML = '';
    var divinfo = '<embed src="./js/_clipboard.swf" FlashVars="clipboard='+encodeURIComponent(txt)+'" width="0" height="0" type="application/x-shockwave-flash"></embed>';
    document.getElementById(flashcopier).innerHTML = divinfo;
        
    }   
	 alert(alertmsg)   
}

//feedback.php
function goIndexPhp()
{
	window.location.href="index.php";
}
function feedTip()
{
	dlg = new commonDialog("test", "系统提示", "您的意见和建议已经提交！ 点击确定后将返回首页！", "goIndexPhp()", "", "","" ,"none" ,"none");
		//window.setTimeout(goIndexPhp,2000);
}
function loginShowTip(str)
{
	document.getElementById(str).style.display = '';
	document.getElementById(str).innerHTML="正在登录中...";
}
function commonDialog( objid, objtitle, objmsg, okfunc, startfunc, cancelfunc, sureDisplayIs, startDisplayIs, cancelDisplayIs)
{
	this.objid = objid;
	this.okfunc = okfunc;
	this.cancelfunc = cancelfunc;

	document.getElementById(objid).innerHTML = '<div id="tipDiv" style="background:url(./images/tip_bg.gif) no-repeat; width:352px; height:178px; z-index:9999;">'
		+ '<div id="tipTitle">' + objtitle + '<img style="display:' + cancelDisplayIs + '" src="./images/exit.jpg" alt="关闭"  onclick="tipDivCancel(\'' + objid + '\');" /></div>'
		+ '<div id="tipMessage"><img src="./images/tip_alert.jpg" /><br/>' + objmsg + '</div>'
		+ '<div id="tipBtn"><img id="tipBtnimg" style="display:' + sureDisplayIs + '" src="./images/tip_btn1.jpg" onclick="javascript:' + okfunc + ';tipDivCancel(\'' + objid + '\')" /><img style="display:' + startDisplayIs + '" src="./images/tip_btn4.jpg" onclick="javascript:tipDivCancel(\'' + objid + '\');' + startfunc + ';" /><img style="margin-left:14px;display:' + cancelDisplayIs + '" src="./images/tip_btn2.gif" onclick="tipDivCancel(\'' + objid + '\');" /></div>'
  	+ '</div>';
  //alert(document.getElementById(objid).innerHTML);
  var tipDiv = window.document.getElementById(objid);
		if ( tipDiv != null)
		{
			 var myWidth = 0, myHeight = 0;
		  if( typeof( window.innerWidth ) == 'number' ) {
				myWidth = window.innerWidth;
				myHeight = window.innerHeight;
			
			} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
					myWidth = document.documentElement.clientWidth;
					myHeight = document.documentElement.clientHeight;
			} else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
					myWidth = document.body.clientWidth;
					myHeight = document.body.clientHeight;
			}
			
			h = window.document.body.scrollHeight;
			if(h<document.body.clientHeight){
		    h=document.body.clientHeight;
		  }
		  
		  w = window.document.body.scrollWidth;
		  
		  var scrollPos; 
      if (typeof window.pageYOffset != 'undefined') { 
         scrollPos = window.pageYOffset; 
      } 
      else if (typeof document.compatMode != 'undefined' && 
           document.compatMode != 'BackCompat') { 
         scrollPos = document.documentElement.scrollTop; 
      } 
      else if (typeof document.body != 'undefined') { 
         scrollPos = document.body.scrollTop; 
      } 
		  
		   var div_hei = document.getElementById("divbackblack");
		
		   if ( myWidth > 352 )
		   tipDiv.style.left = (myWidth-352)/2 + "px";
		   else tipDiv.style.left = 0 + "px";
		   if ( myHeight > 178 )
		   tipDiv.style.top = ((myHeight-178)/2 + scrollPos) + "px";
		   else tipDiv.style.top = 0 + "px";
		  
		   var s = document.getElementsByTagName("select");
		   for( var i=0;i<s.length;i++){
		    //s[i].style.display="none";
		    //s[i].style.width=0;
   			//s[i].style.height=0;
   			s[i].style.visibility = 'hidden';
		   }
			div_hei.style.height=h + "px";
			div_hei.style.width=myWidth + "px";
			
			div_hei.style.display = "";
			tipDiv.style.display = "";
	}
}
 function commitonclick() {			   
	if( document.getElementById("commenttext").value == "请输入您要评论的内容!")
		{document.getElementById("commenttext").value = "";
		document.getElementById("commenttext").style.color="#000000";}
 }
 
function commitonBlur() {
if( document.getElementById("commenttext").value.trim() == "")
   {document.getElementById("commenttext").value = "请输入您要评论的内容!";
   document.getElementById("commenttext").style.color="#C1C1C1";}			
}
function fankuikeySub(e) {	

   var msie = (document.all) ? true : false;
   var keycode;
   if(!msie)keycode=e.which;
   else keycode=event.keyCode;
   if(keycode == 13){
   	if( document.getElementById("tipDiv") != null)
	{
		goIndexPhp();
		
	}
   }
}

function fankuionblurname() {	
	if( document.getElementById("name").value.trim() == "")
	{
		document.getElementById("txtname").innerHTML="请填写您的姓名!"; 
		

		
	}
	else
	{
	document.getElementById("txtname").innerHTML="*"; 
	}
}

function fankuionbluradvice() {	
if( document.getElementById("advice").value.trim() == "")
	{
		document.getElementById("txtarea").innerHTML="<br>请填写意见建议!"; 

		
	}
	else
	{
	document.getElementById("txtarea").innerHTML="*"; 
	}
}

function fankuionbluremail() {	
		if( document.getElementById("email").value.trim() == "")
	{
		document.getElementById("txtemail").innerHTML="请填写您的Email!"; 
		
		
		
	}
	else
	{
		if(checkEmail(document.getElementById("email").value))
		{
			document.getElementById("txtemail").innerHTML="*"; 
		}
		else
		{
			document.getElementById("txtemail").innerHTML="Email格式输入错误,请重新输入!"; 
			document.getElementById("email").focus();
			document.getElementById("email").select();
			
		}
	
	}
}

 function fankuiclick() {	
    var success=true;
	if( document.getElementById("advice").value.trim() == "")
	{
		document.getElementById("txtarea").innerHTML="<br>请填写意见建议!"; 
		document.getElementById("advice").focus();
		success=false;
	}
	else
	{
	document.getElementById("txtarea").innerHTML="*"; 
	}
		
	if( document.getElementById("email").value.trim() == "")
	{
		document.getElementById("txtemail").innerHTML="请填写您的Email!"; 
		document.getElementById("email").focus();
		success=false;
	}
	else
	{
		if(checkEmail(document.getElementById("email").value))
		{
			document.getElementById("txtemail").innerHTML="*"; 
		}
		else
		{
			document.getElementById("txtemail").innerHTML="Email格式输入错误,请重新输入!"; 
			document.getElementById("email").focus();
			document.getElementById("email").select();
			success=false;
		}
	
	}
	
	if( document.getElementById("name").value.trim() == "")
	{
		document.getElementById("txtname").innerHTML="请填写您的姓名!"; 
		document.getElementById("name").focus();
		success=false;
	}
	else
	{
	document.getElementById("txtname").innerHTML="*"; 
	}

	
	if(success) 
	{
				 	
		$.post("feeding.php",                
		{	name: document.getElementById("name").value,
			email: document.getElementById("email").value,
			address : document.getElementById("address").value,
			phone: document.getElementById("phone").value,
			advice: document.getElementById("advice").value,
		 	type:document.getElementById("type").value		 
		 }, 
		function(data) { 
		        document.getElementById("name").focus();
				feedTip(); 
			}   
		);  
		
	}
 }	

function checkEmail(objText) 
{
	var strText=objText.trim();		
	if(strText=="") return true;
	
	var strReg=""; 
	var r; 
	strReg=/^([a-zA-Z0-9_-])+@([a-zA-Z0-9_-])+.([a-zA-Z0-9_-])+/; 
	r=strText.search(strReg); 
	if(r==-1) 
	{   
	return  false;   
	}  
	else  
	{   
	return  true;   
	}   
	
}


	//字符串去空格的正則式
String.prototype.trim=function()
{
	return   this.replace(/^(&nbsp;|[\s　])+|(&nbsp;|[\s　])+$/g,   ""   ); 
}
function issbccase(source) 
 {   
	if (source.match(/[\uff00-\uffff]/g))
		return true;
	else
		return false;
 }
