document.domain = document.location.host.split(".")[document.location.host.split(".").length-2]+'.'+document.location.host.split(".")[document.location.host.split(".").length-1];
var uploadPath = "http://image.saylikes.com/"; 
var warPath = "http://"+document.location.host;
var flashCropImageUrl = "";
var flashCropImageUserId = "";
var emailIsUse = false;
var realNameIsReal = false; 

function replaceAll(str,reStr){
	str = str.replace(/\&amp;*/g, "&");
	return str;
}

function loginToFullMusic(){
	$('h3',$('#basic-modal-content')).text('登录方可听完整首歌曲');
	$('#basic-modal-content').modal();
} 

function initAlbumBoxBySinger(ajaxDiv,singerid,startIndex,orderBy){
	if(ajaxDiv=='')
		ajaxDiv = 'albumList';
	var initComments_tempurl = '/singer/getAlbumListBySinger_saylikes.action?ajaxDiv='+ajaxDiv+'&orderBy='+orderBy+'&singer.id='+singerid+'&startIndex='+startIndex;
    
    $.ajax({
	  url: initComments_tempurl,
	  cache: false,
	  success: function(originalRequest){
	    $('#albumList').html(originalRequest);
	    var album_length = $('.album',$('#albumList')).size();
	    if(album_length<12){
			if(album_length<5){
				$('.left1,.right').css('height','294px');
			}else if(album_length<9){
				$('.left1,.right').css('height','494px');
			}
		}
	  }
	});
}
function ajaxpage(ajaxDiv,url){
	top.justChangeHash(url);
	if(url.indexOf('ajaxDiv')>0){
		$("#"+ajaxDiv).load(url,{},function(){
			$('.boxgrid.caption').hover(function(){
				$(".cover", this).stop().animate({top:'70px'},{queue:false,duration:160});
			}, function() {
				$(".cover", this).stop().animate({top:'115px'},{queue:false,duration:160});
			});
		}); 
	}else{
		$("#"+ajaxDiv).load(url,{'ajaxDiv':ajaxDiv},function(){
			$('.boxgrid.caption').hover(function(){
				$(".cover", this).stop().animate({top:'70px'},{queue:false,duration:160});
			}, function() {
				$(".cover", this).stop().animate({top:'115px'},{queue:false,duration:160});
			});
		}); 
	}
}

function ajaxpage_re(ajaxDiv,typeName,middleStr,downStr,startindex){
	var url = "/browse/"+typeName+"/"+middleStr+(downStr==""?"/all":"/"+downStr)+"/"+startindex;
	top.justChangeHash(url);
	url = "/"+ajaxDiv+url;
	$("#"+ajaxDiv).load(url,{},function(){
		$('.boxgrid.caption').hover(function(){
			$(".cover", this).stop().animate({top:'70px'},{queue:false,duration:160});
		}, function() {
			$(".cover", this).stop().animate({top:'115px'},{queue:false,duration:160});
		});
	}); 
}

function goToType(typeName,topId,middleStr){
   if(topId=="find")
   		top.koocuHref('/discover/'+typeName,true);
   else
   		top.koocuHref('/browse/'+typeName+'/'+middleStr,true);
}
function findMusic(typeid){
	document.location.href="/index/getRecommentAblum.action?typeId="+typeid;
}

function userRegister(div) {
	var email = document.getElementById("emailRegister").value;
	var password = document.getElementById("passwords").value;
	var realName = document.getElementById("realName").value;
	checkUserNameIsUser();
	checkUserName();
	if(document.getElementById('terms').checked){
		if(emailIsUse && checkPassword() && realNameIsReal) {
			if(div=='invite'){	//邀请注册
				var url = "/front/userRegister_saylikes2.action";
				jQuery.post(
				  url,{
						'inviteUser.id': document.getElementById('invite_user_id').value,
						'user.email': email,
						'user.passWord':password,
						'user.realName':realName
					},
				  function(originalRequest){
					  window.location.href = warPath+"/index.jsp#/front/userRegister_saylikes3.action";
				}); 
			}else{	//普通注册
				//var url = "/front/userRegister_saylikes.action?=" + encodeURI(email) + "&user.passWord=" + encodeURI(password) + "&user.realName=" + encodeURI(realName);
				var url = "/front/userRegister_saylikes.action";
				
				$("#"+div).load(url,{'user.email':email,'user.passWord':password,'user.realName':realName});
				
			}
		}
	}else{
		alert("您尚未同意《用户条款》，不可注册");
	}
} 
function checkPassword() {
	var password = document.getElementById("passwords").value;
	if (password.length < 6 || password == "" || password.length>15) {
		document.getElementById("checkPassword").innerHTML = "<span>密码有误（6到15位）。</span>";
		return false;
	} else {
		document.getElementById("checkPassword").innerHTML = "<p>请输入6到15位数字或者字母作为你的登陆密码。</p>";
		return true;
	}
} 

function checkUserNameIsUser() {
	var email = document.getElementById("emailRegister").value;
	if (email.charAt(0) == "." || email.charAt(0) == "@" || email.indexOf("@", 0) == -1 || email.indexOf(".", 0) == -1 || email.lastIndexOf("@") == email.length - 1 || email.lastIndexOf(".") == email.length - 1) {
		document.getElementById("checkEmail").innerHTML = "<span>请正确填写您的邮箱地址！</span>";
		return emailIsUse;
	}else{
		var url = "/front/checkUserName.action";
		//new Ajax.Request(url, {method:"POST", onComplete:checkEmail});
		$.ajax({
		  url: url,
		  type:'post',
		  data:"user.email=" + encodeURI(email),
		  cache: false,
		  success: function(originalRequest){
		    if (originalRequest == "USE") {
				document.getElementById("checkEmail").innerHTML = "<p>正确填写你的邮箱，作为你的登录名称以及接受我们的消息。</p>";
				emailIsUse = true;
			}else{
				document.getElementById("checkEmail").innerHTML = "<span>您的邮箱地址已被注册！</span>";
				emailIsUse = false;
			}
		  }
		});
		
	}
}  
function checkUserName(){
	var realName = document.getElementById("realName").value;
	if (realName.length >= 2 && realName.length < 20 ) {
		realName = realName.substring(0, 1);
		document.getElementById("checkRealName").innerHTML = "<p>你的名字，你的昵称为自己在Saylikes的旅行做一个记号。</p>";
		realNameIsReal = true;
	}else{
		document.getElementById("checkRealName").innerHTML = "<span>您的姓名填写有误，请确认</span>";
		realNameIsReal = false;
	}
}

