﻿var nowHotSelect = 0;
var nowViewSelect = 0;
var nowSubjectSelect = 0;
var nowCommSelect = 1;
var nowNoteSelect = 0;
var changeFlag = "";
var ViewFlag = "";
var SubjectFlag = "";
var CommFlag = "";
var NoteFlag = "";


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.i-part.com.tw/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();
	}
}

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_no = aaa[0].split("=");
		location.href="/" + user_no[1];
	}
}

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--;
  }
 }
 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";
		
		nowSubjectSelect = id;
		loadSubjectPhoto();
	} else if(div_obj == "comm_href_"){
		document.getElementById(div_obj+id).className="";
		document.getElementById(div_obj+nowCommSelect).className="reply";
		
		//alert('comm_src_'+id);
		//alert(document.getElementById('comm_src_'+id).style.border);
		//document.getElementById('comm_src_'+id).style.border="";
		//document.getElementById('comm_src_'+nowCommSelect).style.border="#f5839f 2px solid;";
		
		
		nowCommSelect = id;
		loadCommInfo();
	} else if(div_obj == "noteStyle"){
		document.getElementById(div_obj+id).className="movein6";
		document.getElementById(div_obj+nowNoteSelect).className="";
		nowNoteSelect=id;
		load6pic();
	}
}

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 == "comm_href_"){
		clearTimeout(CommFlag);
	} else if(div_obj == "noteStyle"){
		clearTimeout(NoteFlag);
	}
}

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 == "comm_href_"){
		if(nowCommSelect != id){
			CommFlag = setTimeout("changeHot("+ id +",'"+ div_obj +"')",500);
		}
	} else if(div_obj == "noteStyle"){
		if(nowNoteSelect != id){
			NoteFlag = setTimeout("changeHot("+ id +",'"+ div_obj +"')",500);
		}
	}
}

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("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("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("user_name3").innerHTML	= viewPhoto[2].nick;
		
		document.getElementById("userhomeHTTP1").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + viewPhoto[0].user_no;
		document.getElementById("userhomeHTTP2").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + viewPhoto[1].user_no;
		document.getElementById("userhomeHTTP3").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + viewPhoto[2].user_no;
		
		if(viewPhoto[0].user_sexy == "F"){
			document.getElementById("viewSexy1").src="http://img.i-part.com.tw/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy1").src="http://img.i-part.com.tw/images/ifile/b.gif";
		}
		if(viewPhoto[1].user_sexy == "F"){
			document.getElementById("viewSexy2").src="http://img.i-part.com.tw/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy2").src="http://img.i-part.com.tw/images/ifile/b.gif";
		}
		if(viewPhoto[2].user_sexy == "F"){
			document.getElementById("viewSexy3").src="http://img.i-part.com.tw/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy3").src="http://img.i-part.com.tw/images/ifile/b.gif";
		}
		
		document.getElementById("listmore").href="photo_viewlist.php?type=view";
	} 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://www.i-part.com.tw/file/file_viewfile.php?u=" + favPhoto[0].user_no;
		document.getElementById("userhomeHTTP2").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + favPhoto[1].user_no;
		document.getElementById("userhomeHTTP3").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + favPhoto[2].user_no;
		
		if(favPhoto[0].user_sexy == "F"){
			document.getElementById("viewSexy1").src="http://img.i-part.com.tw/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy1").src="http://img.i-part.com.tw/images/ifile/b.gif";
		}
		if(favPhoto[1].user_sexy == "F"){
			document.getElementById("viewSexy2").src="http://img.i-part.com.tw/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy2").src="http://img.i-part.com.tw/images/ifile/b.gif";
		}
		if(favPhoto[2].user_sexy == "F"){
			document.getElementById("viewSexy3").src="http://img.i-part.com.tw/images/ifile/g.gif";
		} else {
			document.getElementById("viewSexy3").src="http://img.i-part.com.tw/images/ifile/b.gif";
		}
		
		document.getElementById("listmore").href="photo_viewlist.php?type=fav";
	}
}

