var currentLine = -1;
function goPage(paramName,pageNum,formIndex){
		var formObject = eval("document.forms["+formIndex+"]");
		eval("document.forms["+formIndex+"]."+paramName).value=pageNum;
		formObject.submit(); 
}

function appendParam(actionUrl,formIndex){
	//alert(document.forms.length);
	var formObject = eval("document.forms["+formIndex+"]");
	if(formObject+'' != "undefined"){
		var ele = formObject.elements;
		for (var i = 0; i < ele.length; i++) {
			if (ele[i].tagName == "INPUT"){
				if(ele[i].type == "text" || ele[i].type == "hidden"){
					if(ele[i].value != null && ele[i].value != "")
						actionUrl = actionUrl + "&" + ele[i].name + "=" + ele[i].value;
				}
			}
			else if (ele[i].tagName == "SELECT"){
				if(ele[i].options[ele[i].selectedIndex].value != null 
				&& ele[i].options[ele[i].selectedIndex].value != "")
					actionUrl = actionUrl + "&" + ele[i].name + "=" + ele[i].options[ele[i].selectedIndex].value;
			}

		}		
	}
	return actionUrl;
}

function viewCateProduct(encodeTag,tabname,tabProdName) {
			var tabObject = document.getElementById(tabname);
			var tabs = tabObject.childNodes;
			var isup = true;
			for(tab in tabs) {
				if(tabs[tab].nodeType!=1) {
					continue;
				}
				if(tabs[tab].id == 'tab_'+encodeTag) {
					tabs[tab].className = 'navion rightborder';
					isup = false;
				}
				else {
					if(isup) {
						tabs[tab].className=tabs[tab].className = 'navioff leftborder';
					}
					else {
						
						tabs[tab].className=tabs[tab].className = 'navioff rightborder';
					}
					
				}
			}
			var prodObject = document.getElementById(tabProdName);
			var divs = prodObject.childNodes;
			for(p in divs) {
				if(divs[p].nodeType!=1) {
					continue;
				}
				if(divs[p].id == encodeTag) {
					divs[p].style.display = "block";
				}
				else {
					divs[p].style.display = "none";
				}
			}
			
}

String.prototype.trim = function(){
   //return this.replace(/(^\s*)|(\s*$)/g, "");
   //去&nbsp;与' '空格
   return this.replace(/(^\s*)|(\s*$)/g, "").replace(/(^(&nbsp;)*)|((&nbsp;)*$)/g, "");
}

function LTrim(str) {
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1) {
		var j = 0, i = s.length;
		while (j < i && whitespace.indexOf(s.charAt(j)) != -1) {
			j++;
		}
		s = s.substring(j, i);
	}
	return s;
}
function RTrim(str) {
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(s.length - 1)) != -1) {
		var i = s.length - 1;
		while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1) {
			i--;
		}
		s = s.substring(0, i + 1);
	}
	return s;
}

function clearview(path){
	var href = location.href;
	if(confirm("您确定清除？"))
		location.href=path + "/clearView.html?redirectUrl="+href;
}