function prieviewImg(imageName){
	document.getElementById('flash_say_iframe').src = uploadPath+"/ua/uploadImg.jsp?domain=koocu&inputSize=3";
	document.getElementById('img').src=uploadPath + imageName;
	document.getElementById('album.imagPath').value= imageName;
} 


function toUploadImage(typeId) {
// typeId==4 个人空间背景图片  typeId==3 专辑图片   typeId==2  个人头像 typeId==5  typeId=6 dtlogo
	var Browser_Name = navigator.appName;
	var doc;
	if (Browser_Name == "Microsoft Internet Explorer") {
		doc = document.frames["flash_say_iframe"].document;
	} else {
		doc = document.getElementById("flash_say_iframe").contentDocument;
	}
	var choose = doc.getElementById("files").value;
	var filename = choose.substring(choose.lastIndexOf("\\") + 1, choose.length);
	var dot = filename.lastIndexOf(".", filename.length);
	var ext = filename.substring(dot + 1, filename.length);
	ext = ext.toLowerCase();
	if (ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "png") {
		doc.form1.action = uploadPath + "/music/imageUpload.action?koocu=1&type=" + typeId;
		doc.form1.submit();
		if(document.getElementById("uploadLoadImag"))
			document.getElementById("uploadLoadImag").disabled = true;
		//document.getElementById("loadImage").innerHTML = "<img src=/images/ajax-loader.gif />";
	} else {
		alert("\u56fe\u7247\u683c\u5f0f\u4e0d\u6b63\u786e\uff01");
	}
} 

function uploadSingerImage(imageName){
	document.getElementById("flash_say_iframe").src = uploadPath +"/ua/uploadImg.jsp?domain=koocu&objId="+document.getElementById('singer_id').value;
	if(document.getElementById("uploadLoadImag"))
		document.getElementById("uploadLoadImag").disabled = false;
	document.getElementById("singer_image").value= imageName;
}
function uploadDtLogo(imageName){
	var url='/dt/changeDt.action';
	jQuery.post(
	  url,{
			'dt.id': document.getElementById('dt_id').value,
			'dt.imgPath': imageName
		},
	  function(originalRequest){
		  window.location.reload();
	}); 
}

function finishEditSinger(){
	if(document.getElementById("uploadLoadImag").disabled==true)
		alert('图片还没有上传完成，请稍等');
	else
		if(document.getElementById("singer_name")!=''&&document.getElementById("singer_introduction")!=''){
			url = '/singer/editSinger_saylikes.action';
			jQuery.post(
			  url,{
					'singer.id': document.getElementById('singer_id').value,
					'singer.name': document.getElementById('singer_name').value,
					'singer.introduction': document.getElementById('tex-input').value,
					'imageName': document.getElementById('singer_image').value,
					'singer.recommendImgPath':document.getElementById('singer_recommend_image').value,
					'singer.isPublish':document.getElementById('isPublish').checked?1:0,
					'isCombine':document.getElementById('isCombine').checked?1:0,
					'toCombineId':document.getElementById('toCombineId').value,
					'singer.type.id':document.getElementById('singer.type.id').value,
					'singer.state':document.getElementById('singer_state').checked?1:0
				},
			  function(originalRequest){
			  	if(originalRequest==null||originalRequest==''){
			  		window.location.reload();
			  	}else{
			  		//window.location.href='/index/singerDetail.action?singer.id='+originalRequest;
					top.koocuHref('/artist/'+originalRequest,true);
				}
			}); 
		}
}


function changeImageToUserHeadIndexResult(originalRequest) {
	var url = "/user/preChangeImageToUserHead.action?image.id=" + originalRequest.responseText + "&ajax_return_str=aaa";
	//new Ajax.Updater({success:"register2"}, url, {asynchronous:true, evalScripts:true});
	$("#register").load(url); 
} 

function flashCropImage(cropstr) {
	document.getElementById("crop").value = cropstr;
	document.getElementById("changImageToUserHead").src = uploadPath + flashCropImageUrl + "&crop=" + cropstr+"&domain=koocu";//"/music/cropImage.action?crop="+cropstr+"&user.id=<ww:property value='user.id' />&image.id=<ww:property value='image.id' />"
}
function updateUserHeads(imageName) {
	var url = "/user/changeImageToUserHead_saylikes.action?imageName=" + imageName;
	$.ajax({
		  url: url,
		  cache: false,
		  method:"POST",
		  success: function(originalRequest){
		     cropImagesuccess(originalRequest);
		  }
		});
}
function cropImagesuccess(originalRequest) {
	//hideScreen("register2");
	//document.getElementById("cropImage").innerHTML = "<img src='http://image.koocu.com/image/userUploadImage/" + flashCropImageUserId + ".jpg' />";
	//showScreen("register4");
	if(document.getElementById('userHeadImg_logo') != null){
		var img = document.getElementById('userHeadImg_logo').src;
		document.getElementById('userHeadImg_logo').src = img+'?time=9';
		top.koocuHref("/people/"+top.getId(),true);
	}else{
		window.location.href = "/index/changeImgToIndex_saylikes.action"
	}
} 

var commentType = 0; //0 评论   1评论的评论
var parentId = '';//父评论
var _userId = 0;
function addComment(){
   var toAlbumId = document.getElementById("comment_album_id").value;
    if(commentType == 0){
	     if(document.getElementById("loginSuccess")!=null){
	     	 var context = document.getElementById("commentContext").value;
		  	  context = context.replace(/&/g,'%26');
		      var order = 'desc';
		      if(!checkspace(context)){
		         if(getBytesCount2(context) > 2000){
		            alert('一次最多输入2000个汉字，或4000个英文字母！'); 
		         }if(getBytesCount2(context) < 6){
		            alert('一次最少输入3个汉字，或6个英文字母！');
		         }else{
				  	  var url = '/music/saveComment_saylikes.action';
				  	   var data = {'ajaxDiv':'comments',
						  			'userOperate.toAblum.id':toAlbumId,
						  			'userOperate.content':context,
						  			'orderBy':order
						  			};
				  	  comment_ajax(url,data);
			  	 }
		  	  }else{
		  	      alert('请输入内容！');
		  	  }
		  	  document.getElementById("commentContext").value = "";
	  	}else{
	  		$('#basic-modal-content').modal();
	  	}
  	}else{
  	   if(document.getElementById("loginSuccess")!=null){
	      var context = document.getElementById("commentContext").value;
	      context = context.substring(context.indexOf("：")+1,context.length);
	      context = context.replace(/&/g,'%26');
	      var order = 'desc';
	  	  var url = '/music/saveComment_saylikes.action';
		  var data = {'userOperate.toUser.id':_userId,
		  			'ajaxDiv':'comments',
		  			'typeStr':'ablumCom',
		  			'userOperate.toAblum.id':toAlbumId,
		  			'userOperate.commentParent.id':parentId,
		  			'userOperate.content':context,
		  			'orderBy':order
		  			};
		  	  if(!checkspace(context)){
			  	 if(getBytesCount2(context) > 2000){
		            alert('一次最多输入2000个汉字，或4000个英文字母！'); 
		         }else{
			  	       comment_ajax(url,data);
			  	       commentType = 0;
			  	       document.getElementById("commentContext").value="";
			  	   }
		  	  }else{
		  	    	alert('请输入评论内容！');
		  	  }
		}else{
	  		$('#basic-modal-content').modal();
	    }
	 }
	 
	 
  }
  
  
  function comToCom(comId,userName,userId){
     document.getElementById("commentContext").value="回复"+userName+"的评论：";
     commentType = 1;
     parentId = comId;
     _userId = userId;
     document.getElementById("commentContext").focus();
  }
  
  function comment_ajax(url,data){
  	 //$("#comments").load(url);
	 var nscrolltop=parseInt($(top.window).scrollTop());
  	 $("#comments").load(url, data, function(){
    	sethash_2();
		$(top.window).scrollTop(nscrolltop+20);
 	 });  
  }