function load6pic(){
	var img_word = '';
	var commPhoto_tmp_1 = Array();
	if(nowNoteSelect == 0){
		commPhoto_tmp_1 = notePhoto.copy();
		img_word = '<img height="11" align="absmiddle" width="10" src="/images/photo/icon1s.gif"/>';
	} else {
		commPhoto_tmp_1 = commPhoto.copy();
		img_word = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span>';
	}
	commPhoto_tmp = randomPhoto(commPhoto_tmp_1,6);
	
	//document.getElementById("comm_title").innerHTML = commPhoto_tmp[0].photo_title;
	//document.getElementById("comm_title_link").href = commPhoto_tmp[0].imglink;
	document.getElementById("comm_title").innerHTML = '<a href="'+ commPhoto_tmp[0].imglink +'" target="_blank" style="font-size: 12pt;">'+ commPhoto_tmp[0].photo_title +'</a>' ;
	
	document.getElementById("comm_own_nick").innerHTML = commPhoto_tmp[0].own_nick;
	document.getElementById("comm_own_home").href = commPhoto_tmp[0].own_link;
	document.getElementById("comm_own_src").src = commPhoto_tmp[0].imgsrc;
	document.getElementById("comm_own_photo_link").href = commPhoto_tmp[0].imglink;
	document.getElementById("comm_own_sex").src = commPhoto_tmp[0].own_sexy;
	
	
	for(var i=1;i<=4;i++){
		//document.getElementById("img_word_"+i).innerHTML = '';
		document.getElementById("note_list_"+i).innerHTML = '';
	}
	
	if(typeof(commPhoto_tmp[0].sex_1) != 'undefined'){
		//document.getElementById("img_word_1").innerHTML = img_word;
		
		var str1 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_1 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_1_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_1 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_1 +'</span>';
		document.getElementById("note_list_1").innerHTML = str1;
	}
	if(typeof(commPhoto_tmp[0].sex_2) != 'undefined'){
		var str2 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_2 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_2_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_2 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_2 +'</span>';
		document.getElementById("note_list_2").innerHTML = str2;
	}
	if(typeof(commPhoto_tmp[0].sex_3) != 'undefined'){
		var str3 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_3 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_3_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_3 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_3 +'</span>';
		document.getElementById("note_list_3").innerHTML = str3;
	}
	if(typeof(commPhoto_tmp[0].sex_4) != 'undefined'){
		var str4 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_4 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_4_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_4 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_4 +'</span>';
		document.getElementById("note_list_4").innerHTML = str4;
	}
	
	
	//回應6小圖
	document.getElementById("comm_src_1").src = commPhoto_tmp[0].imgsrc;
	document.getElementById("comm_src_2").src = commPhoto_tmp[1].imgsrc;
	document.getElementById("comm_src_3").src = commPhoto_tmp[2].imgsrc;
	document.getElementById("comm_src_4").src = commPhoto_tmp[3].imgsrc;
	document.getElementById("comm_src_5").src = commPhoto_tmp[4].imgsrc;
	document.getElementById("comm_src_6").src = commPhoto_tmp[5].imgsrc;
	
	document.getElementById("comm_href_1").href = commPhoto_tmp[0].imglink;
	document.getElementById("comm_href_2").href = commPhoto_tmp[1].imglink;
	document.getElementById("comm_href_3").href = commPhoto_tmp[2].imglink;
	document.getElementById("comm_href_4").href = commPhoto_tmp[3].imglink;
	document.getElementById("comm_href_5").href = commPhoto_tmp[4].imglink;
	document.getElementById("comm_href_6").href = commPhoto_tmp[5].imglink;
}

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 == 0)
		document.getElementById("subjectmore").href="subjecthistory.php";
}

function loadCommInfo(){
	var img_word = '';
	if(nowNoteSelect == 0){
		img_word = '<img height="11" align="absmiddle" width="10" src="/images/photo/icon1s.gif"/>';
	} else {
		img_word = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span>';
	}
	
	//document.getElementById("comm_title").innerHTML = commPhoto_tmp[(nowCommSelect-1)].photo_title;
	//document.getElementById("comm_title_link").href = commPhoto_tmp[(nowCommSelect-1)].imglink;
	document.getElementById("comm_title").innerHTML = '<a href="'+ commPhoto_tmp[(nowCommSelect-1)].imglink +'" target="_blank" style="font-size: 12pt;">'+ commPhoto_tmp[(nowCommSelect-1)].photo_title +'</a>' ;
	
	document.getElementById("comm_own_nick").innerHTML = commPhoto_tmp[(nowCommSelect-1)].own_nick;
	document.getElementById("comm_own_home").href = commPhoto_tmp[(nowCommSelect-1)].own_link;
	document.getElementById("comm_own_src").src = commPhoto_tmp[(nowCommSelect-1)].imgsrc;
	document.getElementById("comm_own_photo_link").href = commPhoto_tmp[(nowCommSelect-1)].imglink;
	document.getElementById("comm_own_sex").src = commPhoto_tmp[(nowCommSelect-1)].own_sexy;
	
	for(var i=1;i<=4;i++){
		//document.getElementById("img_word_"+i).innerHTML = '';
		document.getElementById("note_list_"+i).innerHTML = '';
	}
	
	if(typeof(commPhoto_tmp[(nowCommSelect-1)].sex_1) != 'undefined'){
		var str1 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[(nowCommSelect-1)].sex_1 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[(nowCommSelect-1)].user_1_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[(nowCommSelect-1)].nick_1 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[(nowCommSelect-1)].cmt_1 +'</span>';
		document.getElementById("note_list_1").innerHTML = str1;
	}
	if(typeof(commPhoto_tmp[(nowCommSelect-1)].sex_2) != 'undefined'){
		var str2 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[(nowCommSelect-1)].sex_2 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[(nowCommSelect-1)].user_2_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[(nowCommSelect-1)].nick_2 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[(nowCommSelect-1)].cmt_2 +'</span>';
		document.getElementById("note_list_2").innerHTML = str2;
	}
	if(typeof(commPhoto_tmp[(nowCommSelect-1)].sex_3) != 'undefined'){
		var str3 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[(nowCommSelect-1)].sex_3 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[(nowCommSelect-1)].user_3_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[(nowCommSelect-1)].nick_3 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[(nowCommSelect-1)].cmt_3 +'</span>';
		document.getElementById("note_list_3").innerHTML = str3;
	}
	if(typeof(commPhoto_tmp[(nowCommSelect-1)].sex_4) != 'undefined'){
		var str4 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[(nowCommSelect-1)].sex_4 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[(nowCommSelect-1)].user_4_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[(nowCommSelect-1)].nick_4 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[(nowCommSelect-1)].cmt_4 +'</span>';
		document.getElementById("note_list_4").innerHTML = str4;
	}
	
}