function drag(obj, pos) {  
    if (typeof obj == "string") 
    	obj = document.getElementById(obj); 
    obj.orig_x = parseInt(obj.style.left) - document.body.scrollLeft;
    obj.orig_index = obj.style.zIndex;    
    obj.onmousedown = function(a)  
    {  
        var d=document;  
        if(!a)
        	a=window.event;  
        var x = a.clientX+d.body.scrollLeft-obj.offsetLeft;  
        d.ondragstart = "return false;"  
        d.onselectstart = "return false;"  
        d.onselect = "document.selection.empty();"  
                  
        if(obj.setCapture)  
            obj.setCapture();  
        else if(window.captureEvents)  
            window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);  

        d.onmousemove = function(a)  
        { 
            if(!a)
            	a=window.event;  
            var tmpLeft = parseInt(a.clientX+document.body.scrollLeft-x);
          	if((pos=="left" && tmpLeft>=leftInit&&tmpLeft<(rightPos-barWidth))||(pos=="right" && tmpLeft<=rightInit&&tmpLeft>(leftPos+barWidth))){
            	obj.style.left = tmpLeft + "px";
        	if(pos=="left") {
				document.getElementById("pfrom").value=Math.round((tmpLeft-leftInit)*(maxPrice-minPrice)/(rightInit-barWidth))+minPrice;
				leftPos=tmpLeft;
            }
        	else if(pos=="right"){
				document.getElementById("pto").value=Math.round((tmpLeft-leftInit-barWidth)*(maxPrice-minPrice)/(rightInit-barWidth))+minPrice;
            	rightPos=tmpLeft;
			}
            obj.orig_x = tmpLeft - document.body.scrollLeft;  
            
			var priceBarLeftPos=parseInt(document.getElementById("minPriceBar").style.left);
			var priceBarRightPos=parseInt(document.getElementById("maxPriceBar").style.left);
			document.getElementById("rangeBar").style.left=priceBarLeftPos+"px";
			document.getElementById("rangeBar").style.width=(priceBarRightPos-priceBarLeftPos) + "px";
           }
        }  

        d.onmouseup = function()  
        { 
            if(obj.releaseCapture)  
                obj.releaseCapture();  
            else if(window.captureEvents)  
                window.captureEvents(Event.MOUSEMOVE|Event.MOUSEUP);  
            d.onmousemove = null;  
            d.onmouseup = null;  
            d.ondragstart = null;  
            d.onselectstart = null;  
            d.onselect = null;  
        }  
    }  
      
}

function openWindowWithScroll(url,winName,width,height){
	var X = (screen.width-width)/2;
	var Y = (screen.height-height)/2-50;
	var newwin = window.open(url,winName,"height="+height+", width="+width+", top="+Y+", left="+X+", toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");
	newwin.focus();
}

function openTopWindowWithScroll(url,winName,width,height){
	var X = (screen.width-width)/2;
	var Y = 0;
	var newwin = window.open(url,winName,"height="+height+", width="+width+", top="+Y+", left="+X+", toolbar=no, menubar=no, scrollbars=yes, resizable=no,location=no, status=no");
	newwin.focus();
}

function formatFloat(src, pos)
{
	var num = Math.round(src*Math.pow(10, pos))/Math.pow(10, pos);
   /* var renum = num + ""; 
    
    if (num == parseInt(num)) 
    { 
        renum += "."; 
        
        for(var i=0;i < pos;i++) { 
            renum += "0" 
        } 
        return renum    
    } 
    len = (parseInt(src)+"").length+ pos +1 -(num+"").length; 
    if (len > 0) 
    {        
        for(var i=0;i <len;i++) 
        { 
            renum += "0" 
        } 
    } 
    */
    return num 
}

function commafy(num){
	num = num + "";
	var re=/(-?\d+)(\d{3})/
	while(re.test(num)){
		num=num.replace(re,"$1,$2")
	}
	return num;
}

function searchkdOnSubmit(){
	var keyword = document.getElementById("keyword");
	if (keyword.value.trim() == '' || keyword.value.trim() == '输入关键字比较商品'){
		if(keyword.value.trim() != '输入关键字比较商品')
			keyword.value = "";
		return false;
	}
	//creatSearchDiv("搜索中，请等待...");
	return true;
}
function searchkdOnSubmitForStore(domain){
	var keyword = document.getElementById("keyword");
	if (keyword.value.trim() == '' || keyword.value.trim() == '输入关键字比较商品'){
		if(keyword.value.trim() != '输入关键字比较商品')
			keyword.value = "";
		return false;
	}
	if(domain != null && domain != "")
		document.serchform.domain.value = domain;
	else
		document.serchform.domain.disabled = true;
	document.serchform.submit();
}