function checkspace(checkstr) {
	var str = "";
	for (i = 0; i < checkstr.length; i++) {
	str = str + " ";
	}
	return (str == checkstr);
} 
function checkToLogins(){
	var loginUserName = document.getElementById('userEmail').value;
	var loginPassword = document.getElementById('loginPassword').value;
	if(checkspace(loginUserName)){
		alert('用户名不能为空！');
		return false;
	}else if(checkspace(loginPassword)){
		alert('密码不能为空！');
		return false;
	}else{
		login(loginUserName,loginPassword,'','');
	}
	return false;
} 

var cookieUser,cookiePwd,isCookie;
function login(tempUser,tempPassword,isRememberCookie,goToUrl) {
	var cookeSave = "";
	if(isRememberCookie){
	  cookeSave = "month";
	}
	if (checkspace(tempUser)){
		alert('\u8bf7\u8f93\u5165\u7528\u6237\u540d\uff01');
	} else {
		if (checkspace(tempPassword)) {
			alert('\u8bf7\u8f93\u5165\u5bc6\u7801\uff01');
		} else {
			var url =  "/front/loginUser.action";
			cookieUser = tempUser;
			cookiePwd = tempPassword;
			jQuery.post(
			  url,{
					'user.email': tempUser,
					'user.passWord': tempPassword,
					'goToUrl': goToUrl
				},
			  function(originalRequest){
			  		if (originalRequest != "LOGINERROR") {
						if(document.getElementById('remember')==null?false:document.getElementById('remember').checked){
							//获得密码加密字符串
					    	var url =  '/front/encryptionStr.action';
							jQuery.post(
							  url,
							  {
							  	'user.passWord': tempPassword
							  },
							  function(originalRequest){
								   //设置cookie
								   setCookies('koocuUserName',tempUser,24*60*365);
								   setCookies('koocuUserPassword',originalRequest,24*60*365);
								   $.modal.close();
								   window.location.reload();
							  }); 
						}else{
							window.location.reload();
							$.modal.close();
							
						}
					} else {
					    document.getElementById('loginPassword').value = "";
						alert('\u7528\u6237\u540d\u6216\u5bc6\u7801\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u767b\u9646\uff01');
					}
			  }); 
		}
	}
}

function setLoginMessage(originalRequest) {
	if (originalRequest != "LOGINERROR") {
		if(document.getElementById('remember')==null?false:document.getElementById('remember').checked){
			setCookies('koocuUserName',email,24*60*365);
			setCookies('koocuUserPassword',originalRequest,24*60*365);
		}
		$.modal.close();
		window.location.reload();
	} else {
	    document.getElementById('loginPassword').value = "";
		alert('\u7528\u6237\u540d\u6216\u5bc6\u7801\u6709\u8bef\uff0c\u8bf7\u91cd\u65b0\u767b\u9646\uff01');
	}
}

function getBytesCount2(str){
	if (str == null){
		return 0;
	}else{
		return (str.length + str.replace(/[\u0000-\u00ff]/g, "").length);
	}
} 

function exitLogin() {
	var url =  "/front/exitLogin.action";
	delCookies('koocuUserName');
	delCookies('koocuUserPassword');
	$.ajax({
	  url: url,
	  cache: false,
	  type:"POST",
	  success: function(originalRequest){
	     window.top.location.href = "/";
	     //window.parent.location.href = "/index.jsp";
	  }
	});
	
} 
function exitXnLogin() {
	var url =  "/front/exitLogin.action";
	delCookies('koocuUserName');
	delCookies('koocuUserPassword');
	$.ajax({
	  url: url,
	  cache: false,
	  type:"POST",
	  success: function(originalRequest){
	     //window.location.href = "/page/xn/logOut.jsp?returnUrl=/index.jsp";
	     window.parent.location.href = "/page/xn/logOut.jsp?returnUrl=/index.jsp";
	  	
	  }
	});
} 

function delCookies(name) {
	var expire = "";
	expire = new Date((new Date()).getTime() -1000);
	expire = "; expires=" + 0;
	document.cookie = name + "=" + escape('') + expire + ";path=/";
}

//收藏专辑
var p_ablumId = "";
var p_musicId=0;
var p_photoId = 0;
var p_ablumName = "";
var fav_type = "";
var load = 0;
function repCollectionAblum(ablumId){
	// document.getElementById('koocumy').innerHTML = '+1';

	p_ablumId = ablumId;
	load = 1;
	checkIsHaveFav(ablumId);
}
function checkIsHaveFav(ablumId){
	p_ablumId = ablumId;
	var url = '/music/ckHaveFav.action?ablum.id='+ablumId;
	//new Ajax.Request(url,{method: 'POST',onComplete:checkIsHaveFavResult});
	$.ajax({
	  url: url,
	  cache: false,
	  type:"POST",
	  success: function(originalRequest){
	     checkIsHaveFavResult(originalRequest);
	  }
	});
} 