function loadHotPhoto(){
	var hotPhoto_tmp = Array();
	var hotPhoto_tmp_1 = Array();
	var ad_id = 2;
	
	if(nowHotSelect == 0){
		hotPhoto_tmp_1 = hotPhoto.copy();
		document.getElementById("hotmore").href="/photo_hot_new.php";
		ad_id = 2;
	} else if(nowHotSelect == 1) {
		hotPhoto_tmp_1 = classPhoto1.copy();
		document.getElementById("hotmore").href="/photo_hot_class.php?c_id="+albumClassName[0].id;
		ad_id = 3;
	} else if(nowHotSelect == 2) {
		hotPhoto_tmp_1 = classPhoto2.copy();
		document.getElementById("hotmore").href="/photo_hot_class.php?c_id="+albumClassName[1].id;
		ad_id = 4;
	} else if(nowHotSelect == 3) {
		hotPhoto_tmp_1 = classPhoto3.copy();
		document.getElementById("hotmore").href="/photo_hot_class.php?c_id="+albumClassName[2].id;
		ad_id = 5;
	} else if(nowHotSelect == 4) {
		hotPhoto_tmp_1 = classPhoto4.copy();
		document.getElementById("hotmore").href="/photo_hot_class.php?c_id="+albumClassName[3].id;
		ad_id = 6;
	} else if(nowHotSelect == 5) {
		hotPhoto_tmp_1 = uploadPhoto.copy();
		document.getElementById("hotmore").href="/photo_new_comm.php?type=upload";
		ad_id = 6;
	}
	
	hotPhoto_tmp = randomPhoto(hotPhoto_tmp_1,15);
	
	//大圖
	document.getElementById("hotHttp1").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[0].imglink);
	document.getElementById("hotPhoto1").src=hotPhoto_tmp[0].imgsrc_b;
	//小圖
	document.getElementById("hotHttp2").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[1].imglink);
	document.getElementById("hotPhoto2").src=hotPhoto_tmp[1].imgsrc;
	document.getElementById("hotHttp3").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[2].imglink);
	document.getElementById("hotPhoto3").src=hotPhoto_tmp[2].imgsrc;
	document.getElementById("hotHttp4").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[3].imglink);
	document.getElementById("hotPhoto4").src=hotPhoto_tmp[3].imgsrc;
	document.getElementById("hotHttp5").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[4].imglink);
	document.getElementById("hotPhoto5").src=hotPhoto_tmp[4].imgsrc;
	document.getElementById("hotHttp6").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[5].imglink);
	document.getElementById("hotPhoto6").src=hotPhoto_tmp[5].imgsrc;
	document.getElementById("hotHttp7").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[6].imglink);
	document.getElementById("hotPhoto7").src=hotPhoto_tmp[6].imgsrc;
	
	document.getElementById("hotHttp8").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[7].imglink);
	document.getElementById("hotPhoto8").src=hotPhoto_tmp[7].imgsrc;
	document.getElementById("hotHttp9").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[8].imglink);
	document.getElementById("hotPhoto9").src=hotPhoto_tmp[8].imgsrc;
	document.getElementById("hotHttp10").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[9].imglink);
	document.getElementById("hotPhoto10").src=hotPhoto_tmp[9].imgsrc;
	document.getElementById("hotHttp11").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[10].imglink);
	document.getElementById("hotPhoto11").src=hotPhoto_tmp[10].imgsrc;
	document.getElementById("hotHttp12").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[11].imglink);
	document.getElementById("hotPhoto12").src=hotPhoto_tmp[11].imgsrc;
	document.getElementById("hotHttp13").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[12].imglink);
	document.getElementById("hotPhoto13").src=hotPhoto_tmp[12].imgsrc;
	document.getElementById("hotHttp14").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[13].imglink);
	document.getElementById("hotPhoto14").src=hotPhoto_tmp[13].imgsrc;
	document.getElementById("hotHttp15").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id='+ ad_id +'&f='+URLEncode(hotPhoto_tmp[14].imglink);
	document.getElementById("hotPhoto15").src=hotPhoto_tmp[14].imgsrc;
}

