﻿function show_menu(obj_s,obj){
	var  s_id = $(obj_s);
	s_id.style.display = "";
}
     	
function hide_menu(obj_h,obj){
	var  h_id = $(obj_h);
	h_id.style.display = "none";
}

function selectpage_onchange()
{
	location.href = "?page=" + f1.page.value;
}


function g(nodeId)
{
   return document.getElementById(nodeId);
}

//Trim()/
function LTrim(str){for (var k=0; str.length && str.charAt(k)<=" " ; k++) ;return str.substring(k,str.length);}
function RTrim(str){for (var j=str.length-1; j>=0 && str.charAt(j)<=" " ; j--) ;return str.substring(0,j+1);}
function Trim(str){return LTrim(RTrim(str));}

//检测数字和字母
function IsDigit(cCheck){return (('0'<=cCheck) && (cCheck<='9')); }  
function IsAlpha(cCheck){return ((('a'<=cCheck) && (cCheck<='z')) || (('A'<=cCheck) && (cCheck<='Z')))} 

//检测合法email;
function chkemail(a) {
	var emailReg = /^[\w-]+(\.[\w-]+)*@[\w-]+(\.[\w-]+)+$/; 
	if( emailReg.test(a) ){ 
	   return true; 
	}else{ 
	   return false; 
	} 
}

function trimTxt(txt)
{
   return txt.replace(/(^\s*)|(\s*$)/g, "");
}

//检查是否为空
function isEmpty(inputId)
{
   if(trimTxt(g(inputId).value)==''){return true}
   return false;
}

//非法字符过滤
function is_forbid(temp_str)
{
    temp_str=trimTxt(temp_str);
	temp_str = temp_str.replace('*',"@");
	temp_str = temp_str.replace('--',"@");
	temp_str = temp_str.replace('/',"@");
	temp_str = temp_str.replace('+',"@");
	temp_str = temp_str.replace('\'',"@");
	temp_str = temp_str.replace('\\',"@");
	temp_str = temp_str.replace('$',"@");
	temp_str = temp_str.replace('^',"@");
	temp_str = temp_str.replace('.',"@");
	//temp_str = temp_str.replace('(',"@");
	//temp_str = temp_str.replace(')',"@");
	//temp_str = temp_str.replace(',',"@");
	temp_str = temp_str.replace(';',"@");
	temp_str = temp_str.replace('<',"@");
	temp_str = temp_str.replace('>',"@");
	//temp_str = temp_str.replace('?',"@");
	temp_str = temp_str.replace('"',"@");
	temp_str = temp_str.replace('{',"@");
	temp_str = temp_str.replace('}',"@");
	//temp_str = temp_str.replace('[',"@");
	//temp_str = temp_str.replace(']',"@");
	var forbid_str=new String('@,%,~,&');
	var forbid_array=new Array();
	forbid_array=forbid_str.split(',');
	for(i=0;i<forbid_array.length;i++)
	{
		if(temp_str.search(new RegExp(forbid_array[i])) != -1)
		return false;
	}
	return true;
}

function login(){
    location.href="http://www.7c24.com/member/login.asp?backurl="+escape(location.href);
    return false;
}


function searchindex(){
   
   var kw = Trim(document.frmsch.kw.value);
   //alert(kw);
   if(kw.length<=1){
	   alert("请输入关键字");
	   return false;
   }else{
	   return true;
   }
 
}


function letme_fav(ctype,ctid,csts){

	if(!isNaN(ctid)){
	
		var akdiv=$(String('ak'+ctid));
		var url = '/action/letme_fav.asp';
		var pars = "dtid="+ctid+"&ctype="+ctype+"&csts="+csts+"&tmp=" + Math.random();
		var myAjax = new Ajax.Request(url,
		{
			onComplete:function(request) 
			{ 
				var ort=request.responseText
				if(ort.indexOf("ok")!=-1){
				   //alert(ort)
				   akdiv.innerHTML=ort
				   //window.location.reload()
				}else{
				  alert(ort)
				}
			}, 
			onLoading:function(request) 
			{ 
			  //Element.show('indicator_rv') 
			}, 
		evalScripts:true, method: 'post', parameters: pars
		}
		);
	
	}

}