function checkIsHaveFavResult(originalRequest){
	if(originalRequest=='needToLogin'){
		$('#basic-modal-content').modal();
	}else{
		var isFav = originalRequest.substring(0,originalRequest.indexOf('_'));
		var ablumId = originalRequest.substring(originalRequest.indexOf('_')+1,originalRequest.length);
		if(isFav=='true'){ //没有收藏过
			if(load == 1){
				//showScreen("koocuping");
				//parent.showDiv('basic-modal3-content');
				
				getUserCollectionTag('userFavTag');
				//document.getElementById('favTagAblumName').innerHTML = '收藏专辑';
			}
		}else{ //已经收藏过
			if(load == 1){ //点击喜欢时已经喜欢过
				alert('您已经喜欢过该专辑');
			}else{ //页面加载时 判断是否已经收藏过
				document.getElementById("heartType").className = "main_brcc ulrbx2";
				document.getElementById("divCanDig").innerHTML = "<a href='javascript:dropLikeAblum("+p_ablumId+")'>不喜欢</a>";
			}
		}
	}
} 

function getUserCollectionTag(div){
	var url = "";
	if(div == 'userFavTag'){
		url = "/user/userFavTag_saylikes.action?typeStr=favTagAblum&_t="+new Date().getTime();
		fav_type = 'album';
	}else if(div=='userFavTag-music'){
		url = "/user/userFavTag_saylikes.action?typeStr=favTagMusic&_t="+new Date().getTime();
		fav_type = 'music';
	}else if(div == 'userFavTag-photo'){
		url = "/user/userFavTag_saylikes.action?typeStr=favTagPhoto&_t="+new Date().getTime();
		fav_type = 'photo';
		$('#love_photo_title').text('为喜欢的照片添加快速标签');
		$('#love_photo_description').text('把你喜欢的照片进行自己的快速分类方便你管理喜欢的照片。多个标签逗号分割。');
	}
	//new Ajax.Updater({success:div}, url, {asynchronous:true, evalScripts:true});
	$('#userFavTag').load(url,function(){$('#basic-modal3-content').modal();});
} 

function setUserCollectionTag_saylikes(tagName){
	document.getElementById('tag').value = tagName;
} 

 function fav_saylikes(){
	var favTag = document.getElementById('tag').value;
	favTag = favTag.replace(/&/g,'%26');
	if(fav_type=="album"){
		var url = '/music/favAblum.action';
		jQuery.post(
		  url,{
				'ablum.id': p_ablumId,
				'favTagStr': favTag
			},
		  function(originalRequest){
		     if(originalRequest == 'sorry'){
		     	alert('对不起，你今日的心情，已经使用耗尽');
		     }else{
			  	collectionAblumResult(originalRequest);
			 }
		}); 
	}else if(fav_type=="music"){
		var url='/music/favMusic.action';
		jQuery.post(
		  url,{
				'ablummusic.id': p_musicId,
				'favTagStr':favTag
			},
		  function(originalRequest){
		    if(originalRequest == 'sorry'){
		    	 alert('对不起，你今日的心情，已经使用耗尽');
		    }else{
				 $.modal.close();
				 document.getElementById('tag').value = "";
				 heart_show(1);
				 $('#like_span_'+p_musicId).removeClass();
				 $('#like_span_'+p_musicId).addClass("insteadpicture2");
				 $('#like_span_'+p_musicId).text(parseInt($('#like_span_'+p_musicId).text())+1);
			}
		}); 
	}else if(fav_type =="photo"){
		var url='/photo/favPhoto.action';
		jQuery.post(
		  url,{
				'photo.id': p_photoId,
				'favTagStr':favTag
			},
		  function(originalRequest){
		    if(originalRequest == 'sorry'){
		    	 alert('对不起，你今日的心情，已经使用耗尽');
		    }else{
				 $.modal.close();
				 document.getElementById('tag').value = "";
				 heart_show(1);
				 $('#likeOrunlike').removeClass(); 
				 $('#likeOrunlike').addClass("likeOrunlike");
				 $('#likeOrunlike').html($('#likeOrunlike').html().replace('喜欢它','不喜欢').replace('+','-'));
				$('#photo_like_count').text('('+(parseInt($('#photo_like_count').text().replace('(','').replace(')','').replace('人',''))+1)+"人)");
				
			}
		}); 
	}
}

function collectionAblumResult(originalRequest){
	$.modal.close();
	heart_show(1);
	document.getElementById('tag').value = "";
	if(originalRequest != '您之前已收藏该专辑'){
		
		digAlbum(p_ablumId,'digCountNum','like');
	}
} 
var numId = ''; //显示数字的Id
var pp_ablumId = "";
var p_type = ""; 
function digAlbum(ablumId,back_Show_Dig_Num_Id,type){
	pp_ablumId = ablumId;
	p_type = type;
	numId = back_Show_Dig_Num_Id;
	if(type == 'like'){
	var url = '/music/digAblum.action?ablum.id='+ablumId;
	}else{
	var url = '/music/digAblum.action?ablum.id='+ablumId+'&type='+type;
	}
	//new Ajax.Request(url,{method: 'POST',onComplete:showDigNum});
	$.ajax({
	  url: url,
	  cache: false,
	  method:"POST",
	  success: function(originalRequest){
	     showDigNum(originalRequest);
	  }
	});
}
function showDigNum(originalRequest){
    if($('#guodu_plaza').size()>0){
    	if(p_type == 'like'){
			$('#like_span_album_'+pp_ablumId).removeClass().addClass("insteadpicture2");
			$('#like_span_album_'+pp_ablumId).text(parseInt($('#like_span_album_'+pp_ablumId).text())+1); 
			heart_show(1);
		}else{
			$('#like_span_album_'+pp_ablumId).removeClass().addClass("insteadpicture1");
			$('#like_span_album_'+pp_ablumId).text(parseInt($('#like_span_album_'+pp_ablumId).text())-1); 
			heart_show(2);
		}
    }else{
		document.getElementById(numId).innerHTML = "("+originalRequest+")";
		if(p_type == 'like'){
			document.getElementById('basic-modal3').innerHTML = "<a href='javascript:void(0)' onclick='javascript:dropLikeAblum("+pp_ablumId+")' class='like_album_menu'>不喜欢</a>";
		}else{
			document.getElementById('basic-modal3').innerHTML = "<a href='javascript:void(0)' onclick='javascript:repCollectionAblum("+pp_ablumId+")' class='like_album_menu basic3'>喜欢它</a>";
		}
		//changem();
		toDigUsers('top20',pp_ablumId);
	}
} 

 function toDigUsers(type,albumId){
	if(type == 'top20'){
	var url = '/music/getDigAblumUsers_saylikes.action?ablum.id='+albumId+'&type='+type;
	}else{
	var url = '/music/getDigAblumUsers_saylikes.action?ablum.id='+albumId+'&type='+type;
	}
	//new Ajax.Updater({success:"digAblumUser"},url, {asynchronous:true, evalScripts:true});
	$('#digAblumUser').load(url);
} 