function creatSearchDiv(msg) {
	var divSearchWaiting = document.getElementById("divSearchWaiting");
	if (divSearchWaiting == null) {
		divSearchWaiting = document.createElement("DIV");
		divSearchWaiting.setAttribute("id", "divSearchWaiting");
		divSearchWaiting.className = "divSearchWaitingStyle";
		divSearchWaiting.innerHTML = msg;
		document.body.appendChild(divSearchWaiting);
	}

	var w = 0; 
	var h = 0;      	       	
	var ua = navigator.userAgent.toLowerCase();
	var os = new Object();
	os.isFirefox = ua.indexOf ("gecko") != -1;
	os.isOpera = ua.indexOf ("opera") != -1;
	os.isIE = !os.isOpera && ua.indexOf ("msie") != -1;
	os.isSafa = !os.isOpera && ua.indexOf ("safari") != -1;
	if(os.isOpera){
	     w = document.body.clientWidth;
	     h = document.body.clientHeight;
	}else if(os.isFirefox){
	     w = document.documentElement.clientWidth;
	     h = document.documentElement.clientHeight;
	}else if(os.isIE){
	      w = document.documentElement.clientWidth;
	      h = document.documentElement.clientHeight;
	}else if(os.isSafa){
	      w = document.body.clientWidth;
	      h = document.body.clientHeight;
	}    	
	divSearchWaiting.style.position = "absolute";  
	divSearchWaiting.style.left =  (w-200)/2 + "px"; 
	divSearchWaiting.style.zIndex = 1001;
	divSearchWaiting.style.top = (h-60)/2+ "px";
	divSearchWaiting.style.visibility = "visible";
}

function searchkdOnFocus(obj){

	if (obj.value.trim() == '输入关键字比较商品')
		obj.value = "";
	obj.style.color = '#333';
}

function searchkdOnBlur(obj){
	if (obj.value.trim() == '') {
		obj.value = '输入关键字比较商品';
		obj.style.color = '#999';
	} else {
		obj.style.color = '#333';
	}
}


function showChanneltype() {
	var obj = document.getElementById("channeltypediv");
	if(obj.style.visibility == "hidden")
		obj.style.visibility = "visible";
	else
		obj.style.visibility = "hidden";
	
	var srcobj = document.getElementById("channeltypecontain");
	var leftpos = 0,toppos = 0;
	var pObject = srcobj.offsetParent;
	if (pObject){
		leftpos += pObject.offsetLeft;
		toppos += pObject.offsetTop;
	}
	while(pObject=pObject.offsetParent ){
		leftpos += pObject.offsetLeft;
		toppos += pObject.offsetTop;
	}

	obj.style.left = (srcobj.offsetLeft + leftpos) + "px";
	obj.style.top = (srcobj.offsetTop + toppos + srcobj.offsetHeight - 1) + "px";
}

function selectChanneltype(obj){
	obj.style.backgroundColor="#FFE6C9";
	obj.style.color="#990000"
	keepChanneltype();
}

function unSelectChanneltype(obj){
	obj.style.backgroundColor="#fff";
	obj.style.color="#333333"
}

function hiddenChanneltype(){
	var obj = document.getElementById("channeltypediv");
	obj.style.visibility = "hidden";
}

function keepChanneltype(){
	var obj = document.getElementById("channeltypediv");
	obj.style.visibility = "visible";
}

function doSelectChanneltype(type,obj){
	document.getElementById("channeltypecontain").innerHTML=obj.innerHTML;
	document.getElementById("channeltype").value = type;
	hiddenChanneltype();
}


function resizeImg(id,maxWidth,maxHeight){  
     var showimg = new Image();
   	 showimg.src = id.src;
     var width = showimg.width;
     var height = showimg.height;
     if(width < maxWidth){
     	 id.width = width;
     }
     if(width > maxWidth){
         var scale = cScale(width,height,maxWidth,maxHeight);
         if (scale>1.0){
             scale=1.0;
         }
         width = parseInt(width * scale);
         height = parseInt(height * scale);
         id.width = width;
         id.height = height;
         if(height > maxHeight)
         	id.height = maxHeight;
    }
    if(height > maxHeight){
         var scale = cScale(height,width,maxHeight,maxWidth);
         if (scale>1.0){
             scale=1.0;
         }
         width = parseInt(width * scale);
         height = parseInt(height * scale);
         id.width = width;
         id.height = height;
         if(width > maxWidth)
         	id.width = maxWidth;
    }   
}

function resizeImgProd(id,maxWidth,maxHeight,dheight){  
    resizeImg(id,maxWidth,maxHeight);
    
    var ch = id.height;
    var mh  = (dheight-ch)/2;
    
    id.style.marginTop = mh+"px";
}

