function LineBg(id,addcls,outcls){
$(id).hover(function(){ 
	$(this).addClass(addcls); $(this).removeClass(outcls); 
	}, function(){ 
	$(this).addClass(outcls); $(this).removeClass(addcls); 
   }); 	
}

function shopSelect(n){
	if(n==1){
		$("#newordershoplist").html(loadTxt()); $("#newordershoplist").slideDown("slow");
		$.get('/source/member_save.php?act=selshop&autoTime='+ new Date(),function(msg){ $("#newordershoplist").html(msg); })
	}else{
		$("#newordershoplist").slideUp("slow");
	}
}

function phbshow(num){
for(i=1;i<=4;i++){ $('#phb_tit_'+i).attr('class',''); $('#phb_con_'+i).css('display','none'); }
$('#phb_tit_'+num).attr('class','phnavcurr'); $('#phb_con_'+num).fadeIn("slow");
}

function SendEmail(){
$("#msgboxtext").html('<div style="font-size:12px; color:#999"><img src="/images/loding_1.gif" /> 验证邮件正在发送中，请稍等...</div>');
$.md({modal:'#msgbox'}); moveGrey('#msgbox','#msgbox_top');
$.get('/source/member_save.php?act=sendverifyemail&autoTime='+ new Date(),function(msg){ $("#msgboxtext").html(msg); })	
}

function selcity2(){
var pid=$("#area").val();
$.get('/source/member_save.php?act=selcity&pid='+ pid +'&autoTime='+ new Date(),function(msg){ $("#sel_area_2").html(msg); })
}

function FeedBackDel(id){
$("#msgboxtext").html(loadTxt()); $.md({modal:'#msgbox'}); moveGrey('#msgbox','#msgbox_top');
$.get('/source/member_save.php?act=feedbackdel&id='+ id +'&autoTime='+ new Date(),function(msg){ $("#msgboxtext").html(msg); })	
}

function FeedBackView(id){
$("#member_vmb").html(loadTxt()); $("#member_vmb").show(500);	
$.get('/source/member_save.php?act=feedbackview&id='+ id +'&autoTime='+ new Date(),function(msg){ $("#member_vmb").html(msg); })	
}

function MsgDel(id){
$("#msgboxtext").html(loadTxt()); $.md({modal:'#msgbox'}); moveGrey('#msgbox','#msgbox_top');
$.get('/source/member_save.php?act=msgdel&id='+ id +'&autoTime='+ new Date(),function(msg){ $("#msgboxtext").html(msg); })	
}

function MsgView(id){
$("#member_vmb").html(loadTxt()); $("#member_vmb").show(500);	
$.get('/source/member_save.php?act=msgview&id='+ id +'&autoTime='+ new Date(),function(msg){ $("#member_vmb").html(msg); })	
}

function saveavatar(str){
	$.get('/source/saveavatar.php?str='+str+'&autoTime='+ new Date(),function(msg){
		if(msg=='fail'){
		alert('头像保存失败，请返回重试！');	
		}
	})
}

function avatar_load(id){
$.get('/avatar/upload.php?uid='+id,function(msg){ $("#avatar_main").html(msg); })	
}

function logout(){
$("#msgboxtext").html(loadTxt());
$.md({modal:'#msgbox'}); moveGrey('#msgbox','#msgbox_top');
$.get('/save/member/logout',function(msg){ $("#msgboxtext").html(msg); })
}

function loadTxt(){
	return '<div style="font-size:12px; color:#999"><img src="/images/loding_1.gif" /> 数据正在加载中，请稍等...</div>'; 
}

//验证电子邮箱格式是否正确
function checkEmail(strEmail) {
if (strEmail.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) != -1)
return true; 
else
return false;
}

//POST数据
function savecls(cls,act,formid){
$("#msgboxtext").html('<div style="font-size:12px; color:#999"><img src="/images/loding_1.gif" /> 数据正在加载中，请稍等...</div>');
$.md({modal:'#msgbox'}); moveGrey('#msgbox','#msgbox_top');
$.ajax({type:"POST" , url:"/save/"+cls+"/"+act, data:$(formid).serialize(), dataType:"text", success: function(msg){
	$("#msgboxtext").html(msg);	
}});//end ajax
return false;
}

//去购物拿返利
function gotoshop(param,id){
	$('#tots').html('<img src="/images/loding_1.gif" /> 正在进入购物网站，请稍等...');
	if(param!='' || id!='')
	$.get('/to/'+param+'-'+id+'.html',function(msg){
		if(msg=='fail'){
		$("#tots").html('去购物失败，请返回重试！');
		}else if(msg=='end'){
		$("#tots").html('对不起，该网站已经停止返利！');
		}else{
		window.location.href=msg;
		//$("#tots").html(msg);
		}
	})
}

//星星评论形式开始
function starsem(idname){
var starStr='';
for(i=1;i<=5;i++){
	starStr+='<em id="sx'+ i +'_'+ idname +'" onmouseover="starcurr('+i+',\''+ idname +'\')"></em>';
}
starStr+='<span id="sxcn_'+ idname +'"></span><input name="sxval_'+ idname +'" id="sxval_'+ idname +'" type="hidden" value="0" />';
$('#star_'+idname).html(starStr);
}

function starcurr(id,idname){
	for(i=1;i<=id;i++){
	$('#sx'+i+'_'+idname).attr('class','starc');
	$('#sxcn_'+ idname).html(starname(id));
	$('#sxval_'+ idname).val(id);
	}
	for(k=5;k>id;k--){
	$('#sx'+k+'_'+idname).attr('class','');
	}
}

function starname(num){
temp='';
switch(num){
	case 1:
		temp='很糟糕'; break;
	case 2:
		temp='糟糕'; break;
	case 3:
		temp='一般'; break;
	case 4:
		temp='满意'; break;
	case 5:
		temp='非常满意'; break;
}
return temp;
}
//星星评论形式结束

//字符串实际长度，一个汉子等于两个字符
function strlen(str){
var len = str.length; 
var blen = 0; 
for(i=0; i<len; i++) { 
if ((str.charCodeAt(i) & 0xff00) != 0) { blen ++; } 
blen ++;
}
return blen;
}

//设置文本框颜色
$(document).ready(function(){
	$(".BGC").bind("focus",function(){$(this).attr("class","BGCKey"); });			
	$(".BGC").bind("blur",function(){$(this).attr("class","BGC");});			
});

function msgBoxStyle(){
document.write('<div id="msgbox"><div id="msgbox_top"><div id="msgbox_left" title="哎伊返利网"></div><div id="msgbox_right"></div><div id="msgbox_domain">www.cieie.com</div></div><table width="100%" border="0" cellspacing="0" cellpadding="0" id="msgbox_main"><tr><td height="150"><div id="msgboxtext"></div></td></tr></table></div>');	
}

function autocode(){
document.getElementById('autocodes').src='/code#t=' + new Date();
}