function dropLikeAblum(ablumId){
    document.getElementById('basic-modal3').innerHTML = "<a href='javascript:void(0)' onclick='javascript:repCollectionAblum("+pp_ablumId+")' class='like_album_menu basic3'>喜欢它</a>";
    heart_show(2);
    digAlbum(ablumId,'digCountNum','unLike');
    //toDigUsers('top20');
}


var toUploadRecommImage_album_id =0;
function toUploadRecommImage(id,type){
	var Browser_Name = navigator.appName;
	var doc;
	var iframeName="flash_say_iframe";
	if(type=='singer')
		iframeName = iframeName+"_"+type;
	if (Browser_Name == "Microsoft Internet Explorer") {
		doc = document.frames[iframeName].document;
	} else {
		doc = document.getElementById(iframeName).contentDocument;
	}
	var choose = doc.getElementById("files").value;
	var filename = choose.substring(choose.lastIndexOf("\\") + 1, choose.length);
	var dot = filename.lastIndexOf(".", filename.length);
	var ext = filename.substring(dot + 1, filename.length);
	ext = ext.toLowerCase();
	if (ext == "jpg" || ext == "jpeg" || ext == "gif" || ext == "png") {
		doc.form1.action = uploadPath + "/music/recom_image_upload.action?domain=koocu&objType="+type;
		doc.form1.submit();
		if(type=='singer')
			document.getElementById("uploadLoadrecommendImag").disabled = true;
		else
			document.getElementById("uploadLoadImag").disabled = true;
	} else {
		alert("\u56fe\u7247\u683c\u5f0f\u4e0d\u6b63\u786e\uff01");
	}
} 

function change_recom_Ablum_image_upload(imageName) {
	toUploadRecommImage_album_id = document.getElementById('toUploadRecommImage_album_id').value;
	var imageExplain = "";
	var url = "/index/recom_Ablum_image_upload.action?imageName=" + imageName+"&album.id="+toUploadRecommImage_album_id ;
	//new Ajax.Request(url, {method:"POST", onComplete:changeImageToUserHeadIndexResult});
	$.ajax({
	  url: url,
	  cache: false,
	  method:"POST",
	  success: function(originalRequest){
	  	$.modal.close();
	  }
	});
}

function change_recom_singer_image_upload(imageName) {
	document.getElementById("flash_say_iframe_singer").src = uploadPath +"/ua/uploadRecommendImg.jsp?domain=koocu&objId="+document.getElementById('singer_id').value;
	if(document.getElementById("uploadLoadrecommendImag"))
		document.getElementById("uploadLoadrecommendImag").disabled = false;
	document.getElementById("singer_recommend_image").value= imageName;
}

//判断是否是登陆 跳转
function checkIsLoginGoToUrl(goToUrl){
     window.location.href = goToUrl;
}

function PreFavMusic(musicId){	
	var url='/music/musicTest_saylikes.action?ablummusic.id='+musicId+'&time='+(new Date()).toString();
	p_musicId = musicId;
	$.ajax({
	  url: url,
	  cache: false,
	  method:"POST",
	  success: function(originalRequest){
	  	showCollectionMusicResult(originalRequest);
	  }
	});
}


//如果音乐被收藏过则提示
function showCollectionMusicResult(originalRequest){
	if(originalRequest=='needToLogin'){
		$('#basic-modal-content').modal();
	}else{
		if(originalRequest=='faved'){
			$('#like_span_'+p_musicId).removeClass(); 
			$('#like_span_'+p_musicId).addClass("insteadpicture1");
			$('#like_span_'+p_musicId).text(parseInt($('#like_span_'+p_musicId).text())-1);
			heart_show(2);
		}else{
			//$('#basic-modal3-content').modal();
			getUserCollectionTag("userFavTag-music");
		}
	}	
}

function getBackMessage(userid){
    var userSpacecomments_tempurl = '/user/getBackMessage.action?ajaxDiv=userSpacecomments&user.id='+userid;
    $('#userSpacecomments').load(userSpacecomments_tempurl);
    //new Ajax.Updater({success:"userSpacecomments"}, userSpacecomments_tempurl, {asynchronous:true, evalScripts:true});  		
}
function initComments(userid){
	var initComments_tempurl = '/user/getBackMessage_saylikes.action?ajaxDiv=comments&user.id='+userid;
    $("#comments").load(initComments_tempurl, {}, function(){
    	sethash_2();
 	}); 
}

function initAlbumBox(userid,typeStr,orderBy){
	var initComments_tempurl = '/user/getAlbumListByUser_saylikes.action?orderBy='+orderBy+'&typeStr='+typeStr+'&user.id='+userid;
    $('#albumList').load(initComments_tempurl);
}

function selectchange(obj){
	$('li',$('.list_menu')).each(function(){
		$(this).removeClass().addClass('no_select');
	});
	$('#albumByFavTag').css({ display: 'none'});
	obj.parent().removeClass().addClass('selected');
}

function changeTET() {
	if (document.getElementById('kbee2').style.display == "none") {
		document.getElementById('kbee2').style.display = "";
		document.getElementById('userTitle').value = document.getElementById('innerUserTitle').innerHTML.replace(/&nbsp;/g,' ').trim();
	} else {
	    document.getElementById('kbee2').style.display = "none";
	}
}
function saveTitle(){
    var titleStr = document.getElementById('userTitle').value;
    titleStr = titleStr.replace(/</g,'《').replace(/>/g,'》');
    var url = "/user/upUserTitle.action";
    //new Ajax.Request(url, {method:"POST", onComplete:saveTitleResult});
    $.ajax({
	  url: url,
	  cache: false,
	  type:"POST",
	  data:'user.remark='+titleStr,
	  success: function(originalRequest){
	  	saveTitleResult(originalRequest);
	  }
	});
}
function saveTitleResult(originalRequest){
   if(originalRequest == 'success'){
       document.getElementById('innerUserTitle').innerHTML = document.getElementById('userTitle').value.replace(/</g,'《').replace(/>/g,'》');
       changeTET();
   }
}
function preSendMessage(rootid){
	$('#basic-modal4-content').modal();
}

var commentedUser = "";  //被回复的评论的  用户Id

