﻿
function gohome()
{
    window.location = '/';
}

var biandiv;
var bianstep;
var bianchk;
var biantime;

function bian(d,time)
{
    biandiv = d;
    bianstep = 0;
    biantime = time;
    bianchk = setTimeout("bianprogress()",time);
}

function bianprogress()
{
    if(bianstep == 0)
    {
        biandiv.innerHTML = '嘛'
        bianstep = 1;
        bianchk = setTimeout("bianprogress()",biantime);
    }
    else if(bianstep == 1)
    {
        biandiv.innerHTML = '嘛咪'
        bianstep = 2;
        bianchk = setTimeout("bianprogress()",biantime);        
    }
    else if(bianstep == 2)    
    {
        biandiv.innerHTML = '嘛咪嘛'
        bianstep = 3;        
        bianchk = setTimeout("bianprogress()",biantime);         
    }
    else if(bianstep == 3)    
    {
        biandiv.innerHTML = '嘛咪嘛咪'
        bianstep = 4;
        bianchk = setTimeout("bianprogress()",biantime);        
    }
    else if(bianstep == 4) 
    {   
        biandiv.innerHTML = '嘛咪嘛咪轰～<img src="/images/rabbit/30.gif">';
        clearTimeout(bianchk);
        setTimeout("gohome()",4000);                                 
    }
}



function ValidationFunctionName(source, arguments)
{
    var userName =document.getElementById("name");
     
        var oBao = new ActiveXObject("Microsoft.XMLHTTP");
        oBao.open("Get","/page/other/checkusername.aspx?username=" + userName.value,false);  
        oBao.send();
        var strResult = oBao.responseText;

        //如果返回 1 就代表可以使用，否则不能通过验证
        if (Number(strResult) == 1)
          arguments.IsValid = true;    
        else
          arguments.IsValid = false;
    
   
}

function ValidationFunctionUserName(source, arguments)
{
    var userName =document.getElementById("username");
     
        var oBao = new ActiveXObject("Microsoft.XMLHTTP");
        oBao.open("Get","/page/other/checkname.aspx?username=" + userName.value,false);  
        oBao.send();
        var strResult = oBao.responseText;

        //如果返回 1 就代表可以使用，否则不能通过验证
        if (Number(strResult) == 1)
          arguments.IsValid = true;    
        else
          arguments.IsValid = false;
    
   
}

function ValidationFunctionEmail(source, arguments)
{
    var userEmail =document.getElementById("email");
     
        var oBao = new ActiveXObject("Microsoft.XMLHTTP");
        oBao.open("Get","/page/other/checkemail.aspx?userEmail=" + userEmail.value,false);  
        oBao.send();
        var strResult = oBao.responseText;

        //如果返回 1 就代表可以使用，否则不能通过验证
        if (Number(strResult) == 1)
          arguments.IsValid = true;    
        else
          arguments.IsValid = false;
}
function ValidationFunctionTel(source, arguments)
{
    var userTel =document.getElementById("tel");
     
        var oBao = new ActiveXObject("Microsoft.XMLHTTP");
        oBao.open("Get","/page/other/checktel.aspx?userTel=" + userTel.value,false);  
        oBao.send();
        var strResult = oBao.responseText;

        //如果返回 1 就代表可以使用，否则不能通过验证
        if (Number(strResult) == 1)
          arguments.IsValid = true;    
        else
          arguments.IsValid = false;
}


function getClientBounds()
{
	var clientWidth;
	var clientHeight;
	switch(Sys.Browser.agent) {
		case Sys.Browser.InternetExplorer:
			clientWidth = document.documentElement.clientWidth;
			clientHeight = document.documentElement.clientHeight;
			break;
		case Sys.Browser.Safari:
			clientWidth = window.innerWidth;
			clientHeight = window.innerHeight;
			break;
		case Sys.Browser.Opera:
			clientWidth = Math.min(window.innerWidth, document.body.clientWidth);
			clientHeight = Math.min(window.innerHeight, document.body.clientHeight);
			break;
		default:  // Sys.Browser.Firefox, etc.
			clientWidth = Math.min(window.innerWidth, document.documentElement.clientWidth);
			clientHeight = Math.min(window.innerHeight, document.documentElement.clientHeight);
			break;
	}

	return new Sys.UI.Bounds(0, 0, clientWidth, clientHeight);
}