function cScale( w,  h,  maxWidth,  maxHeight)
{
    var scale = 1.0;
    scale = maxWidth / w >= maxHeight / h ? maxHeight / h : maxWidth / w;
    return parseFloat(scale);
}


function setTab(m,n){
	var tli=document.getElementById("menu"+m).getElementsByTagName("li");

	for(i=0;i<tli.length-1;i++){
		if(i==0)
			tli[i].className=i==n?"hover_l":"";
		else
			tli[i].className=i==n?"hover":"";
		mli=document.getElementById("md"+i);
		mli.style.display=i==n?"block":"none";
	}
}

function showHelpMsg(msg,obj){
	var floatAreaName = creatInfoDiv(msg);
	showMsgOfId(floatAreaName,obj,null,null,null);
}


function  hiddenHelpMsg(){
	var div = document.getElementById("divScreenHelpMsg");
	div.style.display = "none";
}

function creatInfoDiv(msg) {
	return creatDivWithId(msg,"divScreenHelpMsg");
}

function showMsgOfId(did,obj,width,bg,bordercolor){
	var floatArea = document.getElementById(did);
	var leftpos = 0,toppos = 0;
	var pObject = obj.offsetParent;
	if (pObject){
		leftpos += pObject.offsetLeft;
		toppos += pObject.offsetTop;
	}
	while(pObject=pObject.offsetParent )
	{
		leftpos += pObject.offsetLeft;
		toppos += pObject.offsetTop;
	}
	if(bordercolor != null)
		floatArea.style.borderColor = bordercolor;
	if(bg != null)
		floatArea.style.background = bg;
	if(width != null)
		floatArea.style.width = width+"px";	
	floatArea.style.padding = 0;
	floatArea.style.left = (obj.offsetLeft + leftpos) + "px";
	floatArea.style.top = (obj.offsetTop + toppos + obj.offsetHeight - 1) + "px";
	floatArea.style.display = "";
}

function creatDivWithId(msg,did){
	var div = document.getElementById(did);
	if (div == null || div + "" == "undefined") {
		div = document.createElement("DIV");
		div.setAttribute("id", did);
		div.className = "helpMsgBox";
		document.body.appendChild(div);
	}
	div.innerHTML = msg;	
	return did;
}