function loadPhoto(){
	
	var hotPhoto_tmp  = Array();
	
	//類別精選
	/* 100813
	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;
	*/
	//document.getElementById("albumClssName5").innerHTML=albumClassName[4].name;
	
	
	//公寓精選
	var hotPhoto_tmp_1 = Array();
	hotPhoto_tmp_1 = hotPhoto.copy();
	hotPhoto_tmp = randomPhoto(hotPhoto_tmp_1,15);
	//大圖
	document.getElementById("hotHttp1").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[0].imglink);
	document.getElementById("hotPhoto1").src=hotPhoto_tmp[0].imgsrc_b;
	//小圖
	document.getElementById("hotHttp2").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[1].imglink);
	document.getElementById("hotPhoto2").src=hotPhoto_tmp[1].imgsrc;
	document.getElementById("hotHttp3").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[2].imglink);
	document.getElementById("hotPhoto3").src=hotPhoto_tmp[2].imgsrc;
	document.getElementById("hotHttp4").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[3].imglink);
	document.getElementById("hotPhoto4").src=hotPhoto_tmp[3].imgsrc;
	document.getElementById("hotHttp5").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[4].imglink);
	document.getElementById("hotPhoto5").src=hotPhoto_tmp[4].imgsrc;
	document.getElementById("hotHttp6").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[5].imglink);
	document.getElementById("hotPhoto6").src=hotPhoto_tmp[5].imgsrc;
	document.getElementById("hotHttp7").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[6].imglink);
	document.getElementById("hotPhoto7").src=hotPhoto_tmp[6].imgsrc;
	
	document.getElementById("hotHttp8").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[7].imglink);
	document.getElementById("hotPhoto8").src=hotPhoto_tmp[7].imgsrc;
	document.getElementById("hotHttp9").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[8].imglink);
	document.getElementById("hotPhoto9").src=hotPhoto_tmp[8].imgsrc;
	document.getElementById("hotHttp10").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[9].imglink);
	document.getElementById("hotPhoto10").src=hotPhoto_tmp[9].imgsrc;
	document.getElementById("hotHttp11").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[10].imglink);
	document.getElementById("hotPhoto11").src=hotPhoto_tmp[10].imgsrc;
	document.getElementById("hotHttp12").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[11].imglink);
	document.getElementById("hotPhoto12").src=hotPhoto_tmp[11].imgsrc;
	document.getElementById("hotHttp13").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[12].imglink);
	document.getElementById("hotPhoto13").src=hotPhoto_tmp[12].imgsrc;
	document.getElementById("hotHttp14").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[13].imglink);
	document.getElementById("hotPhoto14").src=hotPhoto_tmp[13].imgsrc;
	document.getElementById("hotHttp15").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=2&f='+URLEncode(hotPhoto_tmp[14].imglink);
	document.getElementById("hotPhoto15").src=hotPhoto_tmp[14].imgsrc;
	//more
	//document.getElementById("hotmore").href="/photo_hot_new.php";
	
	
	//相冊主題
	var SubjectPhoto_tmp_1 = Array();
	SubjectPhoto_tmp_1 = SubjectPhoto.copy();
	SubjectPhoto_tmp = randomPhoto(SubjectPhoto_tmp_1,7);
	
	if(document.getElementById("subjectHttp1") != null){
		document.getElementById("subjectHttp1").href='http://photo.i-part.com.tw'+(SubjectPhoto_tmp[0].imglink);
		document.getElementById("subjectPhoto1").src=SubjectPhoto_tmp[0].imgsrc;
		document.getElementById("subjectHttp2").href='http://photo.i-part.com.tw'+(SubjectPhoto_tmp[1].imglink);
		document.getElementById("subjectPhoto2").src=SubjectPhoto_tmp[1].imgsrc;
		document.getElementById("subjectHttp3").href='http://photo.i-part.com.tw'+(SubjectPhoto_tmp[2].imglink);
		document.getElementById("subjectPhoto3").src=SubjectPhoto_tmp[2].imgsrc;
		document.getElementById("subjectHttp4").href='http://photo.i-part.com.tw'+(SubjectPhoto_tmp[3].imglink);
		document.getElementById("subjectPhoto4").src=SubjectPhoto_tmp[3].imgsrc;
		document.getElementById("subjectHttp5").href='http://photo.i-part.com.tw'+(SubjectPhoto_tmp[4].imglink);
		document.getElementById("subjectPhoto5").src=SubjectPhoto_tmp[4].imgsrc;
		document.getElementById("subjectHttp6").href='http://photo.i-part.com.tw'+(SubjectPhoto_tmp[5].imglink);
		document.getElementById("subjectPhoto6").src=SubjectPhoto_tmp[5].imgsrc;
		document.getElementById("subjectHttp7").href='http://photo.i-part.com.tw'+(SubjectPhoto_tmp[6].imglink);
		document.getElementById("subjectPhoto7").src=SubjectPhoto_tmp[6].imgsrc;
	}
	
	//最新回應
	/* 100813
	var img_word = '';
	var commPhoto_tmp_1 = Array();
	if(nowNoteSelect == 0){
		commPhoto_tmp_1 = notePhoto.copy();
		img_word = '<img height="11" align="absmiddle" width="10" src="/images/photo/icon1s.gif"/>';
	} else {
		commPhoto_tmp_1 = commPhoto.copy();
		img_word = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span>';
	}
	commPhoto_tmp = randomPhoto(commPhoto_tmp_1,6);
	
	//document.getElementById("comm_title").innerHTML = commPhoto_tmp[0].photo_title;
	//document.getElementById("comm_title_link").href = commPhoto_tmp[0].imglink;
	document.getElementById("comm_title").innerHTML = '<a href="'+ commPhoto_tmp[0].imglink +'" target="_blank" style="font-size: 12pt;">'+ commPhoto_tmp[0].photo_title +'</a>' ;
	document.getElementById("comm_own_nick").innerHTML = commPhoto_tmp[0].own_nick;
	document.getElementById("comm_own_home").href = commPhoto_tmp[0].own_link;
	document.getElementById("comm_own_src").src = commPhoto_tmp[0].imgsrc;
	document.getElementById("comm_own_photo_link").href = commPhoto_tmp[0].imglink;
	document.getElementById("comm_own_sex").src = commPhoto_tmp[0].own_sexy;
	
	for(var i=1;i<=4;i++){
		//document.getElementById("img_word_"+i).innerHTML = '';
		document.getElementById("note_list_"+i).innerHTML = '';
	}
	
	if(typeof(commPhoto_tmp[0].sex_1) != 'undefined'){
		//document.getElementById("img_word_1").innerHTML = img_word;
		
		var str1 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_1 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_1_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_1 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_1 +'</span>';
		document.getElementById("note_list_1").innerHTML = str1;
	}
	if(typeof(commPhoto_tmp[0].sex_2) != 'undefined'){
		var str2 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_2 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_2_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_2 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_2 +'</span>';
		document.getElementById("note_list_2").innerHTML = str2;
	}
	if(typeof(commPhoto_tmp[0].sex_3) != 'undefined'){
		var str3 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_3 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_3_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_3 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_3 +'</span>';
		document.getElementById("note_list_3").innerHTML = str3;
	}
	if(typeof(commPhoto_tmp[0].sex_4) != 'undefined'){
		var str4 = '<span style="color: rgb(102, 102, 102); font-size: 8pt;">Re:</span> <img align="absmiddle" src="'+ commPhoto_tmp[0].sex_4 +'" id="sexy_2" name="sexy_2"/><a href="'+ commPhoto_tmp[0].user_4_link +'" id="user_2_link" name="user_2_link" target="_blank"><span id="nick_2" name="nick_2">'+ commPhoto_tmp[0].nick_4 +'</span></a><span id="comm_word_2">：</span><span id="own_cmt_2" name="own_cmt_2">'+ commPhoto_tmp[0].cmt_4 +'</span>';
		document.getElementById("note_list_4").innerHTML = str4;
	}
	
	
	//回應6小圖
	document.getElementById("comm_src_1").src = commPhoto_tmp[0].imgsrc;
	document.getElementById("comm_src_2").src = commPhoto_tmp[1].imgsrc;
	document.getElementById("comm_src_3").src = commPhoto_tmp[2].imgsrc;
	document.getElementById("comm_src_4").src = commPhoto_tmp[3].imgsrc;
	document.getElementById("comm_src_5").src = commPhoto_tmp[4].imgsrc;
	document.getElementById("comm_src_6").src = commPhoto_tmp[5].imgsrc;
	
	document.getElementById("comm_href_1").href = commPhoto_tmp[0].imglink;
	document.getElementById("comm_href_2").href = commPhoto_tmp[1].imglink;
	document.getElementById("comm_href_3").href = commPhoto_tmp[2].imglink;
	document.getElementById("comm_href_4").href = commPhoto_tmp[3].imglink;
	document.getElementById("comm_href_5").href = commPhoto_tmp[4].imglink;
	document.getElementById("comm_href_6").href = commPhoto_tmp[5].imglink;
	*/
	
	//相冊分享家
	var niceUser_tmp_1 = Array();
	niceUser_tmp_1 = NiceUser.copy();
	niceUser_tmp = randomPhoto(niceUser_tmp_1,4);
	document.getElementById("nicephoto1").src = niceUser_tmp[0].imgsrc;
	document.getElementById("nicephoto2").src = niceUser_tmp[1].imgsrc;
	document.getElementById("nicephoto3").src = niceUser_tmp[2].imgsrc;
	document.getElementById("nicephoto4").src = niceUser_tmp[3].imgsrc;
	
	if(niceUser_tmp[0].user_sexy == 'M'){
		document.getElementById("nicephotosexy1").src = 'http://img.i-part.com.tw/images/ifile/b.gif';
	} else {
		document.getElementById("nicephotosexy1").src = 'http://img.i-part.com.tw/images/ifile/g.gif';
	}
	if(niceUser_tmp[1].user_sexy == 'M'){
		document.getElementById("nicephotosexy2").src = 'http://img.i-part.com.tw/images/ifile/b.gif';
	} else {
		document.getElementById("nicephotosexy2").src = 'http://img.i-part.com.tw/images/ifile/g.gif';
	}
	if(niceUser_tmp[2].user_sexy == 'M'){
		document.getElementById("nicephotosexy3").src = 'http://img.i-part.com.tw/images/ifile/b.gif';
	} else {
		document.getElementById("nicephotosexy3").src = 'http://img.i-part.com.tw/images/ifile/g.gif';
	}
	if(niceUser_tmp[2].user_sexy == 'M'){
		document.getElementById("nicephotosexy4").src = 'http://img.i-part.com.tw/images/ifile/b.gif';
	} else {
		document.getElementById("nicephotosexy4").src = 'http://img.i-part.com.tw/images/ifile/g.gif';
	}
	
	document.getElementById("nicephoto_href_1").href = niceUser_tmp[0].imglink;
	document.getElementById("nicephoto_href_2").href = niceUser_tmp[1].imglink;
	document.getElementById("nicephoto_href_3").href = niceUser_tmp[2].imglink;
	document.getElementById("nicephoto_href_4").href = niceUser_tmp[3].imglink;
	
	document.getElementById("niceusernick_1").innerHTML = niceUser_tmp[0].user_nick;
	document.getElementById("niceusernick_2").innerHTML = niceUser_tmp[1].user_nick;
	document.getElementById("niceusernick_3").innerHTML = niceUser_tmp[2].user_nick;
	document.getElementById("niceusernick_4").innerHTML = niceUser_tmp[3].user_nick;
	
	document.getElementById("niceuserlink_1").href = niceUser_tmp[0].user_link;
	document.getElementById("niceuserlink_2").href = niceUser_tmp[1].user_link;
	document.getElementById("niceuserlink_3").href = niceUser_tmp[2].user_link;
	document.getElementById("niceuserlink_4").href = niceUser_tmp[3].user_link;
	
	document.getElementById("nicetitle_1").innerHTML = niceUser_tmp[0].title;
	document.getElementById("nicetitle_2").innerHTML = niceUser_tmp[1].title;
	document.getElementById("nicetitle_3").innerHTML = niceUser_tmp[2].title;
	document.getElementById("nicetitle_4").innerHTML = niceUser_tmp[3].title;
	
	document.getElementById("nicedesc_1").innerHTML = niceUser_tmp[0].desc;
	document.getElementById("nicedesc_2").innerHTML = niceUser_tmp[1].desc;
	document.getElementById("nicedesc_3").innerHTML = niceUser_tmp[2].desc;
	document.getElementById("nicedesc_4").innerHTML = niceUser_tmp[3].desc;
	
	document.getElementById("nicenew11").src = niceUser_tmp[0].pic_1_src;
	document.getElementById("nicenew12").src = niceUser_tmp[0].pic_2_src;
	document.getElementById("nicenew13").src = niceUser_tmp[0].pic_3_src;
	document.getElementById("nicenew21").src = niceUser_tmp[1].pic_1_src;
	document.getElementById("nicenew22").src = niceUser_tmp[1].pic_2_src;
	document.getElementById("nicenew23").src = niceUser_tmp[1].pic_3_src;
	document.getElementById("nicenew31").src = niceUser_tmp[2].pic_1_src;
	document.getElementById("nicenew32").src = niceUser_tmp[2].pic_2_src;
	document.getElementById("nicenew33").src = niceUser_tmp[2].pic_3_src;
	document.getElementById("nicenew41").src = niceUser_tmp[3].pic_1_src;
	document.getElementById("nicenew42").src = niceUser_tmp[3].pic_2_src;
	document.getElementById("nicenew43").src = niceUser_tmp[3].pic_3_src;
	
	document.getElementById("nicenewlink11").href = niceUser_tmp[0].pic_1_link;
	document.getElementById("nicenewlink12").href = niceUser_tmp[0].pic_2_link;
	document.getElementById("nicenewlink13").href = niceUser_tmp[0].pic_3_link;
	document.getElementById("nicenewlink21").href = niceUser_tmp[1].pic_1_link;
	document.getElementById("nicenewlink22").href = niceUser_tmp[1].pic_2_link;
	document.getElementById("nicenewlink23").href = niceUser_tmp[1].pic_3_link;
	document.getElementById("nicenewlink31").href = niceUser_tmp[2].pic_1_link;
	document.getElementById("nicenewlink32").href = niceUser_tmp[2].pic_2_link;
	document.getElementById("nicenewlink33").href = niceUser_tmp[2].pic_3_link;
	document.getElementById("nicenewlink41").href = niceUser_tmp[3].pic_1_link;
	document.getElementById("nicenewlink42").href = niceUser_tmp[3].pic_2_link;
	document.getElementById("nicenewlink43").href = niceUser_tmp[3].pic_3_link;
	
	//最新瀏覽排行
	//var viewPhoto_tmp_1 = Array();
	//viewPhoto_tmp_1 = viewPhoto.copy();
	/* 100813
	document.getElementById("viewphoto1").src = viewPhoto[0].imgsrc;
	document.getElementById("viewphoto2").src = viewPhoto[1].imgsrc;
	document.getElementById("viewphoto3").src = viewPhoto[2].imgsrc;
	document.getElementById("viewphoto4").src = viewPhoto[3].imgsrc;
	
	document.getElementById("viewphotoLink1").href = viewPhoto[0].imglink;
	document.getElementById("viewphotoLink2").href = viewPhoto[1].imglink;
	document.getElementById("viewphotoLink3").href = viewPhoto[2].imglink;
	document.getElementById("viewphotoLink4").href = viewPhoto[3].imglink;
	*/
	
	//
	////最新瀏覽排行
	//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='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=8&f=http://photo.i-part.com.tw'+URLEncode(viewPhoto[0].imglink);
	//document.getElementById("viewHTTP2").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=8&f=http://photo.i-part.com.tw'+URLEncode(viewPhoto[1].imglink);
	//document.getElementById("viewHTTP3").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=8&f=http://photo.i-part.com.tw'+URLEncode(viewPhoto[2].imglink);
	//
	//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://www.i-part.com.tw/file/file_viewfile.php?u=" + viewPhoto[0].user_no;
	//document.getElementById("userhomeHTTP2").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + viewPhoto[1].user_no;
	//document.getElementById("userhomeHTTP3").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + viewPhoto[2].user_no;
	//
	//if(viewPhoto[0].user_sexy == "F"){
	//	document.getElementById("viewSexy1").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("viewSexy1").src="http://img.i-part.com.tw/images/ifile/b.gif";
	//}
	//if(viewPhoto[1].user_sexy == "F"){
	//	document.getElementById("viewSexy2").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("viewSexy2").src="http://img.i-part.com.tw/images/ifile/b.gif";
	//}
	//if(viewPhoto[2].user_sexy == "F"){
	//	document.getElementById("viewSexy3").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("viewSexy3").src="http://img.i-part.com.tw/images/ifile/b.gif";
	//}
	//
	//document.getElementById("listmore").href="photo_viewlist.php?type=view";
	//
	////地區相冊
	//var hotPhoto_tmp_1 = Array();
	//hotPhoto_tmp_1 = areaPhoto.copy();
	//hotPhoto_tmp = randomPhoto(hotPhoto_tmp_1,7);
	//
	//document.getElementById("areafrom0").innerHTML=userFrom[hotPhoto_tmp[0].user_from_a];
	//document.getElementById("areafrom1").innerHTML=userFrom[hotPhoto_tmp[1].user_from_a];
	//document.getElementById("areafrom2").innerHTML=userFrom[hotPhoto_tmp[2].user_from_a];
	//document.getElementById("areafrom3").innerHTML=userFrom[hotPhoto_tmp[3].user_from_a];
	//document.getElementById("areafrom4").innerHTML=userFrom[hotPhoto_tmp[4].user_from_a];
	//
	//document.getElementById("areaHTTP0").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=7&f='+URLEncode(hotPhoto_tmp[0].album_link);
	//document.getElementById("areaHTTP1").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=7&f='+URLEncode(hotPhoto_tmp[1].album_link);
	//document.getElementById("areaHTTP2").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=7&f='+URLEncode(hotPhoto_tmp[2].album_link);
	//document.getElementById("areaHTTP3").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=7&f='+URLEncode(hotPhoto_tmp[3].album_link);
	//document.getElementById("areaHTTP4").href='http://photo.i-part.com.tw/photo_ad/photo_click.php?id=7&f='+URLEncode(hotPhoto_tmp[4].album_link);
	//
	//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://www.i-part.com.tw/file/file_viewfile.php?u=" + hotPhoto_tmp[0].user_no;
	//document.getElementById("areauserhome1").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + hotPhoto_tmp[1].user_no;
	//document.getElementById("areauserhome2").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + hotPhoto_tmp[2].user_no;
	//document.getElementById("areauserhome3").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + hotPhoto_tmp[3].user_no;
	//document.getElementById("areauserhome4").href="http://www.i-part.com.tw/file/file_viewfile.php?u=" + hotPhoto_tmp[4].user_no;
	//
	//if(hotPhoto_tmp[0].user_sexy == "F"){
	//	document.getElementById("areasexy0").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("areasexy0").src="http://img.i-part.com.tw/images/ifile/b.gif";
	//}
	//if(hotPhoto_tmp[1].user_sexy == "F"){
	//	document.getElementById("areasexy1").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("areasexy1").src="http://img.i-part.com.tw/images/ifile/b.gif";
	//}
	//if(hotPhoto_tmp[2].user_sexy == "F"){
	//	document.getElementById("areasexy2").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("areasexy2").src="http://img.i-part.com.tw/images/ifile/b.gif";
	//}
	//if(hotPhoto_tmp[3].user_sexy == "F"){
	//	document.getElementById("areasexy3").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("areasexy3").src="http://img.i-part.com.tw/images/ifile/b.gif";
	//}
	//if(hotPhoto_tmp[4].user_sexy == "F"){
	//	document.getElementById("areasexy4").src="http://img.i-part.com.tw/images/ifile/g.gif";
	//} else {
	//	document.getElementById("areasexy4").src="http://img.i-part.com.tw/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;
	//
	////相冊主題
	//loadPhotoSubjectIndex(0);
	//document.getElementById("subjectmore").href="subjecthistory.php";
}