function resizeElements()
{
	var clientBounds = getClientBounds();
	var clientWidth = clientBounds.width;
	var clientHeight = clientBounds.height;

	var bg = $get("modalBackground");
	bg.style.width = Math.max(Math.max(document.documentElement.scrollWidth, document.body.scrollWidth), clientWidth) + 'px';
	bg.style.height = Math.max(Math.max(document.documentElement.scrollHeight, document.body.scrollHeight), clientHeight) + 'px';

	var scrollLeft = (document.documentElement.scrollLeft ? document.documentElement.scrollLeft : document.body.scrollLeft);
	var scrollTop = (document.documentElement.scrollTop ? document.documentElement.scrollTop : document.body.scrollTop);	
	scrollLeft = scrollLeft + clientBounds.width / 2 - 250;
	scrollTop = scrollTop + clientBounds.height /2 - 175;
	var dialog = $get("animationDialog");
	dialog.style.left = scrollLeft + "px";
	dialog.style.top = scrollTop + "px";
}

/*
function UrlEncode(str){ 
  var ret=""; 
  var strSpecial="!\"#$%&'()*+,/:;<=>?[]^`{|}~%"; 
  var tt= "";

  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 jointAgreementShow()
{
    if ($('DJointAgreement').style.display=='')
    {
        $('DJointAgreement').style.display='none';
    }
    else
    {
        $('DJointAgreement').style.display=''
    }
}

function searchevent(h)
{
    if(h != null && h.value != '')
        window.location = 'http://www.1joint.com/event/?date=0&keyword='+escape(h.value);
}
function searchmevent(h,selectelement)
{
    if( h != null && h.value != '' && selectelement!=null)
    {
        if (selectelement.value=="event")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=10&keyword="+escape(h.value);
        }
        else  if(selectelement.value=="nightlife")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=1&keyword="+escape(h.value);
        }
        else if (selectelement.value=="sales")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=2&keyword="+escape(h.value);
        }
        else if (selectelement.value=="culture")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=3&keyword="+escape(h.value);
        }
        else if (selectelement.value=="sports")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=4&keyword="+escape(h.value);
        }
        else if (selectelement.value=="learning")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=5&keyword="+escape(h.value);
        }
        else if (selectelement.value=="business")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=6&keyword="+escape(h.value);
        }
        else if (selectelement.value=="jointclub")
        {
            var url="http://www.1joint.com/search/event/?date=0&categoryID=0&keyword="+escape(h.value);
        }
        else
        {
            var url="http://www.1joint.com/search/"+selectelement.value+"/?date=0&keyword="+escape(h.value);
        }
       window.open(url);
        }

}

function searchuser(h,selectelement)
{
    if( h != null && h.value != '' && selectelement!=null  )
    {
        var sexvalue=0;
        for (var i=0;i<h.length;i++)
        {
            if(h[i].checked)
            {
                sexvalue= h[i].value;
            }
        }

        if (selectelement.value=='1')
        {
        var url="http://www.1joint.com/search/user/?city="+selectelement.value+"&sex="+sexvalue;
        }
        else
        {
        var url="http://www.1joint.com/user/?city="+selectelement.value+"&sex="+sexvalue;
        }
       window.open(url);
        }

}

function searchuser1(h)
{
    
        var url="http://www.1joint.com/search/user/?city=1&sex="+h;
       window.open(url);
}

function searchevent2(h)
{
    var evt = getEvent();
    if(evt && evt.keyCode==13)
    {
        evt.keyCode=9;
        evt.returnValue = false;
        if(h != null && h.value != '')
            window.open('/event/?date=0&keyword='+escape(h.value));
    }
}

function searchevent3(h,selectelement)
{
    var evt = getEvent();
    if(evt && evt.keyCode==13)
    {
        evt.keyCode=9;
        evt.returnValue = false;
        if(h != null && h.value != '')
            {
            if (selectelement.value=="event")
        {
            var url="/search/event/?date=0&categoryID=10&keyword="+escape(h.value);
        }
         else if(selectelement.value=="nightlife")
        {
            var url="/search/event/?date=0&categoryID=1&keyword="+escape(h.value);
        }
        else if (selectelement.value=="sales")
        {
            var url="/search/event/?date=0&categoryID=2&keyword="+escape(h.value);
        }
        else if (selectelement.value=="culture")
        {
            var url="/search/event/?date=0&categoryID=3&keyword="+escape(h.value);
        }
        else if (selectelement.value=="sports")
        {
            var url="/search/event/?date=0&categoryID=4&keyword="+escape(h.value);
        }
        else if (selectelement.value=="learning")
        {
            var url="/search/event/?date=0&categoryID=5&keyword="+escape(h.value);
        }
        else if (selectelement.value=="business")
        {
            var url="/search/event/?date=0&categoryID=6&keyword="+escape(h.value);
        }
        else if (selectelement.value=="jointclub")
        {
            var url="/search/event/?date=0&categoryID=0&keyword="+escape(h.value);
        }
        else
        {
            var url="/search/"+selectelement.value+"/?date=0&categoryID=10&keyword="+escape(h.value);
        }
       window.open(url);
            }
    }
}

function searchArticle(h)
{
    if(h != null && h.value != '')
    {
        var url="/search/article/?keyword="+escape(h.value);
        }
    window.open(url);
}

function showUserInfoDiv()
{
    if (document.getElementById('userInfoDiv').style.display=='none')
    {
        document.getElementById('userInfoDiv').style.display='';
    }
    else if (document.getElementById('userInfoDiv').style.display=='')
    { 
        document.getElementById('userInfoDiv').style.display='none';
    }
}

function showusergallerylist(h)
{
    if (h.checked)
    {
        document.getElementById('albumlist').style.display=''
    }
    else
    {
        document.getElementById('albumlist').style.display='none';
    }
}

function refreshUrl()
{
    window.location = window.location;
}

function getEvent()
{
    if(window.event) return window.event;
    func=getEvent.caller;
    while(func!=null)
    {
        var arg0=func.arguments[0];
        if(arg0)
        {
            if(arg0.constructor==Event) // 如果就是event 对象
                return arg0;
        }
        func=func.caller;
    }
    return null;
}

function goevent(h)
{
    var evt = getEvent();
    if(evt && evt.keyCode==13)
    {
        evt.keyCode=9;
        evt.returnValue = false;
        if(h != null && h.value != '')
            window.location = '/event/'+escape(h.value)+'/';
    }
}

function goevent2(h)
{
    if(h != null && h.value != '')
         window.location = '/event/'+escape(h.value)+'/';
}

function searchitem(h,url)
{
    var evt = getEvent();
    if(evt && evt.keyCode==13)
    {
        evt.keyCode=9;
        evt.returnValue = false;
        if(h != null && h.value != '')
            window.location = url+'&keyword='+escape(h.value);
        else
            window.location = url;            
    }
}

function searchitem2(h,url)
{
    if(h != null && h.value != '')
         window.location = url+'&keyword='+escape(h.value);
    else
        window.location = url;
}





function msgselectall(n,c,t)
{
   var divI;
       for (divI=1;divI<=c;divI++)
        {
            if(document.getElementById(n + divI) != null)
                document.getElementById(n + divI).setAttribute("checked",t.checked);
        }
   
}

function inputselectall(n,c,t)
{
   var divI;
       for (divI=1;divI<=c;divI++)
        {
            if(document.getElementById(n + divI) != null)
                document.getElementById(n + divI).setAttribute("checked",t.checked);
        }
   
}

function CopyUrl() 
{
//    document.getElementById("holdtext").innerText = document.getElementById("input_url").value;
    Copied = document.getElementById("holdtext").createTextRange();
    Copied.execCommand("Copy");
    alert("复制成功!");
}

function ClipBoard() 
{
//    document.getElementById("holdtext").innerText = document.getElementById("ctl00_copy_url").innerText;
    Copied = document.getElementById("holdtext").createTextRange();
    Copied.execCommand("Copy");
    alert("复制成功!");
}
function ClipBoard2() 
{
    document.getElementById("holdtext").innerText= document.getElementById("ctl00$left_content$u_photo_url").value;
    Copied = document.getElementById("holdtext").createTextRange();
    Copied.execCommand("Copy");
    alert("复制成功!");
}

function ClipBoard3() 
{
    document.getElementById("holdtext").innerText= document.getElementById("ctl00_left_content_v_photo_url").value;
    Copied = document.getElementById("holdtext").createTextRange();
    Copied.execCommand("Copy");
    alert("复制成功!");
}

function ClipBoard4() 
{
    document.getElementById("holdtext").innerText = document.getElementById("copytext").innerText;
    Copied = document.getElementById("holdtext").createTextRange();
    Copied.execCommand("Copy");
    alert("复制成功!");
}

function CreateBookmarkLink(title,url) 
{ 
    if (navigator.appName != 'Microsoft Internet Explorer') 
    {
        window.sidebar.addPanel(title, url,'');
    } 
    else if( window.external ) 
    { 
        window.external.AddFavorite(url, title);
    }    
    else if(window.opera && window.print) 
    { return true; } 
}

newWin=null;
  function openMsnWindow()
{ 
    newWin=window.open("/page/other/MsnMailLogin.html","msn",'height=400,width=400,top=200,left=400,toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'); 
} 
  
function openMessageWindow()
{ 
    newWin=window.open("/page/other/Messagemail.aspx","msn",'height=400,width=400,top=200,left=400,toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'); 

}

function openMessageWindow1()
{ 
    newWin=window.open("/page/other/Messagemail1.aspx","msn",'height=400,width=400,top=200,left=400,toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'); 
}

function openMatchWindow(eventid)
{ 
    newWin=window.open("/page/other/Messagemail1.aspx?eventid="+eventid,"msn",'height=400,width=400,toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no'); 
}

function reloadcode(){ 
document.getElementById('codepic').src = '/page/other/validate.aspx?' + Math.random();
var codepic = document.getElementById("codepic");
codepic.onreadystatechange = function ()
{
    if (codepic.readyState == "complete")
    {
        checkValidatecode();
    }
}
}

window.onfocus=function (){  
 if(newWin){
  if(!newWin.closed)
   newWin.focus();
  
 } 
 
}; 

window.document.onfocus=function (){  
 if(newWin){
  if(!newWin.closed)
 newWin.focus();
  
 } 
 
}; 

window.document.onclick=function (){  


 if(newWin){
  if(!newWin.closed)
 newWin.focus();
  
 } 
 
}; 

window.document.ondblclick=function (){  

 if(newWin){
  if(!newWin.closed)
 newWin.focus();
  
 } 
 
}; 

 function showfun4(s,w,h){
        if(document.readyState=='complete'){
            showdialog(s,w,h);
            clearTimeout(chk)
        }
        else
            chk = setTimeout("showfun4('"+s+"','"+w+"','"+h+"')",10)
    }   
function killErrors(){
return true;
}

function Q_$(o){return window.top.document.getElementById(o)}	//根据指定ID返回对象
/*-------Tab切换实现--------------------*/

var QieHuan_6 = "Hot1"; 

function QieHuan(Tab,e,Type)
{
	var tID = e.id;
	var DefaultTab = eval("QieHuan_" + Tab);
	if (DefaultTab != tID)
	{
		var OFFCss = "qiehua1_off";
		var ONCss = "qiehua1_on";
		if (Type != undefined)
		{
			OFFCss = Type.split(",")[1];
			ONCss = Type.split(",")[0];
		}
		Q_$(DefaultTab).className = OFFCss;
		e.className = ONCss;
		if (Q_$(DefaultTab + "_a")) Q_$(DefaultTab + "_a").className = "qhaoff";
		if (Q_$(DefaultTab + "_Div")) Q_$(DefaultTab + "_Div").style.display = "none";
		if (Q_$(tID + "_a")) Q_$(tID + "_a").className = "qhaon";
		if (Q_$(tID + "_Div")) Q_$(tID + "_Div").style.display = "";

		QieHuan_6 = tID;

	}
}

window.onerror = killErrors;
