var nowHotSelect = 0;
var nowViewSelect = 0;
var nowSubjectSelect = 0;
var changeFlag = "";
var ViewFlag = "";
var SubjectFlag = "";

function trim(str){
	return str.replace(/^[\s　]*|[\s　]*$/g,"");
}

Array.prototype.copy = function () {
	var temp_array = new Array();
	for(var i=0;i<this.length;i++){
		temp_array[i] = this[i];
	}
	return temp_array;
}

function imageError(imgobj){
	imgobj.onerror = function(){};
	imgobj.src = "http://c.photo.ipart.cn/images/album_default.gif";
}


function chkSearchTags(act){
	Form = window.document.tagsearch;
	if(trim(Form.content.value) == "" || trim(Form.content.value) == '输入搜索关键词'){
		alert("请输入欲查询的关键词!");
		Form.content.focus();
	} else {
		//Form.act.value = act;
		//Form.submit();
		var value = Form.content.value;
		if ('title' == act) {
			window.location.href = '/search/go/' + encodeURIComponent(value);
		} else if('tag' == act) {
			window.location.href = '/tag/go/' + encodeURIComponent(value);
		}
	}
}

function checksubject(){
	var cookie_REF = getCookie('REF');
	if(cookie_REF == ""){
		alert("请先登入!");
		window.document.frmLogin.username.focus();
	} else {
		location.href="/photo_subject_step1.php";
	}
}

function go_my_album(){
	var cookie_REF = getCookie('REF');
	if(cookie_REF == ""){
		alert("请先登入!");
		window.document.frmLogin.username.focus();
	} else {
		aaa = cookie_REF.split(",");
		user_id = aaa[0].split("=");
		location.href="http://" + user_id[1] + ".photo.ipart.cn/";
	}
}

function getCookie(theName){
	theName += "=";
	theCookie = document.cookie + ";";
	start = theCookie.indexOf(theName);
	if (start!=-1)
	{
		end = theCookie.indexOf(";",start);
		return unescape(theCookie.substring(start + theName.length,end));
	}
	return false;
}

function randomPhoto(objArr,icount){
	var tmpArr = Array();
	for(var i=0;i<icount;i++){
		var currIndex = Math.floor(Math.random()*(objArr.length));
		
		if (typeof objArr[currIndex] != "undefined") {
			tmpArr[i] = objArr[currIndex];
			objArr.splice(currIndex,1);
		} else {
			i--;
		}
	}
	//alert(objArr.length);
	return tmpArr;
}

function changeHot(id,div_obj){
	if(div_obj == "classStyle"){
		document.getElementById(div_obj+nowHotSelect).className="";
		if(id == 0)
			document.getElementById(div_obj+id).className="movein1";
		else
			document.getElementById(div_obj+id).className="movein2";
		
		nowHotSelect = id;
		loadHotPhoto();
	} else if(div_obj == "viewClassStyle"){
		document.getElementById(div_obj+nowViewSelect).className="";
		document.getElementById(div_obj+id).className="movein6";
		nowViewSelect = id;
		loadViewPhoto();
	} else if(div_obj == "subjectClassStyle"){
		document.getElementById(div_obj+nowSubjectSelect).className="";
		if(id == 1)
			document.getElementById(div_obj+id).className="movein7";
		else
			document.getElementById(div_obj+id).className="movein6";
		if (0 == nowSubjectSelect) {
			var photosubject = document.getElementById('photosubject');
			photosubject.tempHTML = photosubject.innerHTML;
		}	
		nowSubjectSelect = id;
		loadSubjectPhoto();
	} else if(div_obj == ""){
	}
}

function stopChangeHot(id,div_obj){
	if(div_obj == "classStyle"){
		clearTimeout(changeFlag);
	} else if(div_obj == "viewClassStyle"){
		clearTimeout(ViewFlag);
	} else if(div_obj == "subjectClassStyle"){
		clearTimeout(SubjectFlag);
	} else if(div_obj == ""){
	}
}