function addComment_float(userId){
  var Whispering = 0; //悄悄话  为1
  if(document.getElementById("Whispering") != null && document.getElementById("Whispering").checked){
     Whispering = 1; 
  }
  if(commentType == 0){
    if(document.getElementById("loginSuccess").innerHTML != ""){
 	  var context = document.getElementById("commentContext").value;
 	  context = context.replace(/&/g,'%26');
     if(!checkspace(context)){
        if(getBytesCount2(context) > 400){
           alert( '一次最多输入200个汉字，或400个英文字母！' );
        }if(getBytesCount2(context) < 6){
           alert( '一次最少输入3个汉字，或6个英文字母！' );
        }else{
             var url = "";
             var data = null;
          if(document.getElementById('imageComment') != null){
                url = '/user/backMessage_saylikes.action';
		  		data = {'userOperate.toImage.id':document.getElementById('imageComment').value,
		  				'typeStr':'image',
		  				'ajaxDiv':'userSpacecomments',
		  				'userOperate.toUser.id':userId,
		  				'userOperate.content':context,
		  				'orderBy':'desc',
		  				'user.id':userId,
		  				'userOperate.IsShow':Whispering
		  			};
		  }else{  
	  	   	    url = '/user/backMessage_saylikes.action';
	  	  		data = {'ajaxDiv':'userSpacecomments',
	  	  				'userOperate.toUser.id':userId,
	  	  				'userOperate.content':context,
	  	  				'orderBy':'desc',
		  				'user.id':userId,
		  				'userOperate.IsShow':Whispering
		  			};
	  	  
	  	  }
	  	  comment_ajax_float(url,userId,data);
  	  }
 	  }else{
 	     alert('请输入内容！');
 	  }
 	  document.getElementById("commentContext").value = "";
 	}else{
 	  $('#basic-modal-content').modal();
 	}
	}else{
	   if(document.getElementById("loginSuccess").innerHTML != ""){
     var context = document.getElementById("commentContext").value;
     context = context.substring(context.indexOf("：")+1,context.length);
     context = context.replace(/&/g,'%26');
     var url = "";
     var data  = null;
     if(document.getElementById('imageComment') != null){
        var imageId = document.getElementById('imageComment').value;
        
        url = '/user/backMessage_saylikes.action';
     	data = {'userOperate.toImage.id':imageId,
		  				'typeStr':'comImage',
		  				'ajaxDiv':'userSpacecomments',
		  				'userOperate.toUser.id':commentedUser,
		  				'userOperate.commentParent.id':parentId,
		  				'userOperate.content':context,
		  				'orderBy':'desc',
		  				'user.id':userId,
		  				'userOperate.IsShow':Whispering
		  			};
     }else{
 	    url = '/user/backMessage_saylikes.action';
  		data = {'ajaxDiv':'userSpacecomments',
  				'userOperate.toUser.id':commentedUser,
		  		'userOperate.commentParent.id':parentId,
		  		'userOperate.content':context,
		  		'orderBy':'desc',
		  		'user.id':userId,
		  		'userOperate.IsShow':Whispering		
		};
  	
  	}	 
  	  if(!checkspace(context)){
	  	   if(getBytesCount2(context) > 400){
	            alert( '一次最多输入200个汉字，或400个英文字母！' );
	       }
	       if(getBytesCount2(context) < 6){
            	alert( '一次最少输入3个汉字，或6个英文字母！' );
           }else{
	  	       comment_ajax_float(url,userId,data);
	  	       commentType = 0;
	  	       document.getElementById("commentContext").value="";
	  	   }
  	  }else{
  	  	alert( '请输入评论内容！' );
  	  }
}else{
 	  $('#basic-modal-content').modal();
   }
}
}
  
function comToCom_float(comId,userName,comUserId,state){
   commentType = 1;
   parentId = comId;
   commentedUser = comUserId;
   $('#basic-modal4-content').modal();
   document.getElementById("commentContext").value="回复"+userName+"的评论：";
   if(state == 1){
   		document.getElementById("Whispering").checked = true;
   		document.getElementById("Whispering").disabled="disabled"; 
   }
}
function comment_ajax_float(url,userId,data){
	
	jQuery.post(
	  url,data,
	  function(originalRequest){
		if(originalRequest=='Login'){
			$.modal.close();
			$('#basic-modal-content').modal();
		}else{
		  innitSpaceMessage(userId,1);
	  	  $.modal.close();
		}
	}); 


}




 function updateUserSpaceBgImg(imageName){
    var spaceStyle = 'url('+uploadPath+imageName+')';
    var url = "/user/saveUserSpaceStyle.action?spaceName="+spaceStyle;
    $.ajax({
	  url: url,
	  cache: false,
	  method:"POST",
	  success: function(originalRequest){
	  	document.getElementById('flash_say_iframe').src = uploadPath+"/ua/uploadImg.jsp?domain=koocu&inputSize=88&inputHeight=36";
	  	$.modal.close();
	  	boyd(spaceStyle);
	  }
	});
 }

function boyd(a) {
	top.document.body.style.backgroundImage = a; 
	top.document.body.style.backgroundPosition = '50% 0%';
	top.document.body.style.backgroundRepeat = 'repeat';
}


function addOrRemoveFriends(userid,type){
	var url = "/user/addFriends.action?user.id="+userid+"&keyValue.id="+type;
	//new Ajax.Request(url,{method:'POST',onComplete:resultAddFriends});
	_userId = userid;
	$.ajax({
	  url: url,
	  cache: false,
	  method:"POST",
	  success: function(originalRequest){
	  	resultAddFriends(originalRequest);
	  }
	});
}
function resultAddFriends(originalRequest){
	if($('#guodu_plaza').size()>0){
		if(originalRequest  == "addFriendSucess"){
			$("#addOrRemoveFirend_Div_"+_userId).html('<a href="javascript:void(0)" onclick="addOrRemoveFriends('+_userId+',2);"><div class="add_friend2"></div></a>');
		}else if(originalRequest  == "removeFriendSucess"){
			$("#addOrRemoveFirend_Div_"+_userId).html('<a href="javascript:void(0)" onclick="addOrRemoveFriends('+_userId+',1);"><div class="add_friend1"></div></a>');
		}
	}else{
		if(originalRequest  == "addFriendSucess"){
			alert( '好友添加成功' );
			$("#addOrRemoveFirend_Div").html('&nbsp;&nbsp;<a href="javascript:void(0)" onclick="addOrRemoveFriends('+_userId+',2);" title="移除好友" id="addOrRemoveFirend_A"><img src="/image/remove_friend.png" /></a>');
		}else if(originalRequest  == "removeFriendSucess"){
			alert( '好友移除成功' );
			$("#addOrRemoveFirend_Div").html('&nbsp;&nbsp;<a href="javascript:void(0)" onclick="addOrRemoveFriends('+_userId+',1);" title="加为好友" id="addOrRemoveFirend_A"><img src="/image/add_friend.png" /></a>');
		}
	}
} 

function showChild(typeid,categoryid,span){
	if(typeid==1||typeid==6||typeid==7){
		$('#'+span).html('');
	}else{
		var url = "/ua/getAblumType_saylikes.action?typeId="+typeid+"&category.id="+categoryid;
		$('#'+span).load(url);
	}
}