function loadPhotoSubjectIndex(goType){
	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;
		}
				
		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 href="tag_save.php?content=' + encodeURI(searchTagShow[0].word) + '">' + searchTagShow[0].word + '</a>&nbsp;&nbsp;');
	$("#searchTag1").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[1].word) + '">' + searchTagShow[1].word + '</a>&nbsp;&nbsp;');
	$("#searchTag2").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[2].word) + '">' + searchTagShow[2].word + '</a>&nbsp;&nbsp;');
	$("#searchTag3").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[3].word) + '">' + searchTagShow[3].word + '</a>&nbsp;&nbsp;');
	$("#searchTag4").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[4].word) + '">' + searchTagShow[4].word + '</a>&nbsp;&nbsp;');
	$("#searchTag5").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[5].word) + '">' + searchTagShow[5].word + '</a>&nbsp;&nbsp;');
	$("#searchTag6").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[6].word) + '">' + searchTagShow[6].word + '</a>&nbsp;&nbsp;');
	$("#searchTag7").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[7].word) + '">' + searchTagShow[7].word + '</a>&nbsp;&nbsp;');
	$("#searchTag8").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[8].word) + '">' + searchTagShow[8].word + '</a>&nbsp;&nbsp;');
	$("#searchTag9").html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[9].word) + '">' + searchTagShow[9].word + '</a>&nbsp;&nbsp;');
}