function waitChangeHot(id,div_obj){
	if(div_obj == "classStyle"){
		if(nowHotSelect != id){
			changeFlag = setTimeout("changeHot("+ id +",'"+ div_obj +"')",500);
		}
	} else if(div_obj == "viewClassStyle"){
		if(nowViewSelect != id){
			ViewFlag = setTimeout("changeHot("+ id +",'"+ div_obj +"')",500);
		}
	} else if(div_obj == "subjectClassStyle"){
		if(nowSubjectSelect != id){
			SubjectFlag = setTimeout("changeHot("+ id +",'"+ div_obj +"')",500);
		}
	} else if(div_obj == ""){
	}
}

function loadViewPhoto(){
	if(nowViewSelect == 0){
		document.getElementById("view_cnt1").innerHTML="日浏览指数 " + viewPhoto[0].view_cnt;
		document.getElementById("view_cnt2").innerHTML="日浏览指数 " + viewPhoto[1].view_cnt;
		document.getElementById("view_cnt3").innerHTML="日浏览指数 " + viewPhoto[2].view_cnt;
		
		document.getElementById("viewImg1").src			= viewPhoto[0].imgsrc;
		document.getElementById("viewtitle1").innerHTML	= viewPhoto[0].imgtitle;
		document.getElementById("viewHTTP1").href		= viewPhoto[0].imglink;
		document.getElementById("viewHTTP1").onclick    = function() { addHomepageClick('newview'); };
		document.getElementById("user_name1").innerHTML	= viewPhoto[0].nick;
		
		
		document.getElementById("viewImg2").src			= viewPhoto[1].imgsrc;
		document.getElementById("viewtitle2").innerHTML	= viewPhoto[1].imgtitle;
		document.getElementById("viewHTTP2").href		= viewPhoto[1].imglink;
		document.getElementById("viewHTTP2").onclick    = function() { addHomepageClick('newview'); };
		document.getElementById("user_name2").innerHTML	= viewPhoto[1].nick;
		
		document.getElementById("viewImg3").src			= viewPhoto[2].imgsrc;
		document.getElementById("viewtitle3").innerHTML	= viewPhoto[2].imgtitle;
		document.getElementById("viewHTTP3").href		= viewPhoto[2].imglink;
		document.getElementById("viewHTTP3").onclick    = function() { addHomepageClick('newview'); };
		document.getElementById("user_name3").innerHTML	= viewPhoto[2].nick;
		
		document.getElementById("userhomeHTTP1").href="http://" + viewPhoto[0].user_id + ".ipart.cn";
		document.getElementById("userhomeHTTP2").href="http://" + viewPhoto[1].user_id + ".ipart.cn";
		document.getElementById("userhomeHTTP3").href="http://" + viewPhoto[2].user_id + ".ipart.cn";
		
		if(viewPhoto[0].user_sexy == "F"){
			document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		if(viewPhoto[1].user_sexy == "F"){
			document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		if(viewPhoto[2].user_sexy == "F"){
			document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		
		document.getElementById("view_vip1").src = 'http://van.ipart.cn/images2/vip_icon1.gif';
		document.getElementById("view_vip2").src = 'http://van.ipart.cn/images2/vip_icon1.gif';
		document.getElementById("view_vip3").src = 'http://van.ipart.cn/images2/vip_icon1.gif';
		
		document.getElementById("listmore").href="/view/list";
	} else if(nowViewSelect == 1){
		document.getElementById("view_cnt1").innerHTML="收藏指数 " + favPhoto[0].view_cnt;
		document.getElementById("view_cnt2").innerHTML="收藏指数 " + favPhoto[1].view_cnt;
		document.getElementById("view_cnt3").innerHTML="收藏指数 " + favPhoto[2].view_cnt;
	
		document.getElementById("viewImg1").src			= favPhoto[0].imgsrc;
		document.getElementById("viewtitle1").innerHTML	= favPhoto[0].imgtitle;
		document.getElementById("viewHTTP1").href		= favPhoto[0].imglink;
		document.getElementById("user_name1").innerHTML	= favPhoto[0].nick;		
		
		document.getElementById("viewImg2").src			= favPhoto[1].imgsrc;
		document.getElementById("viewtitle2").innerHTML	= favPhoto[1].imgtitle;
		document.getElementById("viewHTTP2").href		= favPhoto[1].imglink;
		document.getElementById("user_name2").innerHTML	= favPhoto[1].nick;
		
		document.getElementById("viewImg3").src			= favPhoto[2].imgsrc;
		document.getElementById("viewtitle3").innerHTML	= favPhoto[2].imgtitle;
		document.getElementById("viewHTTP3").href		= favPhoto[2].imglink;
		document.getElementById("user_name3").innerHTML	= favPhoto[2].nick;
		
		document.getElementById("userhomeHTTP1").href="http://" + favPhoto[0].user_id + ".ipart.cn";
		document.getElementById("userhomeHTTP2").href="http://" + favPhoto[1].user_id + ".ipart.cn";
		document.getElementById("userhomeHTTP3").href="http://" + favPhoto[2].user_id + ".ipart.cn";
		
		if(favPhoto[0].user_sexy == "F"){
			document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		if(favPhoto[1].user_sexy == "F"){
			document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		if(favPhoto[2].user_sexy == "F"){
			document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		
		document.getElementById("listmore").href="photo_viewlist.php?type=fav";
	} else if(nowViewSelect == 2){
		document.getElementById("view_cnt1").innerHTML="推荐指数 " + PhotoList[0].score;
		document.getElementById("view_cnt2").innerHTML="推荐指数 " + PhotoList[1].score;
		document.getElementById("view_cnt3").innerHTML="推荐指数 " + PhotoList[2].score;
	
		document.getElementById("viewImg1").src			= PhotoList[0].imgsrc;
		document.getElementById("viewtitle1").innerHTML	= '&nbsp;';
		document.getElementById("viewHTTP1").href		= PhotoList[0].imglink;
		document.getElementById("user_name1").innerHTML	= PhotoList[0].nick;		
		
		document.getElementById("viewImg2").src			= PhotoList[1].imgsrc;
		document.getElementById("viewtitle2").innerHTML	= '&nbsp;';
		document.getElementById("viewHTTP2").href		= PhotoList[1].imglink;
		document.getElementById("user_name2").innerHTML	= PhotoList[1].nick;
		
		document.getElementById("viewImg3").src			= PhotoList[2].imgsrc;
		document.getElementById("viewtitle3").innerHTML	= '&nbsp;';
		document.getElementById("viewHTTP3").href		= PhotoList[2].imglink;
		document.getElementById("user_name3").innerHTML	= PhotoList[2].nick;
		
		document.getElementById("userhomeHTTP1").href="http://" + PhotoList[0].user_id + ".ipart.cn";
		document.getElementById("userhomeHTTP2").href="http://" + PhotoList[1].user_id + ".ipart.cn";
		document.getElementById("userhomeHTTP3").href="http://" + PhotoList[2].user_id + ".ipart.cn";
		
		if(PhotoList[0].user_sexy == "F"){
			document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		if(PhotoList[1].user_sexy == "F"){
			document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		if(PhotoList[2].user_sexy == "F"){
			document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/b.gif";
		}
		
		document.getElementById("view_vip1").src = 'http://c-photo.i-part.com.tw/n1v1/photo_index/images/space.gif';
		document.getElementById("view_vip2").src = 'http://c-photo.i-part.com.tw/n1v1/photo_index/images/space.gif';
		document.getElementById("view_vip3").src = 'http://c-photo.i-part.com.tw/n1v1/photo_index/images/space.gif';
		
		document.getElementById("listmore").href="/photo_score_list.php";
	}
}

function loadSubjectPhoto(){	
	loadPhotoSubjectIndex(nowSubjectSelect);
	if(nowSubjectSelect == 1)
		document.getElementById("subjectmore").href="/photo_new_comm.php?type=comm";
	else if(nowSubjectSelect == 2)
		document.getElementById("subjectmore").href="/photo_new_comm.php?type=upload";
	else if(nowSubjectSelect == 3)
		document.getElementById("subjectmore").href="http://www.ipart.cn/html/action/090720/beauty_list2.php";
	else if(nowSubjectSelect == 4)
		document.getElementById("subjectmore").href="http://photo.ipart.cn/topic/list/id/12";
	else if(nowSubjectSelect == 0)
		document.getElementById("subjectmore").href="/topic/history";	
}

function loadHotPhoto(){
	var hotPhoto_tmp = Array();
	var hotPhoto_tmp_1 = Array();
	
	var area = '';
	if(nowHotSelect == 0){
		hotPhoto_tmp_1 = hotPhoto.copy();
		document.getElementById("hotmore").style.display="";
		document.getElementById("hotmore").href="/photo_hot.php";
		area = 'hotphoto';
	} else if(nowHotSelect == 1) {
		hotPhoto_tmp_1 = classPhoto1.copy();
		document.getElementById("hotmore").href="/index_class.php?type="+albumClassName[0].id;
		area = 'malephoto';
	} else if(nowHotSelect == 2) {
		hotPhoto_tmp_1 = classPhoto2.copy();
		document.getElementById("hotmore").href="/index_class.php?type="+albumClassName[1].id;
		area = 'femalephoto';
	} else if(nowHotSelect == 3) {
		hotPhoto_tmp_1 = classPhoto3.copy();
		document.getElementById("hotmore").href="/index_class.php?type="+albumClassName[2].id;
		area = 'loverphoto';
	} else if(nowHotSelect == 4) {
		hotPhoto_tmp_1 = classPhoto4.copy();
		document.getElementById("hotmore").href="/index_class.php?type="+albumClassName[3].id;
		area = 'familyphoto';
	}else if(nowHotSelect == 5){
		hotPhoto_tmp_1 = iconPhoto.copy();
		document.getElementById("hotmore").style.display="none";
		area = 'iconphoto';	
	}
	
	hotPhoto_tmp = randomPhoto(hotPhoto_tmp_1,7);
	
	//大图
	document.getElementById("hotHttp1").href=hotPhoto_tmp[0].imglink;
	document.getElementById("hotHttp1").onclick    = function() { addHomepageClick(area); };
	document.getElementById("hotPhoto1").src=hotPhoto_tmp[0].imgsrc_b;
	//小图
	document.getElementById("hotHttp2").href=hotPhoto_tmp[1].imglink;
	document.getElementById("hotHttp2").onclick    = function() { addHomepageClick(area); };
	document.getElementById("hotPhoto2").src=hotPhoto_tmp[1].imgsrc;
	document.getElementById("hotHttp3").href=hotPhoto_tmp[2].imglink;
	document.getElementById("hotHttp3").onclick    = function() { addHomepageClick(area); };
	document.getElementById("hotPhoto3").src=hotPhoto_tmp[2].imgsrc;
	document.getElementById("hotHttp4").href=hotPhoto_tmp[3].imglink;
	document.getElementById("hotHttp4").onclick    = function() { addHomepageClick(area); };
	document.getElementById("hotPhoto4").src=hotPhoto_tmp[3].imgsrc;
	document.getElementById("hotHttp5").href=hotPhoto_tmp[4].imglink;
	document.getElementById("hotHttp5").onclick    = function() { addHomepageClick(area); };
	document.getElementById("hotPhoto5").src=hotPhoto_tmp[4].imgsrc;
	document.getElementById("hotHttp6").href=hotPhoto_tmp[5].imglink;
	document.getElementById("hotHttp6").onclick    = function() { addHomepageClick(area); };
	document.getElementById("hotPhoto6").src=hotPhoto_tmp[5].imgsrc;
	document.getElementById("hotHttp7").href=hotPhoto_tmp[6].imglink;
	document.getElementById("hotHttp7").onclick    = function() { addHomepageClick(area); };
	document.getElementById("hotPhoto7").src=hotPhoto_tmp[6].imgsrc;
}

function loadPhoto(){
	
	//相册主题
	loadSubjectPhoto();
	//loadPhotoSubjectIndex(nowSubjectSelect);
	//document.getElementById("subjectmore").href="/topic/history";
	
	var hotPhoto_tmp  = Array();
	
	//类别精选
	/*document.getElementById("albumClssName1").innerHTML=albumClassName[0].name;
	document.getElementById("albumClssName2").innerHTML=albumClassName[1].name;
	document.getElementById("albumClssName3").innerHTML=albumClassName[2].name;
	document.getElementById("albumClssName4").innerHTML=albumClassName[3].name;*/
			
	//公寓精选
	var hotPhoto_tmp_1 = Array();
	hotPhoto_tmp_1 = hotPhoto.copy();
	hotPhoto_tmp = randomPhoto(hotPhoto_tmp_1,7);
	//大图
	document.getElementById("hotHttp1").href=hotPhoto_tmp[0].imglink;
	document.getElementById("hotHttp1").onclick    = function() { addHomepageClick('hotphoto'); };
	document.getElementById("hotPhoto1").src=hotPhoto_tmp[0].imgsrc_b;
	//小图
	document.getElementById("hotHttp2").href=hotPhoto_tmp[1].imglink;
	document.getElementById("hotHttp2").onclick    = function() { addHomepageClick('hotphoto'); };
	document.getElementById("hotPhoto2").src=hotPhoto_tmp[1].imgsrc;
	document.getElementById("hotHttp3").href=hotPhoto_tmp[2].imglink;
	document.getElementById("hotHttp3").onclick    = function() { addHomepageClick('hotphoto'); };
	document.getElementById("hotPhoto3").src=hotPhoto_tmp[2].imgsrc;
	document.getElementById("hotHttp4").href=hotPhoto_tmp[3].imglink;
	document.getElementById("hotHttp4").onclick    = function() { addHomepageClick('hotphoto'); };
	document.getElementById("hotPhoto4").src=hotPhoto_tmp[3].imgsrc;
	document.getElementById("hotHttp5").href=hotPhoto_tmp[4].imglink;
	document.getElementById("hotHttp5").onclick    = function() { addHomepageClick('hotphoto'); };
	document.getElementById("hotPhoto5").src=hotPhoto_tmp[4].imgsrc;
	document.getElementById("hotHttp6").href=hotPhoto_tmp[5].imglink;
	document.getElementById("hotHttp6").onclick    = function() { addHomepageClick('hotphoto'); };
	document.getElementById("hotPhoto6").src=hotPhoto_tmp[5].imgsrc;
	document.getElementById("hotHttp7").href=hotPhoto_tmp[6].imglink;
	document.getElementById("hotHttp7").onclick    = function() { addHomepageClick('hotphoto'); };
	document.getElementById("hotPhoto7").src=hotPhoto_tmp[6].imgsrc;
	//more
	document.getElementById("hotmore").href="photo_hot.php";
	
	//最新浏览排行
	document.getElementById("view_cnt1").innerHTML="日浏览指数 " + viewPhoto[0].view_cnt;
	document.getElementById("view_cnt2").innerHTML="日浏览指数 " + viewPhoto[1].view_cnt;
	document.getElementById("view_cnt3").innerHTML="日浏览指数 " + viewPhoto[2].view_cnt;
	
	document.getElementById("viewHTTP1").href=viewPhoto[0].imglink;
	document.getElementById("viewHTTP1").onclick    = function() { addHomepageClick('newview'); };
	document.getElementById("viewHTTP2").href=viewPhoto[1].imglink;
	document.getElementById("viewHTTP2").onclick    = function() { addHomepageClick('newview'); };
	document.getElementById("viewHTTP3").href=viewPhoto[2].imglink;
	document.getElementById("viewHTTP3").onclick    = function() { addHomepageClick('newview'); };
	
	document.getElementById("viewImg1").src=viewPhoto[0].imgsrc;
	document.getElementById("viewImg2").src=viewPhoto[1].imgsrc;
	document.getElementById("viewImg3").src=viewPhoto[2].imgsrc;
    
	document.getElementById("viewtitle1").innerHTML=viewPhoto[0].imgtitle;
	document.getElementById("viewtitle2").innerHTML=viewPhoto[1].imgtitle;
	document.getElementById("viewtitle3").innerHTML=viewPhoto[2].imgtitle;
	
	document.getElementById("user_name1").innerHTML=viewPhoto[0].nick;
	document.getElementById("user_name2").innerHTML=viewPhoto[1].nick;
	document.getElementById("user_name3").innerHTML=viewPhoto[2].nick;
	
	document.getElementById("userhomeHTTP1").href="http://" + viewPhoto[0].user_id + ".ipart.cn";
	document.getElementById("userhomeHTTP2").href="http://" + viewPhoto[1].user_id + ".ipart.cn";
	document.getElementById("userhomeHTTP3").href="http://" + viewPhoto[2].user_id + ".ipart.cn";
	
	if(viewPhoto[0].user_sexy == "F"){
		document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("viewSexy1").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	if(viewPhoto[1].user_sexy == "F"){
		document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("viewSexy2").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	if(viewPhoto[2].user_sexy == "F"){
		document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("viewSexy3").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	
	document.getElementById("view_vip1").src = 'http://van.ipart.cn/images2/vip_icon1.gif';
	document.getElementById("view_vip2").src = 'http://van.ipart.cn/images2/vip_icon1.gif';
	document.getElementById("view_vip3").src = 'http://van.ipart.cn/images2/vip_icon1.gif';
	document.getElementById("listmore").href="/view/list";
	
	//地区相册
	var hotPhoto_tmp_1 = Array();
	hotPhoto_tmp_1 = areaPhoto.copy();
	hotPhoto_tmp = randomPhoto(hotPhoto_tmp_1,7);
	
	document.getElementById("areafrom0").innerHTML=userFrom[parseInt(hotPhoto_tmp[0].user_from_a)];
	document.getElementById("areafrom1").innerHTML=userFrom[parseInt(hotPhoto_tmp[1].user_from_a)];
	document.getElementById("areafrom2").innerHTML=userFrom[parseInt(hotPhoto_tmp[2].user_from_a)];
	document.getElementById("areafrom3").innerHTML=userFrom[parseInt(hotPhoto_tmp[3].user_from_a)];
	document.getElementById("areafrom4").innerHTML=userFrom[parseInt(hotPhoto_tmp[4].user_from_a)];
	
	document.getElementById("areaHTTP0").href=hotPhoto_tmp[0].album_link;
	document.getElementById("areaHTTP0").onclick    = function() { addHomepageClick('areaphoto'); };
	document.getElementById("areaHTTP1").href=hotPhoto_tmp[1].album_link;
	document.getElementById("areaHTTP1").onclick    = function() { addHomepageClick('areaphoto'); };
	document.getElementById("areaHTTP2").href=hotPhoto_tmp[2].album_link;
	document.getElementById("areaHTTP2").onclick    = function() { addHomepageClick('areaphoto'); };
	document.getElementById("areaHTTP3").href=hotPhoto_tmp[3].album_link;
	document.getElementById("areaHTTP3").onclick    = function() { addHomepageClick('areaphoto'); };
	document.getElementById("areaHTTP4").href=hotPhoto_tmp[4].album_link;
	document.getElementById("areaHTTP4").onclick    = function() { addHomepageClick('areaphoto'); };
	
	document.getElementById("areaconver0").src=hotPhoto_tmp[0].cover_photo;
	document.getElementById("areaconver1").src=hotPhoto_tmp[1].cover_photo;
	document.getElementById("areaconver2").src=hotPhoto_tmp[2].cover_photo;
	document.getElementById("areaconver3").src=hotPhoto_tmp[3].cover_photo;
	document.getElementById("areaconver4").src=hotPhoto_tmp[4].cover_photo;
	
	document.getElementById("areatitle0").innerHTML=hotPhoto_tmp[0].album_title;
	document.getElementById("areatitle1").innerHTML=hotPhoto_tmp[1].album_title;
	document.getElementById("areatitle2").innerHTML=hotPhoto_tmp[2].album_title;
	document.getElementById("areatitle3").innerHTML=hotPhoto_tmp[3].album_title;
	document.getElementById("areatitle4").innerHTML=hotPhoto_tmp[4].album_title;
	
	document.getElementById("areacnt0").innerHTML="("+ hotPhoto_tmp[0].cnt +")";
	document.getElementById("areacnt1").innerHTML="("+ hotPhoto_tmp[1].cnt +")";
	document.getElementById("areacnt2").innerHTML="("+ hotPhoto_tmp[2].cnt +")";
	document.getElementById("areacnt3").innerHTML="("+ hotPhoto_tmp[3].cnt +")";
	document.getElementById("areacnt4").innerHTML="("+ hotPhoto_tmp[4].cnt +")";
	
	document.getElementById("areauserhome0").href="http://" + hotPhoto_tmp[0].user_id + ".ipart.cn";
	document.getElementById("areauserhome1").href="http://" + hotPhoto_tmp[1].user_id + ".ipart.cn";
	document.getElementById("areauserhome2").href="http://" + hotPhoto_tmp[2].user_id + ".ipart.cn";
	document.getElementById("areauserhome3").href="http://" + hotPhoto_tmp[3].user_id + ".ipart.cn";
	document.getElementById("areauserhome4").href="http://" + hotPhoto_tmp[4].user_id + ".ipart.cn";
	
	if(hotPhoto_tmp[0].user_sexy == "F"){
		document.getElementById("areasexy0").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("areasexy0").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	if(hotPhoto_tmp[1].user_sexy == "F"){
		document.getElementById("areasexy1").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("areasexy1").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	if(hotPhoto_tmp[2].user_sexy == "F"){
		document.getElementById("areasexy2").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("areasexy2").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	if(hotPhoto_tmp[3].user_sexy == "F"){
		document.getElementById("areasexy3").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("areasexy3").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	if(hotPhoto_tmp[4].user_sexy == "F"){
		document.getElementById("areasexy4").src="http://van.ipart.cn/images/ifile/g.gif";
	} else {
		document.getElementById("areasexy4").src="http://van.ipart.cn/images/ifile/b.gif";
	}
	
	document.getElementById("areauserhome0").innerHTML=hotPhoto_tmp[0].user_nick;
	document.getElementById("areauserhome1").innerHTML=hotPhoto_tmp[1].user_nick;
	document.getElementById("areauserhome2").innerHTML=hotPhoto_tmp[2].user_nick;
	document.getElementById("areauserhome3").innerHTML=hotPhoto_tmp[3].user_nick;
	document.getElementById("areauserhome4").innerHTML=hotPhoto_tmp[4].user_nick;
	
	
}

function loadPhotoSubjectIndex(goType){
	var photosubject = document.getElementById('photosubject');
	if (typeof photosubject[goType] != "undefined") {
		photosubject.innerHTML = photosubject[goType];
	} else {
		var ajax = new sack();
		ajax.method = 'POST';	
		ajax.setVar("type", goType);
		ajax.requestFile = "/photo_index_html/photosubject.php";
		ajax.onCompletion = function(){
			var JS_cmt = ajax.response;
			ajax = null;
			if(JS_cmt == 'AJAX_ERROR_PARAM'){
				alert("操作失败!请重新再试!");
				return false;
			} else if(JS_cmt == 'PHP_READ_FAIL') {
				alert("操作失败!请重新再试!");
				return false;
			}
			photosubject[goType] = JS_cmt;
			photosubject.innerHTML = photosubject[goType];
			//document.getElementById('photosubject').innerHTML = JS_cmt;
		}
		ajax.onError = function (){
			alert("操作失败!请重新再试!");
			ajax = null;
		}	
		ajax.runAJAX();
	}
}

var searchTag_tmp  = Array();
function loadSearchTag(){
	searchTag_tmp = searchTag.copy();
	searchTagShow = randomPhoto(searchTag_tmp,10);
	$("#searchTag0").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[0].word) + '">' + searchTagShow[0].word + '</a>');
	$("#searchTag1").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[1].word) + '">' + searchTagShow[1].word + '</a>');
	$("#searchTag2").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[2].word) + '">' + searchTagShow[2].word + '</a>');
	$("#searchTag3").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[3].word) + '">' + searchTagShow[3].word + '</a>');
	$("#searchTag4").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[4].word) + '">' + searchTagShow[4].word + '</a>');
	$("#searchTag5").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[5].word) + '">' + searchTagShow[5].word + '</a>');
	$("#searchTag6").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[6].word) + '">' + searchTagShow[6].word + '</a>');
	$("#searchTag7").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[7].word) + '">' + searchTagShow[7].word + '</a>');
	$("#searchTag8").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[8].word) + '">' + searchTagShow[8].word + '</a>');
	$("#searchTag9").html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[9].word) + '">' + searchTagShow[9].word + '</a>');
}