function editAlbum(){
	if(!document.getElementById('terms').checked){
		alert("您尚未同意《发布专辑条款》，不可修改");
	}else{
		var albumName = document.getElementById('album.name').value;
		var singerName = document.getElementById('singer.name').value;
		var albumDescribe = document.getElementById('album.describe').value;
		var albumImage = document.getElementById('album.imagPath').value;
		var albumType = document.getElementById('album.type.id').value;
		if(albumType == 'null'){
			alert('请选择专辑分类！');
		}else if(albumName.replace(/(^\s*)|(\s*$)/g, "")==''){
			alert('请填写专辑名称！');
		}else if(singerName.replace(/(^\s*)|(\s*$)/g, "")==''){
		    alert('请填写艺术家名称！');
		}else if(albumDescribe.replace(/(^\s*)|(\s*$)/g, "")==''){
		    alert('请填写专辑介绍！');
		}else if(albumImage.replace(/(^\s*)|(\s*$)/g, "")==''){
			alert('请上传专辑封面图片！');
		}else{
			document.getElementById('submitButton').innerHTML = '<a href="javascript:void(0)" class="signup_menu">提交注册</a>';
			document.getElementById('createAlbumForm').submit();
		}
	}
	
	/**else{
		
		var url=warPath+"/index/editAlbum.action";
		
		 jQuery.post(
		  url,{
				'album.id': document.getElementById('album.id').value,
				'album.name': document.getElementById('album.name').value,
				'album.type.id': document.getElementById('album.type.id')[document.getElementById('album.type.id').selectedIndex].value,
				'album.category.id': document.getElementById('album.category.id')?document.getElementById('album.category.id')[document.getElementById('album.category.id').selectedIndex].value:0,
				'singer.name': document.getElementById('singer.name').value,
				'album.describe': document.getElementById('album.describe').value,
				'album.publishTime': document.getElementById('year')[document.getElementById('year').selectedIndex].value+'年'+document.getElementById('month')[document.getElementById('month').selectedIndex].value+'月'+document.getElementById('day')[document.getElementById('day').selectedIndex].value+'日',
				'album.imgPath': document.getElementById('ablum.imagPath').value
			},
		  function(originalRequest){
		  	if(originalRequest == 'create'){
		  		window.location.href=warPath+"/index/preEditAlbumStep2_saylikes.action?album.id="+document.getElementById('album.id').value;
		  	}
		  }); 
	}**/
}


function heart_show(type){
			a=$('#koocumy');
			var left=($(window).width()-a.width())/2;
			var top=parseInt(($(window).height()-a.height())/2+$(window).scrollTop());
			var top1=top-141;
			if(type==1){
					$('img',a).attr('src','/image/Artistica_043.png');
					$("b",a).html("+1");
					if($.browser.msie && $.browser.version <7){
						$.ifixpng('/image/pixel.gif');
						$('#koocumy img').ifixpng();	
					}
					if($.browser.msie&&$.browser.version==8){
						a.css({'display':'block','z-index':'2000','top':$(parent.window).height()/2+$(parent.window).scrollTop()-150-110,'left':left}).animate({'top':$(parent.window).height()/2+$(parent.window).scrollTop()-110},1200).delay(400).hide(0);
					}else{
						a.css({'display':'block','z-index':'2000','opacity':'0','top':$(parent.window).height()/2+$(parent.window).scrollTop()-150-110,'left':left}).delay(400).animate({'opacity':'0.9','top':$(parent.window).height()/2+$(parent.window).scrollTop()-110},1200).delay(600).animate({'opacity':'0'},800).hide(0);
					}
					return;
			}
			if(type==2){
					$('img',a).attr('src','/image/Artistica_044.png');
					$("b",a).html("-1");
					if($.browser.msie && $.browser.version <7){
						$.ifixpng('/image/pixel.gif');
						$('#koocumy img').ifixpng();	
					}
					if($.browser.msie&&$.browser.version==8){
						a.css({'display':'block','display':'block','top':$(parent.window).height()/2+$(parent.window).scrollTop()-110,'left':left}).delay(800).hide(0);
					}else{
						a.css({'display':'block','opacity':'0.9','top':$(parent.window).height()/2+$(parent.window).scrollTop()-110,'left':left}).delay(400).animate({'opacity':'0'},800).hide(0);
					}
					return;
			}
				return;
		}
		
function getAblumByFavTagUser(tagid,tagName,userid){
	$('#albumByFavTag').css({ display: ''}); 
	var url = '/user/getAlbumListByUser_saylikes.action?typeStr=favTag&objId='+tagid+'&user.id='+userid;
	$('li',$('.list_menu')).each(function(){
		$(this).removeClass().addClass('no_select');
	});
	var html='<ul><li class="selected"><a class="font_property">'+tagName+'<span id="tagAlbumNum"></span></a></ul>'; 
	$('#albumByFavTag').html(html);
	$.ajax({
	  url: url,
	  cache: false,
	  method:"POST",
	  success: function(originalRequest){
	  	$('#albumList').html(originalRequest);
	  	$('#tagAlbumNum').html('('+$('#albumTotalCount').val()+')');
	  }
	});
}

function showLoginForParent(){
	("#basic-modal-content").modal();
}



var _musicId;			
function outsideTheStation(musicId){
	_musicId = musicId;
	$('#basic-modal-content_song').modal();
	var str = '<embed src="'+warPath + '/outside_'+musicId+'_0.swf" quality="high" width="358" height="58" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>';
	document.getElementById('modal_song_html').value = str;
	document.getElementById('modal_song_swf').value=warPath + '/outside_'+musicId+'_0.swf';
}

function setOutoPlay(type){
	var str = '<embed src="'+warPath + '/outside_'+_musicId+'_'+type+'.swf" quality="high" width="358" height="58" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash"></embed>';
	document.getElementById('modal_song_html').value = str;
	document.getElementById('modal_song_swf').value=warPath + '/outside_'+_musicId+'_'+type+'.swf';
}


//删除专辑
function delAlbum(albumId){
  if(confirm("是否确定要删除此专辑？")){
	var urlStr='/index/dropAblum_saylikes.action?type=del&ablum.id='+albumId;
	$.ajax({
	  url: urlStr,
	  cache: false,
	  success: function(originalRequest){
	    if(originalRequest == 'success'){
		  	alert('专辑删除成功！');
		  	location.href="/index/getRecommentAblum.action";
		  	hashnew();
	  	}else{
	  		alert('此专辑已经被引用，暂时不能被删除！');
	  	}
	  }
	});
  }
}