function copyToClipboard(theField) { 
	var txt = document.getElementById(theField).value;
     if(window.clipboardData) {    
             window.clipboardData.clearData();    
             window.clipboardData.setData("Text", txt);   
             alert("复制成功。");
     } else if(navigator.userAgent.indexOf("Opera") != -1) {    
          window.location = txt;    
          alert("复制成功。");
     } else if (window.netscape) {    
          try {    
               netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect");    
          } catch (e) {    
               alert("被浏览器拒绝！\n请在浏览器地址栏输入'about:config'并回车\n然后将'signed.applets.codebase_principal_support'设置为'true' \n 或用Ctrl+C、Ctrl+V或鼠标右键复制、粘贴的方式来复制");    
          }    
          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 validateDateStr(str)
   {
		
		var re=/^(\d{4})-(\d{2})-(\d{2})\s(\d{2}):(\d{2})$/
		if(!re.test(str))
		 return false;
		 
		var strYear=RegExp.$1;
		var strMonth=RegExp.$2;
		
		  strMonth=parseInt(strMonth,10)-1;
		  
		var strDate=RegExp.$3;
		   strDate=parseInt(strDate,10);
		var strHour=RegExp.$4;
		   strHour=parseInt(strHour,10);
		var strMinute=RegExp.$5;
		    strMinute=parseInt(strMinute,10);
		var tempDate=new Date(strYear,strMonth,strDate,strHour,strMinute,0);
		 return (tempDate.getFullYear()==strYear)&&(tempDate.getMonth()==strMonth)&&(tempDate.getDate()==strDate)&&(tempDate.getHours()==strHour)&&(tempDate.getMinutes()==strMinute);
}

function completeKey(e,src,cpath,width,bordercolor,kxflag){
	
	var keyc;
	if(window.event){
		keyc=e.keyCode;
	}else if(e.which){
		keyc=e.which;
	}

	if(keyc!=40 && keyc!=38){
		currentLine = -1;
		var http_request = null;
		var keyword = src.value;
		if(keyword.trim() !=""){
			if(window.XMLHttpRequest){ 
				http_request=new XMLHttpRequest(); 
				if(http_request.overrideMineType){ 
					http_request.overrideMineType("text/xml"); 
				} 
			}else if(window.ActiveXObject){ 
				try{ 
					http_request=new ActiveXObject("Msxml2.XMLHTTP"); 
				}catch(e){ //IE5.x 
					http_request=new ActiveXObject("Microsoft.XMLHTTP"); 
				} 
			} 
			http_request.open("GET",cpath+"/completeKey.ok?key="+encodeURI(keyword),true); 
			http_request.onreadystatechange=function(){
				if(http_request.readyState==4){ 
					if(http_request.status==200){ 
					 	var keystr= http_request.responseText;
						showCompleteKeys(keystr,cpath,src,width,bordercolor,kxflag);
					}else{ 
						//alert("ajax错误!"); 
						return ;
					} 
				} 
			}; 
			
			http_request.send(null);
		}else
			hiddenSearchKeyDiv();
		
	}
}

function  hiddenSearchKeyDiv(){
	var divSearchKey = document.getElementById("divSearchKey");
	if(divSearchKey != null)
		divSearchKey.style.display = "none";
}

function setSearchKeyValue(key){
	var keyword = document.getElementById("keyword");
	if(keyword != null)
		keyword.value = key;
}

function showCompleteKeys(keystr,cpath,obj,width,bordercolor,kxflag){
	if(keystr.length > 0){
		var keys = keystr.split(",,,");
		var msg = "";
		var namespace ="search";
		if(kxflag != null && kxflag == 1){
		 	namespace ="kxsearch";
		}
	
		for(var i =0;i<keys.length;i++){
			keys[i] = keys[i].replace("\\","\\\\");
			msg += "<a class='storejump' name='seachkeyjump'  onmouseover=\"setSearchKeyValue(\'"+keys[i]+"\')\" href='"+cpath+"/"+namespace+"/?keyword="+encodeURI(keys[i])+"'>"+""+keys[i]+"</a>";
		}
		msg = msg + "<a class='storejump' name='seachkeyjump' style='text-align:right;' href='javascript:void(0)' onclick='hiddenSearchKeyDiv();'>关闭&nbsp;&nbsp;</a>";
		showSearchKeyDiv(msg,obj,width,bordercolor);
	}else
		hiddenSearchKeyDiv();
}

function showSearchKeyDiv(msg,obj,width,bordercolor){
	var divname = creatDivWithId(msg,"divSearchKey");
	showMsgOfId(divname,obj,width,"white",bordercolor);
}
 
function dealKeydown(e,ename,sname){
	var it =  document.getElementsByName(sname); 
	var keyc;
	if(window.event){
		keyc=e.keyCode;
	}else if(e.which){
		keyc=e.which;
	}
	if(keyc==40 || keyc==38){
		if(keyc==40){
			if(currentLine<it.length-1){
				currentLine++;
				if(currentLine>=it.length-1){
					currentLine=-1;
				}
			}
			if(currentLine>=it.length-1){
				currentLine=-1;
			}
		}
		if(keyc==38){
			if(currentLine>=0){
				currentLine--;
				if(currentLine<=-1){
						currentLine=it.length-1;
				}
			}else{
				currentLine=it.length-1;
			}
		}
		set_style(currentLine,sname);
		if(currentLine>=0 && currentLine<it.length-1){			
			document.getElementById(ename).value = it[currentLine].childNodes[0].nodeValue.trim();
		}
		else{
			document.getElementById(ename).value = document.getElementById(ename).value.trim();				
		}
	}
}
function set_style(num,sname){
	var it =  document.getElementsByName(sname); 
	for(var i=0;i<it.length-1;i++){
		var li_node=it[i];
		li_node.className="storejump";
	}
	if(currentLine>=0 && currentLine<it.length-1){
		var i_node=it[currentLine];
		it[currentLine].className="highLi";
	}
}
//+++++++++++++++++++++++发站内信++++++++++++++++
	function showformMsg(touserid,tousrName){
	
		var islogin = document.getElementById("islogin").value; 
		if(islogin == "false" &&  loginResult == false){
				generateLoginDiv('cashLogin',600,320,'close');
			
				return ;
		 }
		
				 
		var msgForm_div="<div><form name=\"sendMsgForm\" method=\"post\"  >"+
						  "<input name=\"touserid\"    type=\"hidden\" id=\"touserid\">"+
					      "<input name=\"tousrName\"  type=\"hidden\" id=\"tousrName\">"+				 
						  "<div style=\"padding-left:10px;padding-top:10px;\">"+				   
						      "<div style=\"margin-bottom:5px; text-align:left;\"><span style=\"display:inline-block; width:50px;\">标题：</span><input style=\"width:260px;\" type=\"text\" name=\"title\" id=\"titie\"/></div>"+    					  
							  "<div style=\"text-align:left;\"><span style=\"vertical-align:top;display:inline-block; width:50px;\">内容：</span><textarea name=\"content\" id=\"content\" style=\"width:260px; height:80px;\" ></textarea></div>"+    					  
						  "</div>"+
						  "<div style=\"margin-top:5px; text-align:left; padding-left:60px;\">"+				       
						      "<input name=\"sumbit\" type=\"button\" value=\"确定\" id=\"sendsmsbtnsub\"  onclick=\"checkSendMsgForm();\" class=\"inputtext\">&nbsp;&nbsp;&nbsp;&nbsp;"+ 
						      "<input type=\"button\" value=\"取消\" onclick=\"closeJump()\" class=\"inputtext\"/>"+
						  "</div><div style=\"margin-top:15px; text-align:center; color:#FF6600;\" id=\"msgForm_alert\"></div>"+
						"</form></div>";				
		 tipsWindown('发送站内信',msgForm_div,'350','190','true');
		 
	    document.forms['sendMsgForm'].touserid.value =	touserid;	
		document.forms['sendMsgForm'].tousrName.value =	tousrName;	 
	
	}	
	
   function  checkSendMsgForm(){
	    
	      var titleDom = document.forms['sendMsgForm'].title;
	      var cashalert = "<img style=\"margin-right:6px;display:inline; vertical-align:middle;\" src=\""+contextPath+"/css/stbg/cashalert.gif\" />";		           		                   
	      if(titleDom.value ==""){
	       	$("#msgForm_alert").html("");
	       	$("#msgForm_alert").append(""+cashalert+"请输入标题");
	        titleDom.focus();
	        return;
	      }
	      var contentDom = document.forms['sendMsgForm'].content;
	      if(contentDom.value ==""){
	       	$("#msgForm_alert").html("");	      
			$("#msgForm_alert").append(""+cashalert+"请输入内容");
	        contentDom.focus();
	        return;	       
	      }
	     var touserid = document.forms['sendMsgForm'].touserid.value ;
	     var toUserName = document.forms['sendMsgForm'].tousrName.value ;
     
	     ThreadAction.sendMsg(touserid,toUserName,titleDom.value,contentDom.value,function(data){
	           var cashalert = "<img style=\"margin-right:6px;display:inline; vertical-align:middle;\" src=\""+contextPath+"/css/stbg/cashalert.gif\" />";		           		               
	          $("#msgForm_alert").html("");
	           if(data =='-1'){
	              $("#msgForm_alert").append(""+cashalert+toUserName+"还不是你的好友，请先加他为好友,并等对方确认");
	             return ;  
	           }else  if(data =='-2'){
	             $("#msgForm_alert").append(""+cashalert+"发送信息失败"+toUserName+"已把你列入了黑名单");
	             return ; 
	           }else  if(data =='-3'){
	             $("#msgForm_alert").append(""+cashalert+"不能给自己发信息");
	             return ; 
	           }
	           
             	 var msg_ok = "<img style=\"margin-right:6px;display:inline; vertical-align:middle;\" src=\""+contextPath+"/space/css/bluebg/msg_ok.gif\" />";		           		               	           
                $("#msgForm_alert").append(""+msg_ok+"发送信息成功");
                document.getElementById("sendsmsbtnsub").disabled = true;
                setTimeout("closeJump()",500);
	        });
	    
	    }
	
function SetCookie(name,value) {  //两个参数，一个是cookie的名子，一个是值  

     var Days = 30; //此 cookie 将被保存 30 天  
     var exp  = new Date();    //new Date("December 31, 9998");  
     exp.setTime(exp.getTime() + Days*24*60*60*1000);  
     document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+";path=/";  
 }
 
 function SetCookieWitnMinute(name,value,minute) {
     var exp  = new Date();  
     exp.setTime(exp.getTime() + minute*60*1000);  
     document.cookie = name + "="+ escape (value) + ";expires=" + exp.toGMTString()+";path=/";  
 } 
   
 function getCookie(name){ //取cookies函数          
  
     var arr = document.cookie.match(new RegExp("(^| )"+name+"=([^;]*)(;|$)"));  
      if(arr != null) return unescape(arr[2]); return null;  
   
 }  
 
 
 function delCookie(name)//删除cookie  
 {  
     var exp = new Date();  
     exp.setTime(exp.getTime() + 30*24*60*60*1000- 1*24*60*60*1000);  
     var cval=getCookie(name);  
     if(cval!=null) document.cookie= name + "="+cval+";expires="+exp.toGMTString()+";path=/";  
 }  
  
 
 
 function setMenuCookie(varname,menuflag,url){
 	
    SetCookie(varname,menuflag);
    if(url!=''){
     window.location.href = url;
     
    
    }
 
 }
 
    function validateMobile( moblieValue){
	
	   if(moblieValue.trim()==''){
	    return false;
	   }
		 
		var re =/^(13|15|18|14)[0-9]{9}$/;
	    if(!re.test(moblieValue)){
	    
	    	return false;
	    }else{
	    
	    	return true;
	    
	    }
   }
       
   function getRandamStr(length){
	    var rnd="";
	    for(var i=0;i<length;i++)
	        rnd+=Math.floor(Math.random()*10);
	    return rnd;
   }         
   
   
   // JavaScript Document
/*加入收藏*/
function addFavorite()
{

    if (document.all)
       {
       	 	window.external.addFavorite('http://www.51bi.com','51比购网');
       }
      else if (window.sidebar)
      {
         window.sidebar.addPanel('51比购网', 'http://www.51bi.com', "");
    }
}
/*设为首页*/
function setHomepage()
{
if (document.all)
    {
       document.body.style.behavior='url(#default#homepage)';
       document.body.setHomePage('http://www.51bi.com');
    }
    else if (window.sidebar)
    {
    if(window.netscape)
    {
         try
         { 
            netscape.security.PrivilegeManager.enablePrivilege("UniversalXPConnect"); 
         } 
         catch (e) 
         { 
            alert("该操作被浏览器拒绝，如果想启用该功能，请在地址栏内输入 about:config,然后将项 signed.applets.codebase_principal_support 值该为true"); 
            return false;
         }
    } 
    alert("您已将“51比购网”设为首页");
    var prefs = Components.classes['@mozilla.org/preferences-service;1'].getService(Components. interfaces.nsIPrefBranch);
    prefs.setCharPref('browser.startup.homepage','http://www.51bi.com');
}
}

/*优惠券的弹出框*/
function subCoupon(sele){
	var seleObj = document.getElementById('subCoupon');
	if(sele == 'over'){
		seleObj.style.display = 'block';
	}else{
		seleObj.style.display = 'none';	
	}
}
function introWeb(){
	var checkIntroWeb = getCookie('introWeb');
	var introWebID = document.getElementById('introWeb');
	if(checkIntroWeb != 'true'){
		generateLoginDiv('introWeb',676,505);
		introWebID.style.display = "block";
		document.getElementById('regEmail').focus();
		setTimeout("viewSpeUrl('introWeb');",120000);
	}
}

/* 菜单上的hover变背景图*/
function menuHover(thisObj){
	if(thisObj.className == ""){
		thisObj.className = "seleHover";
	}
}
function menuOut(thisObj){
	if(thisObj.className == "seleHover"){
		thisObj.className = "";
	}
}

/*返现商家的弹出框*/
function fanxianjump(sele){
	var seleObj = document.getElementById('jumpMenu');
	if(sele == 'over'){
		seleObj.style.display = 'block';	
	}else{
		seleObj.style.display = 'none';		
	}
}