function timeSearchTag(){
	searchTagFlag = setTimeout("timeSearchTag()",5000);
	changeSearchTag();
}
var act_no=1;
function changeSearchTag(){
	if(searchTag_tmp.length > 0){
		searchTagShow = randomPhoto(searchTag_tmp,1);
		//alert(searchTag_tmp.length);
		//$("searchTag3").after("<b>Hello</b>");
		
		//$("#searchTag"+kk).fadeOut("slow");
		//$("#searchTag"+kk).html(searchTagShow[0].word);
		
		//$("searchTag1").before( $("#searchTag4").html(searchTagShow[0].word) );
		//$("#searchTag1").before( $("#searchTag4")[0] );
		//$("#searchTag3").html("<b>Hello</b>");
		//$("p").insertAfter("#foo");
		//$("searchTag2").insertAfter("#foo");
		//kk++;
		//$("#searchTag4").html($("#searchTag3")[0]);
		//$("#searchTag1").html()
		//$("#searchTag1").html()
		//$("#searchTag1").html(searchTagShow[0].word) );
		act_no = (act_no+9)%10;
		move_no = (act_no+9)%10;
		$("#searchTag"+move_no).html('<a href="tag_save.php?content=' + encodeURI(searchTagShow[0].word) + '">' + searchTagShow[0].word + '</a>&nbsp;&nbsp;');
		//$("#searchTag"+move_no).html('<a href="tag_save.php?content=' + (searchTagShow[0].word) + '">' + searchTagShow[0].word + '</a>');
		$("#searchTag"+act_no).before($("#searchTag"+move_no));
		
		//alert(act_no + "__" + 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 href="tag_save.php?content=' + encodeURI(searchTagShow[0].word) + '">' + searchTagShow[0].word + '</a>&nbsp;&nbsp;');
		$("#searchTag"+act_no).before($("#searchTag"+move_no));
	}
}

function change_css(OBJ_NAME){
	if(document.getElementById(OBJ_NAME).value =='輸入搜尋關鍵字'){
		document.getElementById(OBJ_NAME).value = "";
		document.getElementById(OBJ_NAME).style.color = "#000000";
	}
}
function URLEncode (clearString) {
  var output = '';
  var x = 0;
  clearString = clearString.toString();
  var regex = /(^[a-zA-Z0-9_.]*)/;
  while (x < clearString.length) {
    var match = regex.exec(clearString.substr(x));
    if (match != null && match.length > 1 && match[1] != '') {
    	output += match[1];
      x += match[1].length;
    } else {
      if (clearString[x] == ' ')
        output += '+';
      else {
        var charCode = clearString.charCodeAt(x);
        var hexVal = charCode.toString(16);
        output += '%' + ( hexVal.length < 2 ? '0' : '' ) + hexVal.toUpperCase();
      }
      x++;
    }
  }
  return output;
}