function favUserTag(userid,tagid){
	jQuery.post(
	  '/user/favUserTag.action',
	  {'user.id':userid,
	  'tag.id':tagid
	  },
	  function(originalRequest){
	  //	alert(originalRequest);
		if(originalRequest=='Login'){
			$('#basic-modal-content').modal();
		}else{
	  	  $('#tag_love').html('<div class="insteadpicture2">'+(parseInt($('#tag_love_num').html())+1)+'</div>  ');
	  	  $('.people').html($('.people').html()+originalRequest);
		  alert('导入该标签歌曲成功');
		}
	}); 

}


var vote_topic_id =0;
function vote(vote_topic_id_termp,vote_item_id,type){
	vote_topic_id = vote_topic_id_termp;
	jQuery.post(
	  '/vote/vote.action',{
			'voteTopic.id': vote_topic_id,
			'voteItem.id': vote_item_id
		},
	  function(originalRequest){
		  if(originalRequest=='Login'){
			$('#basic-modal-content').modal();
	  	  }else if(originalRequest=='voted'){
	  	    alert('抱歉，每位上帝只能支持一个观点。');
	  	  }else{
	  	    if(type != null && type == 'staus'){
	  	    	checkVoteResultStaus();
	  	    }else{
		  		checkVoteResult();
		  	}
		  }
	  }); 
}
function checkVoteResult(){
	jQuery.post(
	  '/vote/voteDetail.action',{
			'voteTopic.id': vote_topic_id ,
			'type': 'justCheckResult' 
		},
	  function(originalRequest){
	  	  $('#voteNow_'+vote_topic_id).html(originalRequest);
	}); 
}

function checkVoteResultStaus(){
	jQuery.post(
	  '/vote/voteDetail.action',{
			'voteTopic.id': vote_topic_id ,
			'type': 'stausCheckResult' 
		},
	  function(originalRequest){
	  	  $('#voteNow').html(originalRequest);
	}); 
}


//图片延迟加载
//调用方法 loadimg('.boxgrid'); .boxgrid class 类别 调用函数放到图片 class 下面
//<div id="">
//	<div class="boxgrid"></div> 
//</div>
//<script> loadimg('.boxgrid');</ script>
function loadimg(a){
		var _src=[];
		var _timeId1;
		var _timelater=500;
		$(a).css({'backgroundImage':'url(/image/loadingReal.gif)','backgroundRepeat':'no-repeat','backgroundPosition':'center'});
		$('img',$(a)).each(function(i){
			_src.push($(this).attr('src'));
			if($(this).offset().top+130<$(parent.window).scrollTop() || $(this).offset().top>$(parent.window).height()+$(parent.window).scrollTop()){
				$(this).attr('src','');
			}
		})
		if($.browser.msie){
			parent.window.attachEvent('onscroll',
				function() {
					try{
						clearTimeout(_timeId1);
					}catch(e){
					}
					_timeId1=setTimeout(function(){
						$('img',$(a)).each(function(i){
							if($(this).offset().top+130>$(parent.window).scrollTop() && $(this).offset().top<$(parent.window).height()+$(parent.window).scrollTop()){
								$(this).attr('src',_src[i]);
							}
						})
					},_timelater)
				}
			);
			
		}else{
			parent.window.onscroll=function() {
				try{
					clearTimeout(_timeId1);
				}catch(e){
				}
				_timeId1=setTimeout(function(){
					$('img',$(a)).each(function(i){
						if($(this).offset().top+130>$(parent.window).scrollTop() && $(this).offset().top<$(parent.window).height()+$(parent.window).scrollTop()){
							$(this).attr('src',_src[i]);
						}
					})
				},_timelater)
			}
		}
		$(parent.window).resize(function(){
			clearTimeout(_timeId1);
			_timeId1=setTimeout(function(){
				$('img',$(a)).each(function(i){
					if($(this).offset().top>=$(parent.window).scrollTop() && $(this).offset().top<=$(parent.window).height()+$(parent.window).scrollTop()){
						$(this).attr('src',_src[i]);
					}
				})
			},_timelater)
		})
}

//当用户登陆时捕捉键盘事件
function submitForm2(event){
	if(event.keyCode == 13){
		var email = document.getElementById('userEmail').value;
		var password = document.getElementById('loginPassword').value;
		if(email.replace(/(^\s*)|(\s*$)/g, "")!='' && password.replace(/(^\s*)|(\s*$)/g, "") !=''){
				checkToLogins();//提交登陆表单
		}
	}
	return false;
}

function setCookies(name, value, outTime) {
	var expire = "";
	expire = new Date((new Date()).getTime() + outTime * 60000);
	expire = "; expires=" + expire.toGMTString();
	document.cookie = name + "=" + escape(value) + expire + ";path=/";
}

function cookieLogin(email,pwd){
	var url =  '/front/cookieLogin.action';
	jQuery.post(
	  url,
	  {
	  	'user.passWord':pwd,
	  	'user.email':email
	  },
	  function(originalRequest){
		 if(originalRequest == 'success'){
	      	window.location.reload();
	     }
	}); 

}
function   GetCookie(email,pwd){  
	var arr1 = document.cookie.match(new RegExp("(^| )" + email + "=([^;]*)(;|$)"));
	var arr2 = document.cookie.match(new RegExp("(^| )" + pwd + "=([^;]*)(;|$)"));
	if (arr1 != null&&unescape(arr1[2])!='' && arr2 != null && unescape(arr2[2]) != '') {
		cookieLogin(unescape(arr1[2]),unescape(arr2[2]));
	}
}

//举报悬浮层
function showReportDiv(type,objId){
	var _objType = 0;
	if(type == 'ps'){						//微薄举报
		_objType = 1;
	}else if(type == 'album_comment'){		//专辑评论举报
		_objType = 2;
	}else if(type == 'space_message'){		//空间留言举报
		_objType = 3;
	}else if(type == 'blog_comment'){		//官方blog举报
		_objType = 4;
	}else if(type == 'dt_comment'){			//电台评论举报
		_objType = 5;
	}else if(type == 'photo'){				//照片举报
		_objType = 6;
	}
	$('#basic-modal-content_report').modal();
	$('#report_obj_id').val(objId);
	$('#report_type').val(_objType);
}
//提交举报
function submitReprotRecord(){
	var url = '/index/submitReport.action';
	jQuery.post(
	  url,
	  {
	  	'reprotRecord.description':$('#report_text').val(),
	  	'reprotRecord.objType':$('#report_type').val(),
	  	'reprotRecord.objId':$('#report_obj_id').val()
	  },
	  function(originalRequest){
		 if(originalRequest == 'success'){
	      	$.modal.close();
	     }else{
	     	$('#basic-modal-content').modal();
	     }
	}); 
}