function timeSearchTag(){
	searchTagFlag = setTimeout("timeSearchTag()",5000);
	changeSearchTag();
}
var act_no=1;
function changeSearchTag(){
	if(searchTag_tmp.length > 0){
		searchTagShow = randomPhoto(searchTag_tmp,1);		
		act_no = (act_no+9)%10;
		move_no = (act_no+9)%10;
		$("#searchTag"+move_no).html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[0].word) + '">' + searchTagShow[0].word + '</a>');		
		$("#searchTag"+act_no).before($("#searchTag"+move_no));		
	} else {
		searchTag_tmp = searchTag.copy();
		searchTagShow = randomPhoto(searchTag_tmp,1);		
		act_no = (act_no+9)%10;
		move_no = (act_no+9)%10;
		$("#searchTag"+move_no).html('<a onclick="addHomepageClick(\'search\');" href="/search/go/' + encodeURI(searchTagShow[0].word) + '">' + searchTagShow[0].word + '</a>');
		$("#searchTag"+act_no).before($("#searchTag"+move_no));
	}
}

function change_css(OBJ_NAME){
	if(trim(document.getElementById(OBJ_NAME).value) =='输入搜索关键词'){
		document.getElementById(OBJ_NAME).value = "";
		document.getElementById(OBJ_NAME).style.color = "#000000";
	}
}
function checkLogin(){
	var cookie_REF = getCookie('REF');
	if(cookie_REF == ""){
		alert("请先登入!");
		window.document.frmLogin.username.focus();
	} else {
		var u_id ='';
		var tt = cookie_REF.split("d=");
		if(tt[1] != ''){
			u_id = tt[1].split(",o=");
		}
		location.href = "http://"+u_id[0]+".ipart.cn/file/file_video_auth.php";
		return;
	}
}

function addHomepageClick(area) {
	$.get('/click/homepage/area/' + area);
}