// JavaScript Document
fileTabMenu="module/ajax_tabIndexMenu.php";
function $(id){return document.getElementById(id);};
function $name(name){return document.getElementsByName(name);};
function getWindowSizeAll(a){var myWidth=0,myHeight=0;if(typeof(window.innerWidth)=='number'){scrollSize=16;myWidth=(a)?window.innerWidth:window.screen.width;myHeight=(a)?window.innerHeight:document.body.parentNode.scrollHeight;}else if(document.documentElement&&(document.documentElement.clientWidth||document.documentElement.clientHeight)){myWidth=(a)?document.documentElement.clientWidth:document.body.offsetWidth;myHeight=(a)?document.documentElement.clientHeight:document.body.parentNode.scrollHeight;scrollSize=2;}else if(document.body&&(document.body.clientWidth||document.body.clientHeight)){myWidth=(a)?document.body.clientWidth:document.body.offsetWidth;myHeight=(a)?document.body.clientHeight:document.body.offsetHeight;scrollSize=2;}return[myWidth-scrollSize,myHeight];}
function getScrollXY(){var scrOfX=0,scrOfY=0;if(typeof(window.pageYOffset)=='number'){scrOfY=window.pageYOffset;scrOfX= window.pageXOffset;}else if(document.body&&(document.body.scrollLeft||document.body.scrollTop)){scrOfY=document.body.scrollTop;scrOfX=document.body.scrollLeft;}else if(document.documentElement&&(document.documentElement.scrollLeft||document.documentElement.scrollTop)){scrOfY=document.documentElement.scrollTop;scrOfX=document.documentElement.scrollLeft;}return[scrOfX,scrOfY];}
function setCenter(id){$(id).style.left=((getWindowSizeAll(true)[0]-$(id).offsetWidth)/2+getScrollXY()[0])+"px";$(id).style.top=((getWindowSizeAll(true)[1]-$(id).offsetHeight)/2+getScrollXY()[1])+"px";};
function $value(node,name){try{return node.getElementsByTagName(name)[0].firstChild.nodeValue;}catch(e){return "";}}
function spacialTag(txt){txt=txt.replace(/>/g,'&gt;');txt=txt.replace(/</g,'&lt;');return txt;}
function spacialChar(txt){
	//txt=txt.replace(/\u000a|\u000d/g,"<br>");
	//txt=txt.replace(/\u0026/g,"&");
	//txt=txt.replace(/\\'/g,"'");
	
	txt = txt.replace(/\\u000a/g,"<br>");
	txt = txt.replace(/\\u003c/g,"<");
	txt = txt.replace(/\\u003e/g,">");
	txt = txt.replace(/\\u0026/g,"&");
	txt = txt.replace(/\\u000d/g,"");
	txt = txt.replace(/\\u0009/g," ");
	txt = txt.replace(/\\/g,"");
	return txt;
}
function strip_tags(html){
		//PROCESS STRING
	if(arguments.length < 3) {
		html=html.replace(/<\/?(?!\!)[^>]*>/gi, '');
	} else {
		var allowed = arguments[1];
		var specified = eval("["+arguments[2]+"]");
		if(allowed){
			var regex='</?(?!(' + specified.join('|') + '))\b[^>]*>';
			html=html.replace(new RegExp(regex, 'gi'), '');
		} else{
			var regex='</?(' + specified.join('|') + ')\b[^>]*>';
			html=html.replace(new RegExp(regex, 'gi'), '');
		}
	}

	//CHANGE NAME TO CLEAN JUST BECAUSE 
	var clean_string = html;

	//RETURN THE CLEAN STRING
	return clean_string;
}

function pagecutTab(rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID){	
//alert("rowPerPage"+rowPerPage);alert("allPage"+allPage);alert("thisPage"+thisPage);alert("pagePerGroup"+pagePerGroup);alert("typePage"+typePage);alert("linkPage"+linkPage);alert("box"+box);alert("catID"+catID);alert("subCatID"+subCatID);
	$(box).innerHTML="";
	//var pagePerGroup=10;
	var thisGroup=Math.ceil(thisPage/pagePerGroup);
	var allGroup=Math.ceil(allPage/pagePerGroup);
	var pages="";
	//alert (thisPage);
	if(thisGroup>1&&allGroup>1){
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" onclick=\"pagecutTab("+rowPerPage+","+allPage+",1,'"+pagePerGroup+"','"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"');\" style=\"cursor:pointer;\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt((thisGroup-2)*pagePerGroup+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"')\" style=\"cursor:pointer;\" />&nbsp;&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" />&nbsp;&nbsp;";
	}
	for(i=1;(i<=pagePerGroup)&&(i+pagePerGroup*(thisGroup-1)<=allPage);i++){
		if(i+pagePerGroup*(thisGroup-1)==thisPage){
			pages+="<font id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" style=\"font-weight:bold; color:#3399FF;\">"+(i+pagePerGroup*(thisGroup-1))+"</font>&nbsp;&nbsp;";
		}else{
			var limit=(((i+pagePerGroup*(thisGroup-1))-1)*rowPerPage)+","+rowPerPage;
			pages+="<a href=\"javascript:void(0);\" id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt(i+pagePerGroup*(thisGroup-1))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"')\">"+(i+pagePerGroup*(thisGroup-1))+"</a>&nbsp;&nbsp;";
		}
	}
	if(thisGroup<allGroup&&allGroup>1){
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt(parseInt(thisPage)+parseInt(5))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"')\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt((allPage-pagePerGroup)+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"')\" />&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" />";
	}/**/
	$(box).innerHTML=pages;
	if(typePage=='gall-index'){	cp.call(fileTabMenu,'changePageRecentGallery',resTabIndexGallery,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID);	}
	else if(typePage=='vdo-index'){	cp.call(fileTabMenu,'changePageRecentVideo',resTabIndexVideo,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID);	}
	else if(typePage=='web-index'){ cp.call(fileTabMenu,'changePageRecentWebboard',resTabWebboard,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID);	} 
	else if(typePage=='acd-index'){ cp.call(fileTabMenu,'changePageRecentAccident',resTabAccident,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID);	} 
	else if(typePage=='spon-index'){ cp.call(fileTabMenu,'changePageRecentSponsor',resTabSponsor,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID);	} 
}
function pagecutTabLang(rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID,whereCat){	
//alert("rowPerPage"+rowPerPage);alert("allPage"+allPage);alert("thisPage"+thisPage);alert("pagePerGroup"+pagePerGroup);alert("typePage"+typePage);alert("linkPage"+linkPage);alert("box"+box);alert("catID"+catID);alert("subCatID"+subCatID);
	$(box).innerHTML="";
	//var pagePerGroup=10;
	var thisGroup=Math.ceil(thisPage/pagePerGroup);
	var allGroup=Math.ceil(allPage/pagePerGroup);
	var pages="";
	//alert (thisPage);
	if(thisGroup>1&&allGroup>1){
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" onclick=\"pagecutTabLang("+rowPerPage+","+allPage+",1,'"+pagePerGroup+"','"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"','"+whereCat+"');\" style=\"cursor:pointer;\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt((thisGroup-2)*pagePerGroup+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"','"+whereCat+"')\" style=\"cursor:pointer;\" />&nbsp;&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" />&nbsp;&nbsp;";
	}
	for(i=1;(i<=pagePerGroup)&&(i+pagePerGroup*(thisGroup-1)<=allPage);i++){
		if(i+pagePerGroup*(thisGroup-1)==thisPage){
			pages+="<font id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" style=\"font-weight:bold; color:#3399FF;\">"+(i+pagePerGroup*(thisGroup-1))+"</font>&nbsp;&nbsp;";
		}else{
			var limit=(((i+pagePerGroup*(thisGroup-1))-1)*rowPerPage)+","+rowPerPage;
			pages+="<a href=\"javascript:void(0);\" id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt(i+pagePerGroup*(thisGroup-1))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"','"+whereCat+"')\">"+(i+pagePerGroup*(thisGroup-1))+"</a>&nbsp;&nbsp;";
		}
	}
	if(thisGroup<allGroup&&allGroup>1){
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt(parseInt(thisPage)+parseInt(5))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"','"+whereCat+"')\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt((allPage-pagePerGroup)+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"','"+whereCat+"')\" />&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" />";
	}/**/
	$(box).innerHTML=pages;
	cp.call(fileTabMenu,'changePageRecentSponsorLang',resTabSponsor,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,subCatID,whereCat);
}

// ----------------------------------- Tab Member ----------------------------------------//
function changeTabMember(tab,user){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){
		document.getElementById('mem1Tab').className='current';
		document.getElementById('mem2Tab').className='modernbricksmenu';
		document.getElementById('mem3Tab').className='modernbricksmenu';
		document.getElementById('mem4Tab').className='modernbricksmenu';
		document.getElementById('mem5Tab').className='modernbricksmenu';
		document.getElementById('mem6Tab').className='modernbricksmenu';	
		document.getElementById('mem7Tab').className='modernbricksmenu';	
		document.getElementById('mem8Tab').className='modernbricksmenu';	
	}else if(tab==2){
		document.getElementById('mem1Tab').className='modernbricksmenu';
		document.getElementById('mem2Tab').className='current';
		document.getElementById('mem3Tab').className='modernbricksmenu';
		document.getElementById('mem4Tab').className='modernbricksmenu';
		document.getElementById('mem5Tab').className='modernbricksmenu';
		document.getElementById('mem6Tab').className='modernbricksmenu';	
		document.getElementById('mem7Tab').className='modernbricksmenu';	
		document.getElementById('mem8Tab').className='modernbricksmenu';	
	}
	else if(tab==3){
		document.getElementById('mem1Tab').className='modernbricksmenu';
		document.getElementById('mem2Tab').className='modernbricksmenu';
		document.getElementById('mem3Tab').className='current';
		document.getElementById('mem4Tab').className='modernbricksmenu';
		document.getElementById('mem5Tab').className='modernbricksmenu';
		document.getElementById('mem6Tab').className='modernbricksmenu';	
		document.getElementById('mem7Tab').className='modernbricksmenu';	
		document.getElementById('mem8Tab').className='modernbricksmenu';	
	}
	else if(tab==4){
		document.getElementById('mem1Tab').className='modernbricksmenu';
		document.getElementById('mem2Tab').className='modernbricksmenu';
		document.getElementById('mem3Tab').className='modernbricksmenu';
		document.getElementById('mem4Tab').className='current';
		document.getElementById('mem5Tab').className='modernbricksmenu';
		document.getElementById('mem6Tab').className='modernbricksmenu';
		document.getElementById('mem7Tab').className='modernbricksmenu';	
		document.getElementById('mem8Tab').className='modernbricksmenu';	
			
	}
	else if(tab==5){
		document.getElementById('mem1Tab').className='modernbricksmenu';
		document.getElementById('mem2Tab').className='modernbricksmenu';
		document.getElementById('mem3Tab').className='modernbricksmenu';
		document.getElementById('mem4Tab').className='modernbricksmenu';
		document.getElementById('mem5Tab').className='current';
		document.getElementById('mem6Tab').className='modernbricksmenu';	
		document.getElementById('mem7Tab').className='modernbricksmenu';	
		document.getElementById('mem8Tab').className='modernbricksmenu';	
		
	}
	else if(tab==6){
		document.getElementById('mem1Tab').className='modernbricksmenu';
		document.getElementById('mem2Tab').className='modernbricksmenu';
		document.getElementById('mem3Tab').className='modernbricksmenu';
		document.getElementById('mem4Tab').className='modernbricksmenu';
		document.getElementById('mem5Tab').className='modernbricksmenu';
		document.getElementById('mem6Tab').className='current';	
		document.getElementById('mem7Tab').className='modernbricksmenu';	
		document.getElementById('mem8Tab').className='modernbricksmenu';	
		
	}
	else if(tab==7){
		document.getElementById('mem1Tab').className='modernbricksmenu';
		document.getElementById('mem2Tab').className='modernbricksmenu';
		document.getElementById('mem3Tab').className='modernbricksmenu';
		document.getElementById('mem4Tab').className='modernbricksmenu';
		document.getElementById('mem5Tab').className='modernbricksmenu';
		document.getElementById('mem6Tab').className='modernbricksmenu';	
		document.getElementById('mem7Tab').className='current';	
		document.getElementById('mem8Tab').className='modernbricksmenu';	
		
	}
	else if(tab==8){
		document.getElementById('mem1Tab').className='modernbricksmenu';
		document.getElementById('mem2Tab').className='modernbricksmenu';
		document.getElementById('mem3Tab').className='modernbricksmenu';
		document.getElementById('mem4Tab').className='modernbricksmenu';
		document.getElementById('mem5Tab').className='modernbricksmenu';
		document.getElementById('mem6Tab').className='modernbricksmenu';	
		document.getElementById('mem7Tab').className='modernbricksmenu';	
		document.getElementById('mem8Tab').className='current';	
		
	}
	cp.call(fileTabMenu,'changeTabMember',resTabMember,tab,user);
}
/*function resTabMember(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	
	var tabHTML ="";
		if(numTab==1){
		var memberID=tab.getElementsByTagName('memberID')[0];
		var id=$value(memberID,'id');
		var myDetail=$value(memberID,'myDetail');
		var owner=$value(memberID,'owner');
		//alert (myDetail);
		tabHTML+="<span class=\"floatRight\">";
			if(owner=="true"&&myDetail!="")){
				tabHTML+="<a href=\"javascript:void(0)\" onClick=\"showBoxDetail("+id+")\">"+$('lang_edit').value+"</a>";
			}
			if($owner=="true"&&myDetail==""){
				tabHTML+="<a href=\"javascript:void(0)\" onClick=\"showBoxDetail("+id+")\">"+$('lang_add').value+"</a>";
			}
		tabHTML+="</span>";
		tabHTML+="<span class=\"txtHDetail\" id=\"boxStatusDetail"+id+"\">"+myDetail+"</span>";
		tabHTML+="<div class=\"txtHDetail\" id=\"boxDetailMember"+id+"\" style=\"display:none;\">
			tabHTML+="<textarea name="detail" cols="89" rows="20" class="detailBox" id="detail" ><?=$myDetail?></textarea>
			tabHTML+="<span><a href="javascript:void(0)" onClick="manageDetail('save',<?=$user?>)"><?=$lang_save?></a></span>&nbsp;&nbsp;|&nbsp;
			tabHTML+="<span><a href="javascript:void(0)" onClick="manageDetail('cancel',<?=$user?>)"><?=$lang_cancel?></a></span>&nbsp;&nbsp;|&nbsp;
			tabHTML+="<span><a href="javascript:void(0)" onClick="manageDetail('clear',<?=$user?>)"><?=$lang_clear?></a></span>
			<!--<input name="b1" type="button" value="Cancel">-->
		tabHTML+="</div>
	   	tabHTML+="<div class="clear"></div>


		}
var memberID=tab.getElementsByTagName('memberID');
	for(var i=0;i<videoID.length;i++){
		
		var id=$value(videoID[i],'id');
		var videoName=spacialChar($value(videoID[i],'videoName'));
		var videoImg=$value(videoID[i],'videoImg');
	
		tabHTML+="<div class=\"blog-tex-imgvi-gal\">";
			tabHTML+="<div class=\"imgvi-gal\">";
				tabHTML+="<a href=\"detail_clip.php?clipID="+id+">";
					tabHTML+="<div class=\"imgvi-gal\"><img src=\""+videoImg+"\"/></div>";
					tabHTML+="<div class=\"PartfloatLefttN\"><center> "+videoName+"</center></div>";
				tabHTML+="</a>";
			tabHTML+="</div>";
		tabHTML+="</div>";
	}
		 
	$('mainMember').innerHTML=tabHTML;
	
}*/

// ----------------------------------- Tab Video ----------------------------------------//
function changeTabVideo(tab,goto,catID,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){
		document.getElementById('video1Tab').className='current';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
		$('page-index-vdo').innerHTML="";
	}else if(tab==2){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='current';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
		$('page-index-vdo').innerHTML="";
	}
	else if(tab==3){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='current';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
		pagecutTab(rowPerPage,allPage,1,pagePerGroup,typePage,linkPage,box,"","");
	}
	else if(tab==4){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='current';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
		$('page-index-vdo').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='current';
		document.getElementById('video6Tab').className='modernbricksmenu';	
		$('page-index-vdo').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='current';	
		$('page-index-vdo').innerHTML="";
	}

	//if(goto=='main'){	cp.call(fileTabMenu,'changeTabVideo',resTabVideo,tab);	}
	//else if(goto=='index'){	cp.call(fileTabMenu,'changeTabIndexVideo',resTabIndexVideo,tab,catID);	}
	cp.call(fileTabMenu,'changeTabIndexVideo',resTabIndexVideo,tab,catID);
}
function changeTabVideoMain(tab,goto){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){
		document.getElementById('video1Tab').className='current';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
	}else if(tab==2){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='current';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
	}
	else if(tab==3){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='current';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
	}
	else if(tab==4){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='current';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='modernbricksmenu';	
	}
	else if(tab==5){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='current';
		document.getElementById('video6Tab').className='modernbricksmenu';	
	}
	else if(tab==6){
		document.getElementById('video1Tab').className='modernbricksmenu';
		document.getElementById('video2Tab').className='modernbricksmenu';
		document.getElementById('video3Tab').className='modernbricksmenu';
		document.getElementById('video4Tab').className='modernbricksmenu';
		document.getElementById('video5Tab').className='modernbricksmenu';
		document.getElementById('video6Tab').className='current';	
	}

	//if(goto=='main'){	cp.call(fileTabMenu,'changeTabVideo',resTabVideo,tab);	}
	//else if(goto=='index'){	cp.call(fileTabMenu,'changeTabIndexVideo',resTabIndexVideo,tab,catID);	}
	cp.call(fileTabMenu,'changeTabVideo',resTabVideo,tab);

}
function resTabVideo(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var videoID=tab.getElementsByTagName('videoID');

	
	var tabHTML ="";
//
	for(var i=0;i<videoID.length;i++){
		
		var id=$value(videoID[i],'id');
		var videoName=spacialChar($value(videoID[i],'videoName'));
		var videoImg=$value(videoID[i],'videoImg');
		
		var cutName=videoName.substring(0,20);
		//alert (name);
			/*tabHTML+="<div class=\"blog-tex-imgvi-gal\">";
			tabHTML+="<a href=\"detail_clip.php?clipID="+id+">";
			tabHTML+="<div class=\"imgvi-gal\"><img src=\""+videoImg+"\"/></div>";
			tabHTML+="<div class=\"PartfloatLefttN\"><center>"+videoName+"</center></div>";
			tabHTML+="</a>";
		tabHTML+="</div>";*/
		tabHTML+="<div class=\"blog-tex-imgvi-gal\">";
			tabHTML+="<div class=\"imgvi-gal\">";
				//tabHTML+="<a href=\"detail_clip.php?clipID="+id+"\" >"; <a href=\"detail_clip.php?clipID="+id+"\" target=\"_blank\" >
				tabHTML+="<a href=\"detail_clip.php?clipID="+id+"\>";
					tabHTML+="<div class=\"imgvi-gal\"><img src=\""+videoImg+"\"/></div>";
					tabHTML+="</a>";
					//tabHTML+="<div class=\"txt_li\">";
					tabHTML+="<div class=\"PartfloatLefttN\">";
					tabHTML+="<a href=\"detail_clip.php?clipID="+id+"\" />";
					tabHTML+="<center>"+cutName+"</center>";
					//tabHTML+="<div class=\"PartfloatLefttN\"><center>"+cutName+"</center></div>";
					tabHTML+="</a>";
					tabHTML+="</div>";
				
			tabHTML+="</div>";
		tabHTML+="</div>";
	}
		 
	$('boxTabVideo').innerHTML=tabHTML;
	
}
function resTabIndexVideo(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var videoID=tab.getElementsByTagName('videoID');

	var tabHTML ="";
//
	for(var i=0;i<videoID.length;i++){
		
		var id=$value(videoID[i],'id');
		var videoName=spacialChar($value(videoID[i],'videoName'));
		var videoDetail=strip_tags(spacialChar($value(videoID[i],'videoDetail')));
		var videoImg=$value(videoID[i],'videoImg');
		var videoVote=$value(videoID[i],'videoVote');
		var videoView=$value(videoID[i],'videoView');
		var videoCM=$value(videoID[i],'videoCM');
		var videoDate=$value(videoID[i],'update');
		var member=$value(videoID[i],'member');
		var memberID=$value(videoID[i],'memberID');
		
		//videoName.substring(0,20);
	
		tabHTML+="<div class=\"Pastcontent-webboard2\">";
            /*tabHTML+="<div class=\"Vote2New\">";
                tabHTML+="<div class=\"imgVote\">";
                    tabHTML+="<input type=\"submit\" id=\"bt-index-vdo_"+id+"\" value=\""+videoVote+"\" class=\"btClassV\" style=\"vertical-align:top;\" onclick=\"upVoteVideo('bt-index-vdo_"+id+"','"+id+"')\" />";
                tabHTML+="</div>";
                tabHTML+="<div class=\"TxtVoteN\"><b href=\"javascript:void(0)\" onclick=\"upVoteVideo('bt-index-vdo_"+id+"','"+id+"')\">"+$('lang_vote').value+"</b></div>";
            tabHTML+="</div>";
			//tabHTML+="<a href=\"detail_clip.php?clipID="+id+"\">";*/
				tabHTML+="<div class=\"picRightN\">";
					tabHTML+="<div class=\"imgsize\"><b><a href=\"detail_clip.php?clipID="+id+"\"><img src=\""+videoImg+"\" width=\"80\" height=\"80\"></a></b></div>";
				tabHTML+="</div>";
				tabHTML+="<div class=\"TitleNVi\">";
					tabHTML+="<a href=\"detail_clip.php?clipID="+id+"\" >"+videoName+"</a>";
				tabHTML+="</div>";
				tabHTML+="<div class=\"TextBoardN\">";
					tabHTML+="<b1><a href=\"detail_clip.php?clipID="+id+"\" >"+videoDetail+"</a></b1>";
				tabHTML+="</div>";  
			//tabHTML+="</a>";
            tabHTML+="<div class=\"TextBoard-footerVi\">";
			tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
			tabHTML+=""+$('lang_view').value+" : "+videoView+"&nbsp;";
			tabHTML+=""+$('lang_comment').value+" : "+videoCM+"&nbsp;"; 
			tabHTML+=""+$('lang_date').value+" :"+videoDate+"";
            tabHTML+="<b><a href=\"javascript:void(0);\" title=\""+$('lang_shareFacebook').value+"\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"detail_clip.php?clipID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            	tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareTwitter').value+"\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"detail_clip.php?clipID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
				tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
            tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"detail_clip.php?clipID="+id+"')\">";
            	tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b> ";   
            //tabHTML+=""+$('lang_view').value+" : "+videoView+"</div>";
			//tabHTML+="<b>Date : "+update+"&nbsp;</b>";
			//tabHTML+="<b>"+$('lang_date').value+" :"+videoDate+"</b>";
			tabHTML+="</div>";
        tabHTML+="</div>";
	}
		 
	$('boxTabIndexVideo').innerHTML=tabHTML;
	
}

function changeRightVideo(tab,current,type){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(type=='black'){ cClick="btAJClickVi"; cNoClick="btAJClassVi";	}
	else if(type=='white'){ cClick="btAJClick"; cNoClick="btAJClass";	}

	if(tab=='a'){	//lang_tabRecentReply
		b1=$('lang_tabRecentReply').value;			class1=cClick;			onclick1="changeRightVideo('a',1,'"+type+"')";
		b2=$('lang_tabRecentVideo').value;			class2=cNoClick;		onclick2="changeRightVideo('b',2,'"+type+"')";
		b3=$('lang_tabMostWatched').value;		class3=cNoClick;		onclick3="changeRightVideo('c',3,'"+type+"')";
		cursor1="";							btclick1="";
		cursor2="cursor:pointer;";		btclick2="changeRightVideo('b',2,'"+type+"')";
	}
	
	else if(tab=='b'){ //lang_tabRecentTopic
		if(current==2){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onclick1="changeRightVideo('a',1,'"+type+"')";
			b2=$('lang_tabRecentVideo').value;		class2=cClick;			onclick2="changeRightVideo('b',2,'"+type+"')";
			b3=$('lang_tabMostWatched').value;	class3=cNoClick;		onclick3="changeRightVideo('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightVideo('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightVideo('c',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabRecentVideo').value;		class1=cClick;			onclick1="changeRightVideo('b',1,'"+type+"')";
			b2=$('lang_tabMostWatched').value;	class2=cNoClick;		onclick2="changeRightVideo('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onclick3="changeRightVideo('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightVideo('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightVideo('c',2,'"+type+"')";
		}
	}
	
	else if(tab=='c'){ //lang_tabMostView
		if(current==3){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onclick1="changeRightVideo('a',1,'"+type+"')";
			b2=$('lang_tabRecentVideo').value;		class2=cNoClick;		onclick2="changeRightVideo('b',2,'"+type+"')";
			b3=$('lang_tabMostWatched').value;	class3=cClick;			onclick3="changeRightVideo('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightVideo('b',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightVideo('d',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabRecentVideo').value;		class1=cNoClick;		onclick1="changeRightVideo('b',1,'"+type+"')";
			b2=$('lang_tabMostWatched').value;	class2=cClick;			onclick2="changeRightVideo('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onclick3="changeRightVideo('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightVideo('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightVideo('d',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabMostWatched').value;	class1=cClick;			onclick1="changeRightVideo('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cNoClick;		onclick2="changeRightVideo('d',2,'"+type+"')";
			b3=$('lang_tabMostVote').value;			class3=cNoClick;		onclick3="changeRightVideo('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightVideo('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightVideo('d',2,'"+type+"')";
		}
	}
	
	else if(tab=='d'){ //lang_tabMostReply
		if(current==3){
			b1=$('lang_tabRecentTopic').value;		class1=cNoClick;		onclick1="changeRightVideo('b',1,'"+type+"')";
			b2=$('lang_tabMostWatched').value;			class2=cNoClick;		onclick2="changeRightVideo('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cClick;			onclick3="changeRightVideo('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightVideo('c',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightVideo('e',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabMostWatched').value;			class1=cNoClick;		onclick1="changeRightVideo('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cClick;			onclick2="changeRightVideo('d',2,'"+type+"')";
			b3=$('lang_tabMostVote').value;			class3=cNoClick;		onclick3="changeRightVideo('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightVideo('c',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightVideo('e',3,'"+type+"')";
		}
	}
	else if(tab=='e'){ //lang_tabMostVote
		b1=$('lang_tabMostWatched').value;				class1=cNoClick;		onclick1="changeRightVideo('c',1,'"+type+"')";
		b2=$('lang_tabMostReply').value;			class2=cNoClick;		onclick2="changeRightVideo('d',2,'"+type+"')";
		b3=$('lang_tabMostVote').value;				class3=cClick;			onclick3="changeRightVideo('e',3,'"+type+"')";
		cursor1="cursor:pointer;";		btclick1="changeRightVideo('d',2,'"+type+"')";
		cursor2="";							btclick2="";
	}
		var tabHTML ="";
		
        	tabHTML+="<center>";
        		tabHTML+="<input type=\"button\" name=\"tab1\" value=\""+b1+"\" class=\""+class1+"\" onclick=\""+onclick1+"\" />";	
        		tabHTML+="<input type=\"button\" name=\"tab2\" value=\""+b2+"\" class=\""+class2+"\" onclick=\""+onclick2+"\"/>";	
        		tabHTML+="<input type=\"button\" name=\"tab3\" value=\""+b3+"\" class=\""+class3+"\" onclick=\""+onclick3+"\"/>";	
        	tabHTML+="</center>";
		tabHTML+="<div class=\"floatleft\"><img src=\"pic/btn_first.gif\" style=\"margin-top:5px; margin-left:225px;margin-bottom:5px;"+cursor1+"\" onclick=\""+btclick1+"\" /></div>";
			tabHTML+="<div class=\"floatRight\"><img src=\"pic/btn_last.gif\" style=\"margin-top:5px; margin-right: 5px; margin-bottom:5px;"+cursor2+"\" onclick=\""+btclick2+"\" /></div>";
		$('rightTabVideo').innerHTML=tabHTML;
	
		if(type=='white'){ 	cp.call(fileTabMenu,'changeRightVideo',resRightVideo,tab); 	}
		else if(type=='black')	{	cp.call(fileTabMenu,'changeRightVideo',resRightBlackVideo,tab); 	}

}
function resRightVideo(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var videoID=tab.getElementsByTagName('videoID');

	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";
//
	for(var i=0;i<videoID.length;i++){
		
		var id=$value(videoID[i],'id');
		var videoName=spacialChar($value(videoID[i],'videoName'));
		var videoImg=$value(videoID[i],'videoImg');
		var videoView=$value(videoID[i],'videoView');
		var videoVote=$value(videoID[i],'videoVote');
		var videoDetail=$value(videoID[i],'videoDetail');
		//alert (videoName);
		var cutName=videoName.substring(0,20);
		var videoDetail=spacialChar(videoDetail);
		var videoDetail=strip_tags(videoDetail);

		tabHTML+="<div class=\"PastcontentWG\">";
			tabHTML+="<div class=\"VoteWG\">";
  				tabHTML+="<div class=\"WGimgVote\" >";
					tabHTML+="<input type=\"button\" id=\"bt-r-video_"+id+"\" onclick=\"upVoteVideo('bt-r-video_"+id+"','"+id+"')\" value=\""+videoVote+"\" class=\"btClassWG\" style=\"vertical-align:top;\" />";
      			tabHTML+="</div>";					
      			tabHTML+="<div class=\"TxtVoteWG\"><a href=\"javascript:void(0)\" onclick=\"upVoteVideo('bt-r-video_"+id+"','"+id+"');\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
			//tabHTML+="<a href=\"detail_clip.php?clipID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWG\"><a href=\"detail_clip.php?clipID="+id+"\"  ><img src=\""+videoImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideo\"><a href=\"detail_clip.php?clipID="+id+"\" onmouseover=\"showTip(this,event,'"+videoName+"','"+videoName+"','"+videoDetail+"','"+videoImg+"');\" >"+cutName+"</a></div>";
			//tabHTML+="</a>";
			tabHTML+="<div class=\"ViewWG\">"+$('lang_view').value+" : "+videoView+"</div>";
		tabHTML+="</div>";
		
		if(numTab=='a'){
			var rplID=tab.getElementsByTagName('rplID'+id);
			for(var j=0;j<rplID.length;j++){
				var id2=$value(rplID[j],'id2');
				//var webboardrpl_page=$value(rplID[i],'webboardrpl_page');
				var vdodiverpl_detail=$value(rplID[j],'vdodiverpl_detail');
				//var vdodiverpl_detail=vdodiverpl_detail.substring(0,25);	
				var vdodiverpl_detail=spacialChar(vdodiverpl_detail);
				var vdodiverpl_detail=strip_tags(vdodiverpl_detail);
				
				if (vdodiverpl_detail==''){
				} else {
				tabHTML+="<div class=\"list_reply\"><li class=\"to_reply\"><a href=\"detail_clip.php?clipID="+id+"\" >"+vdodiverpl_detail+"</a></li></div>";
				}
			}
		}
		
	}
		 
	$('boxRightVideo').innerHTML=tabHTML;
	
}
function resRightBlackVideo(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var videoID=tab.getElementsByTagName('videoID');

	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";
//
	for(var i=0;i<videoID.length;i++){
		
		var id=$value(videoID[i],'id');
		var videoName=spacialChar($value(videoID[i],'videoName'));
		var videoImg=$value(videoID[i],'videoImg');
		var videoView=$value(videoID[i],'videoView');
		var videoVote=$value(videoID[i],'videoVote');
		var videoDetail=$value(videoID[i],'videoDetail');
		var cutName=videoName.substring(0,20);
		var videoDetail=spacialChar(videoDetail);
		var videoDetail=strip_tags(videoDetail);

	
		tabHTML+="<div class=\"PastcontentWGVi\">";
			tabHTML+="<div class=\"VoteWGVi\">";
  				tabHTML+="<div class=\"WGimgVoteVi\" >";
					tabHTML+="<input type=\"button\" id=\"bt-r-video_"+id+"\" onclick=\"upVoteVideo('bt-r-video_"+id+"','"+id+"')\" value=\""+videoVote+"\" class=\"btClassWG\" style=\"vertical-align:top;\" />";
      			tabHTML+="</div>";					
      			tabHTML+="<div class=\"TxtVoteWGVi\"><a href=\"javascript:void(0)\" onclick=\"upVoteVideo('bt-r-video_"+id+"','"+id+"');\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
			//tabHTML+="<a href=\"detail_clip.php?clipID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWGVi\"><a href=\"detail_clip.php?clipID="+id+"\" ><img src=\""+videoImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideoVi\"><a href=\"detail_clip.php?clipID="+id+"\"  onmouseover=\"showTip(this,event,'"+videoName+"','"+videoName+"','"+videoDetail+"','"+videoImg+"');\">"+videoName+"</a></div>";
			//tabHTML+="</a>";
			tabHTML+="<div class=\"ViewWGVi\">"+$('lang_view').value+" : "+videoView+"</div>";
		tabHTML+="</div>";
		
		if(numTab=='a'){
			var rplID=tab.getElementsByTagName('rplID'+id);
			for(var j=0;j<rplID.length;j++){
				var id2=$value(rplID[j],'id2');
				//var webboardrpl_page=$value(rplID[i],'webboardrpl_page');
				var vdodiverpl_detail=$value(rplID[j],'vdodiverpl_detail');
				//var vdodiverpl_detail=vdodiverpl_detail.substring(0,25);	
				var vdodiverpl_detail=spacialChar(vdodiverpl_detail);
				var vdodiverpl_detail=strip_tags(vdodiverpl_detail);
				
				if (vdodiverpl_detail=='') {
				} else {
				tabHTML+="<div class=\"list_reply\"><li class=\"to_reply\"><a href=\"detail_clip.php?clipID="+id+"\" >"+vdodiverpl_detail+"</a></li></div>";
				}
			}
		}
	}
		 
	$('boxRightVideo').innerHTML=tabHTML;
	
}

function upVoteVideo(box,id){
	cp.call(fileTabMenu,'upVoteVideo',resVoteVideo,box,id);
}
function resVoteVideo(result){
	var boxVote=result.getElementsByTagName('boxVote')[0];
	var videoID=$value(boxVote,'id');
	var box=$value(boxVote,'box');
	var vote=$value(boxVote,'vote');
	var state=$value(boxVote,'state');
	
	if(state=='0'){
		alert(""+$('lang_voteOnce').value+"");
	}
	$(box).value=""+vote+"";
}
// ----------------------------------- Tab Gallery ----------------------------------------//
function changeTabGallery(tab,goto,catID,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){ 
		document.getElementById('gallery1Tab').className='current';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
		$('page-index-gall').innerHTML="";
	}else if(tab==2){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='current';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
		$('page-index-gall').innerHTML="";
	}
	else if(tab==3){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='current';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
		pagecutTab(rowPerPage,allPage,1,pagePerGroup,typePage,linkPage,box,"","");
	}
	else if(tab==4){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='current';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
		$('page-index-gall').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='current';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
		$('page-index-gall').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='current';	
		$('page-index-gall').innerHTML="";
	}
	//alert (tab);
	cp.call(fileTabMenu,'changeTabIndexGallery',resTabIndexGallery,tab,catID);
	//if(goto=='main'){	cp.call(fileTabMenu,'changeTabGallery',resTabGallery,tab);	}
	//else if(goto=='index'){	cp.call(fileTabMenu,'changeTabIndexGallery',resTabIndexGallery,tab,catID);	}

}
function changeTabGalleryMain(tab,goto){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){ 
		document.getElementById('gallery1Tab').className='current';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
	}else if(tab==2){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='current';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
	}
	else if(tab==3){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='current';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
	}
	else if(tab==4){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='current';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
	}
	else if(tab==5){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='current';	
		document.getElementById('gallery6Tab').className='modernbricksmenu';	
	}
	else if(tab==6){
		document.getElementById('gallery1Tab').className='modernbricksmenu';
		document.getElementById('gallery2Tab').className='modernbricksmenu';
		document.getElementById('gallery3Tab').className='modernbricksmenu';
		document.getElementById('gallery4Tab').className='modernbricksmenu';
		document.getElementById('gallery5Tab').className='modernbricksmenu';	
		document.getElementById('gallery6Tab').className='current';	
	}
	//alert (tab);
	cp.call(fileTabMenu,'changeTabGallery',resTabGallery,tab);
	//if(goto=='main'){	cp.call(fileTabMenu,'changeTabGallery',resTabGallery,tab);	}
	//else if(goto=='index'){	cp.call(fileTabMenu,'changeTabIndexGallery',resTabIndexGallery,tab,catID);	}

}
function resTabGallery(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var gallID=tab.getElementsByTagName('gallID');

	var tabHTML ="";

	for(var i=0;i<gallID.length;i++){
		
		var id=$value(gallID[i],'id');
		var gallName=spacialChar($value(gallID[i],'gallName'));
		var gallImg=$value(gallID[i],'gallImg');
		
		var cutName=gallName.substring(0,20);
		//alert (gallName);
	
		/*tabHTML+="<div class=\"blog-tex-imgvi-gal\">";
			tabHTML+="<div class=\"imgvi-gal\">";
				tabHTML+="<a href=\"detail_gallery.php?albumID="+id+">";
					tabHTML+="<div class=\"imgvi-gal\"><img src=\""+gallImg+"\"/></div>";
					tabHTML+="<div class=\"PartfloatLefttN\"><center>"+cutName+"</center></div>";
				tabHTML+="</a>";
			tabHTML+="</div>";
		tabHTML+="</div>";*/
		tabHTML+="<div class=\"blog-tex-imgvi-gal\">";
			tabHTML+="<div class=\"imgvi-gal\">";
				tabHTML+="<a href=\"detail_gallery.php?albumID="+id+"\>";
					tabHTML+="<div class=\"imgvi-gal\"><img src=\""+gallImg+"\"></div>";
					tabHTML+="</a>";
					//tabHTML+="<div class=\"txt_li\">";
					tabHTML+="<div class=\"PartfloatLefttN\">";
					tabHTML+="<a href=\"detail_gallery.php?albumID="+id+"\">";
					tabHTML+="<center>"+cutName+"</center>";
					tabHTML+="</a>";
					tabHTML+="</div>";
				
			tabHTML+="</div>";
		tabHTML+="</div>";
	}
//		 
	$('boxTabGallery').innerHTML=tabHTML;
	
}
function resTabIndexGallery(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');

	/*var thisPage=tab.getAttribute('thisPage');
	var rowPerPage=tab.getAttribute('rowPerPage');
	var allPage=tab.getAttribute('allPage');
	var pagePerGroup=tab.getAttribute('pagePerGroup');
	var typePage=tab.getAttribute('typePage');
	var linkPage=tab.getAttribute('linkPage');
	var box=tab.getAttribute('box');
	var catID=tab.getAttribute('catID');
	var subCatID=tab.getAttribute('subCatID');*/
	
	
	var gallID=tab.getElementsByTagName('gallID');

	var tabHTML ="";

	for(var i=0;i<gallID.length;i++){
		
		var id=$value(gallID[i],'id');
		var gallName=spacialChar($value(gallID[i],'gallName'));
		var gallDetail=strip_tags(spacialChar($value(gallID[i],'gallDetail')));
		var gallImg=$value(gallID[i],'gallImg');
		var gallVote=$value(gallID[i],'gallVote');
		var gallView=$value(gallID[i],'gallView');
		var gallCM=$value(gallID[i],'gallCM');
		var gallDate=$value(gallID[i],'gallDate');
		var member=$value(gallID[i],'member');
		var memberID=$value(gallID[i],'memberID');
	
		//alert (gallName);
	
		tabHTML+="<div class=\"Pastcontent-webboard2\">";
           /* tabHTML+="<div class=\"Vote2New\">";
                tabHTML+="<div class=\"imgVote\">";
                    tabHTML+="<input type=\"submit\" id=\"bt-index-gall_"+id+"\" value=\""+gallVote+"\" class=\"btClassV\" style=\"vertical-align:top;\" onclick=\"upVoteGall('bt-index-gall_"+id+"','"+id+"')\" />";
                tabHTML+="</div>";
                tabHTML+="<div class=\"TxtVoteN\"><b href=\"javascript:void(0)\" onclick=\"upVoteGall('bt-index-gall_"+id+"','"+id+"')\">"+$('lang_vote').value+"</b></div>";
            tabHTML+="</div>";
			//tabHTML+="<a href=\"detail_gallery.php?albumID="+id+"\">";*/
				tabHTML+="<div class=\"picRightN\">";
					tabHTML+="<div class=\"imgsize\"><b><a href=\"detail_gallery.php?albumID="+id+"\"><img src=\""+gallImg+"\" width=\"80\" height=\"80\"></a></b></div>";
				tabHTML+="</div>";
				tabHTML+="<div class=\"TitleNVi\">";
					tabHTML+="<a href=\"detail_gallery.php?albumID="+id+"\">"+gallName+"</a>";
				tabHTML+="</div>";
				tabHTML+="<div class=\"TextBoardN\">";
					tabHTML+="<b1><a href=\"detail_gallery.php?albumID="+id+"\">"+gallDetail+"</a></b1>";
				tabHTML+="</div>";  
			//tabHTML+="</a>";
            tabHTML+="<div class=\"TextBoard-footerVi\">";
			//tabHTML+=""+$('lang_publisher').value+" : "+member+"&nbsp;";
			tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
			tabHTML+=""+$('lang_view').value+" : "+gallView+"&nbsp;";
			tabHTML+=""+$('lang_comment').value+" : "+gallCM+"&nbsp;"; 
			tabHTML+=""+$('lang_date').value+" : "+gallDate+"";
			//("+gallCM+") "+$('lang_comment').value+"&nbsp;"; 
            tabHTML+="<b><a href=\"javascript:void(0);\" title=\""+$('lang_shareFacebook').value+"\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"detail_gallery.php?albumID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            	tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareTwitter').value+"\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"detail_gallery.php?albumID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
				tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
            tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"detail_gallery.php?albumID="+id+"')\">";
            	tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b> ";   
            //tabHTML+=""+$('lang_view').value+" : "+gallView+"</div>";
			
			tabHTML+="</div>";
        tabHTML+="</div>";
	}
//		 
	$('boxTabIndexGallery').innerHTML=tabHTML;
	
	/*if(numTab==3){
		//$('page-index-gall').innerHTML="pagecutTab("+rowPerPage+","+allPage+","+thisPage+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"');";
		//alert ($('page-index-gall').innerHTML);
		//$('page-index-gall').innerHTML="pagecutTab("+rowPerPage+","+allPage+","+thisPage+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"');";
		$('page-index-gall').innerHTML="pagecutTab("+rowPerPage+","+allPage+",1,10,"+typePage+","+linkPage+",'page-index-gall',"+catID+","+subCatID+")";
		
	}else{
		$('page-index-gall').innerHTML="";
	}*/
	
}


function changeRightGallery(tab,current,type){
	
	if(type=='black'){ cClick="btAJClickVi"; cNoClick="btAJClassVi";	}
	else if(type=='white'){ cClick="btAJClick"; cNoClick="btAJClass";	}

	if(tab=='a'){	//lang_tabRecentReply
		b1=$('lang_tabRecentReply').value;			class1=cClick;			onclick1="changeRightGallery('a',1,'"+type+"')";
		b2=$('lang_tabRecentGall').value;			class2=cNoClick;		onclick2="changeRightGallery('b',2,'"+type+"')";
		b3=$('lang_tabMostViewed').value;			class3=cNoClick;		onclick3="changeRightGallery('c',3,'"+type+"')";
		cursor1="";							btclick1="";
		cursor2="cursor:pointer;";		btclick2="changeRightGallery('b',2,'"+type+"')";
	}
	
	else if(tab=='b'){ //lang_tabRecentGall
		if(current==2){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onclick1="changeRightGallery('a',1,'"+type+"')";
			b2=$('lang_tabRecentGall').value;		class2=cClick;			onclick2="changeRightGallery('b',2,'"+type+"')";
			b3=$('lang_tabMostViewed').value;		class3=cNoClick;		onclick3="changeRightGallery('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightGallery('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightGallery('c',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabRecentGall').value;		class1=cClick;			onclick1="changeRightGallery('b',1,'"+type+"')";
			b2=$('lang_tabMostViewed').value;		class2=cNoClick;		onclick2="changeRightGallery('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onclick3="changeRightGallery('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightGallery('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightGallery('c',2,'"+type+"')";
		}
	}
	
	else if(tab=='c'){ //lang_tabMostView
		if(current==3){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onclick1="changeRightGallery('a',1,'"+type+"')";
			b2=$('lang_tabRecentGall').value;		class2=cNoClick;		onclick2="changeRightGallery('b',2,'"+type+"')";
			b3=$('lang_tabMostViewed').value;		class3=cClick;			onclick3="changeRightGallery('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightGallery('b',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightGallery('d',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabRecentGall').value;		class1=cNoClick;		onclick1="changeRightGallery('b',1,'"+type+"')";
			b2=$('lang_tabMostViewed').value;		class2=cClick;			onclick2="changeRightGallery('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onclick3="changeRightGallery('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightGallery('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightGallery('d',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabMostViewed').value;		class1=cClick;			onclick1="changeRightGallery('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cNoClick;		onclick2="changeRightGallery('d',2,'"+type+"')";
			b3=$('lang_tabMostVoteGall').value;	class3=cNoClick;		onclick3="changeRightGallery('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightGallery('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightGallery('d',2,'"+type+"')";
		}
	}
	
	else if(tab=='d'){ //lang_tabMostReply
		if(current==3){
			b1=$('lang_tabRecentGall').value;		class1=cNoClick;		onclick1="changeRightGallery('b',1,'"+type+"')";
			b2=$('lang_tabMostViewed').value;		class2=cNoClick;		onclick2="changeRightGallery('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cClick;			onclick3="changeRightGallery('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightGallery('c',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightGallery('e',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabMostViewed').value;		class1=cNoClick;		onclick1="changeRightGallery('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cClick;			onclick2="changeRightGallery('d',2,'"+type+"')";
			b3=$('lang_tabMostVoteGall').value;	class3=cNoClick;		onclick3="changeRightGallery('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightGallery('c',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightGallery('e',3,'"+type+"')";
		}
	}
	else if(tab=='e'){ //lang_tabMostVote
		b1=$('lang_tabMostViewed').value;			class1=cNoClick;		onclick1="changeRightGallery('c',1,'"+type+"')";
		b2=$('lang_tabMostReply').value;			class2=cNoClick;		onclick2="changeRightGallery('d',2,'"+type+"')";
		b3=$('lang_tabMostVoteGall').value;		class3=cClick;			onclick3="changeRightGallery('e',3,'"+type+"')";
		cursor1="cursor:pointer;";		btclick1="changeRightGallery('d',2,'"+type+"')";
		cursor2="";							btclick2="";
	}
		var tabHTML ="";
		
        	tabHTML+="<center>";
        		tabHTML+="<input type=\"button\" name=\"tab1\" value=\""+b1+"\" class=\""+class1+"\" onclick=\""+onclick1+"\" />";	
        		tabHTML+="<input type=\"button\" name=\"tab2\" value=\""+b2+"\" class=\""+class2+"\" onclick=\""+onclick2+"\"/>";	
        		tabHTML+="<input type=\"button\" name=\"tab3\" value=\""+b3+"\" class=\""+class3+"\" onclick=\""+onclick3+"\"/>";	
        	tabHTML+="</center>";
			tabHTML+="<div class=\"floatleft\"><img src=\"pic/btn_first.gif\" style=\"margin-top:5px; margin-left:225px;margin-bottom:5px;"+cursor1+"\" onclick=\""+btclick1+"\" /></div>";
			tabHTML+="<div class=\"floatRight\"><img src=\"pic/btn_last.gif\" style=\"margin-top:5px; margin-right: 5px; margin-bottom:5px;"+cursor2+"\" onclick=\""+btclick2+"\" /></div>";
		$('rightTabGallery').innerHTML=tabHTML;
	
		//cp.call(fileTabMenu,'changeRightGallery',resRightGallery,tab);
		if(type=='white'){ 	cp.call(fileTabMenu,'changeRightGallery',resRightGallery,tab); 	}
		else if(type=='black')	{	cp.call(fileTabMenu,'changeRightGallery',resRightBlackGallery,tab); 	}

}
function resRightGallery(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var gallID=tab.getElementsByTagName('gallID');

	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";
//
	for(var i=0;i<gallID.length;i++){
		
		var id=$value(gallID[i],'id');
		var gallName=spacialChar($value(gallID[i],'gallName'));
		var gallImg=$value(gallID[i],'gallImg');
		var gallView=$value(gallID[i],'gallView');
		var gallVote=$value(gallID[i],'gallVote');
		var gallDetail=$value(gallID[i],'gallDetail');
		//alert (gallName);
		var cutName=gallName.substring(0,20);
		gallDetail=spacialChar(gallDetail);
		gallDetail=strip_tags(gallDetail);

		tabHTML+="<div class=\"PastcontentWG\">";
			tabHTML+="<div class=\"VoteWG\">";
  				tabHTML+="<div class=\"WGimgVote\" >";
					tabHTML+="<input type=\"button\" id=\"bt-r-gall_"+id+"\" onclick=\"upVoteGall('bt-r-gall_"+id+"','"+id+"')\" value=\""+gallVote+"\" class=\"btClassWG\" style=\"vertical-align:top;\" />";
      			tabHTML+="</div>";					
      			tabHTML+="<div class=\"TxtVoteWG\"><a href=\"javascript:void(0)\" onclick=\"upVoteGall('bt-r-gall_"+id+"','"+id+"');\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
			//tabHTML+="<a href=\"detail_gallery.php?albumID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWG\"><a href=\"detail_gallery.php?albumID="+id+"\" ><img src=\""+gallImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideo\"><a href=\"detail_gallery.php?albumID="+id+" \"  onmouseover=\"showTip(this,event,'"+gallName+"','"+gallName+"','"+gallDetail+"','"+gallImg+"');\" >"+cutName+"</a></div>";
			//tabHTML+="</a>";
			tabHTML+="<div class=\"ViewWG\">"+$('lang_view').value+" : "+gallView+"</div>";
		tabHTML+="</div>";
		
		if(numTab=='a'){
			var rplID=tab.getElementsByTagName('rplID'+id);
			for(var j=0;j<rplID.length;j++){
				var id2=$value(rplID[j],'id2');
				var picdiverpl_detail=$value(rplID[j],'picdiverpl_detail');	
				//var picdiverpl_detail=picdiverpl_detail.substring(0,25);
				var picdiverpl_detail=spacialChar(picdiverpl_detail);
				var picdiverpl_detail=strip_tags(picdiverpl_detail);
				
				if (picdiverpl_detail==''){
				} else {
				tabHTML+="<div class=\"list_reply\"><li class=\"to_reply\"><a href=\"detail_gallery.php?albumID="+id+"\" >"+picdiverpl_detail+"</a></li></div>";
				}
			}
		}
		
	}
		
	$('boxRightGall').innerHTML=tabHTML;
	
}
function resRightBlackGallery(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var gallID=tab.getElementsByTagName('gallID');

	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";
//
	for(var i=0;i<gallID.length;i++){
		
		var id=$value(gallID[i],'id');
		var gallName=spacialChar($value(gallID[i],'gallName'));
		var gallImg=$value(gallID[i],'gallImg');
		var gallView=$value(gallID[i],'gallView');
		var gallVote=$value(gallID[i],'gallVote');
		var gallDetail=$value(gallID[i],'gallDetail');
		//alert (gallName);
		var cutName=gallName.substring(0,20);
		gallDetail=spacialChar(gallDetail);
		gallDetail=strip_tags(gallDetail);
		
		tabHTML+="<div class=\"PastcontentWGVi\">";
			tabHTML+="<div class=\"VoteWGVi\">";
				tabHTML+="<div class=\"WGimgVoteVi\">";
					tabHTML+="<input type=\"button\" id=\"bt-r-gall_"+id+"\" onclick=\"upVoteGall('bt-r-gall_"+id+"','"+id+"')\" value=\""+gallVote+"\" class=\"btClassWG\" style=\"vertical-align:top;\" />";
				tabHTML+="</div>";
				tabHTML+="<div class=\"TxtVoteWGVi\"><c href=\"javascript:void(0)\" onclick=\"upVoteVideo('bt-r-gall_"+id+"','"+id+"');\">"+$('lang_vote').value+"</c></div>";
			tabHTML+="</div>";
			//tabHTML+="<a href=\"detail_gallery.php?albumID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWGVi\"><a href=\"detail_gallery.php?albumID="+id+"\" ><img src=\""+gallImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideoVi\"><a href=\"detail_gallery.php?albumID="+id+"\"  onmouseover=\"showTip(this,event,'"+gallName+"','"+gallName+"','"+gallDetail+"','"+gallImg+"');\" >"+gallName+"</a></div>";
			tabHTML+="<div class=\"ViewWGVi\">"+$('lang_view').value+" : "+gallView+"</div>";
		tabHTML+="</div>";
		
		if(numTab=='a'){
			var rplID=tab.getElementsByTagName('rplID'+id);
			for(var j=0;j<rplID.length;j++){
				var id2=$value(rplID[j],'id2');
				var picdiverpl_detail=$value(rplID[j],'picdiverpl_detail');	
				//var picdiverpl_detail=picdiverpl_detail.substring(0,25);
				var picdiverpl_detail=spacialChar(picdiverpl_detail);
				
				if (picdiverpl_detail==''){
				} else {
				tabHTML+="<div class=\"list_reply\"><li class=\"to_reply\"><a href=\"detail_gallery.php?albumID="+id+"\" >"+picdiverpl_detail+"</a></li></div>";
				}
			}
		}
	}
		 
	$('boxRightGall').innerHTML=tabHTML;
	
}

function upVoteGall(box,id){
	//alert(box,id);
	cp.call(fileTabMenu,'upVoteGall',resVoteGall,box,id);
}
function resVoteGall(result){
	var boxVote=result.getElementsByTagName('boxVote')[0];
	var gallID=$value(boxVote,'id');
	var box=$value(boxVote,'box');
	var vote=$value(boxVote,'vote');
	var state=$value(boxVote,'state');
	
	if(state=='0'){
		alert(""+$('lang_voteOnce').value+""); 
	}
	$(box).value=""+vote+"";
}


// ----------------------------------- Tab Webboard ----------------------------------------//
function changeTabWebboard(tab,catID,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){
		document.getElementById('Board1Tab').className='current';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';	
		$('page-index-web').innerHTML="";
	}else if(tab==2){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='current';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-web').innerHTML="";
	}
	else if(tab==3){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='current';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='modernbricksmenu';
		pagecutTab(rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,"","");
	}
	else if(tab==4){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='current';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-web').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='current';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-web').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='current';
		$('page-index-web').innerHTML="";
	}
	cp.call(fileTabMenu,'changeTabWebboard',resTabWebboard,tab);

}
function resTabWebboard(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var webID=tab.getElementsByTagName('webID');
	var countCkk=1;
	
	var tabHTML ="";
	tabHTML+="<div class=\"blankN\"></div>";

	for(var i=0;i<webID.length;i++){
		
		var id=$value(webID[i],'id');
		var webTopic=spacialChar($value(webID[i],'webTopic'));
		var webImg=$value(webID[i],'webImg');
		var webVote=$value(webID[i],'webVote');
		var webView=$value(webID[i],'webView');
		var update=$value(webID[i],'update');
		var webDetail=strip_tags(spacialChar($value(webID[i],'webDetail')));
		var webDetail=webDetail.substring(0,300);
		var comment=$value(webID[i],'comment');
		var member=$value(webID[i],'member');
		var memberID=$value(webID[i],'memberID');
		var webCat=$value(webID[i],'webCat');
		var webSubCat=$value(webID[i],'webSubCat')
		var can=$value(webID[i],'can')
		
		tabHTML+="<div class=\"Pastcontent-webboard2\">";
			/*tabHTML+="<div class=\"Vote2New\">";
  				tabHTML+="<div class=\"imgVote\">";
  					tabHTML+="<input type=\"button\" id=\"bt-l-web_"+id+"\" onclick=\"upVoteWeb('bt-l-web_"+id+"','"+id+"')\" value=\""+webVote+"\" class=\"btClassV\" style=\"vertical-align:top;\" />";
      			tabHTML+="</div>";
        		tabHTML+="<div class=\"TxtVoteN\"><a href=\"javascript:void(0)\" onclick=\"upVoteWeb('bt-l-web_"+id+"','"+id+"')\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
        	//tabHTML+="<a href=\"webboard_detail.php?webID="+id+"\">";*/
			if(can==1){
					tabHTML+="<div class=\"checkBoxBoard\"><input name=\"checkbox"+countCkk+"\" type=\"checkbox\" value=\""+id+"\"></div>";
				}
            	tabHTML+="<div class=\"picRightN\">";
				
                	tabHTML+="<div class=\"imgsize\"><a href=\"webboard_detail.php?webID="+id+"\" ><img src=\""+webImg+"\" width=\"80\" height=\"80\"></a></div>";
            	tabHTML+="</div>";
            	tabHTML+="<div class=\"TitleN\"><a href=\"webboard_detail.php?webID="+id+"\" >"+webTopic+"</a></div>";
            	tabHTML+="<div class=\"TextBoardN2\">";
                	tabHTML+="<a1><a href=\"webboard_detail.php?webID="+id+"\" >"+webDetail+"</a></a1>";
            	tabHTML+="</div>";
        	//tabHTML+="</a>";
	  		tabHTML+="<div class=\"TextBoard-footer\">";
            	tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
				tabHTML+=""+$('lang_view').value+" : "+webView+"&nbsp;";
				tabHTML+=""+$('lang_comment').value+" : "+comment+"&nbsp;";
				tabHTML+=""+$('lang_date').value+" :"+update+"";
				tabHTML+="<b><a href=\"javascript:void(0);\" title=\"Share Facebook\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"webboard_detail.php?webID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            		tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            	tabHTML+="<a href=\"javascript:void(0);\" title=\"Share Twitter\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"webboard_detail.php?webID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
					tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
				tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"webboard_detail.php?webID="+id+"')\">";
            		tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b>";
				//tabHTML+=""+$('lang_date').value+"&nbsp;"+update+"";
        	tabHTML+="</div>";
  		tabHTML+="</div>";
		
		countCkk++;
	}
//		 
	$('boxTabWebboard').innerHTML=tabHTML;
	
}

function changeRightWebboard(tab,current,type){  
	//$('boxTabGallery').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(type=='black'){ cClick="btAJClickVi"; cNoClick="btAJClassVi";	}
	else if(type=='white'){ cClick="btAJClick"; cNoClick="btAJClass";	}
	if(tab=='a'){	//lang_tabRecentReply
		b1=$('lang_tabRecentReply').value;			class1=cClick;			onmouseover1="changeRightWebboard('a',1,'"+type+"')";
		b2=$('lang_tabRecentTopic').value;			class2=cNoClick;		onmouseover2="changeRightWebboard('b',2,'"+type+"')";
		b3=$('lang_tabMostRead').value;				class3=cNoClick;		onmouseover3="changeRightWebboard('c',3,'"+type+"')";
		cursor1="";							btclick1="";
		cursor2="cursor:pointer;";		btclick2="changeRightWebboard('b',2,'"+type+"')";
	}
	
	else if(tab=='b'){ //lang_tabRecentTopic
		if(current==2){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onmouseover1="changeRightWebboard('a',1,'"+type+"')";
			b2=$('lang_tabRecentTopic').value;		class2=cClick;			onmouseover2="changeRightWebboard('b',2,'"+type+"')";
			b3=$('lang_tabMostRead').value;			class3=cNoClick;		onmouseover3="changeRightWebboard('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightWebboard('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightWebboard('c',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabRecentTopic').value;		class1=cClick;			onmouseover1="changeRightWebboard('b',1,'"+type+"')";
			b2=$('lang_tabMostRead').value;			class2=cNoClick;		onmouseover2="changeRightWebboard('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onmouseover3="changeRightWebboard('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightWebboard('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightWebboard('c',2,'"+type+"')";
		}
	}
	
	else if(tab=='c'){ //lang_tabMostView
		if(current==3){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onmouseover1="changeRightWebboard('a',1,'"+type+"')";
			b2=$('lang_tabRecentTopic').value;		class2=cNoClick;		onmouseover2="changeRightWebboard('b',2,'"+type+"')";
			b3=$('lang_tabMostRead').value;			class3=cClick;			onmouseover3="changeRightWebboard('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightWebboard('b',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightWebboard('d',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabRecentTopic').value;		class1=cNoClick;		onmouseover1="changeRightWebboard('b',1,'"+type+"')";
			b2=$('lang_tabMostRead').value;			class2=cClick;			onmouseover2="changeRightWebboard('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onmouseover3="changeRightWebboard('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightWebboard('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightWebboard('d',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabMostRead').value;			class1=cClick;			onmouseover1="changeRightWebboard('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cNoClick;		onmouseover2="changeRightWebboard('d',2,'"+type+"')";
			b3=$('lang_tabMostVote').value;			class3=cNoClick;		onmouseover3="changeRightWebboard('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightWebboard('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightWebboard('d',2,'"+type+"')";
		}
	}
	
	else if(tab=='d'){ //lang_tabMostReply
		if(current==3){
			b1=$('lang_tabRecentTopic').value;		class1=cNoClick;		onmouseover1="changeRightWebboard('b',1,'"+type+"')";
			b2=$('lang_tabMostRead').value;			class2=cNoClick;		onmouseover2="changeRightWebboard('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cClick;			onmouseover3="changeRightWebboard('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightWebboard('c',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightWebboard('e',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabMostRead').value;			class1=cNoClick;		onmouseover1="changeRightWebboard('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cClick;			onmouseover2="changeRightWebboard('d',2,'"+type+"')";
			b3=$('lang_tabMostVote').value;			class3=cNoClick;		onmouseover3="changeRightWebboard('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightWebboard('c',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightWebboard('e',3,'"+type+"')";
		}
	}
	else if(tab=='e'){ //lang_tabMostVote
		b1=$('lang_tabMostRead').value;				class1=cNoClick;		onmouseover1="changeRightWebboard('c',1,'"+type+"')";
		b2=$('lang_tabMostReply').value;			class2=cNoClick;		onmouseover2="changeRightWebboard('d',2,'"+type+"')";
		b3=$('lang_tabMostVote').value;				class3=cClick;			onmouseover3="changeRightWebboard('e',3,'"+type+"')";
		cursor1="cursor:pointer;";		btclick1="changeRightWebboard('d',2,'"+type+"')";
		cursor2="";							btclick2="";
	}
		var tabHTML ="";
		
        	tabHTML+="<center>";
        		tabHTML+="<input type=\"button\" name=\"tab1\" value=\""+b1+"\" class=\""+class1+"\" onclick=\""+onmouseover1+"\" />";	
        		tabHTML+="<input type=\"button\" name=\"tab2\" value=\""+b2+"\" class=\""+class2+"\" onclick=\""+onmouseover2+"\"/>";	
        		tabHTML+="<input type=\"button\" name=\"tab3\" value=\""+b3+"\" class=\""+class3+"\" onclick=\""+onmouseover3+"\"/>";	
        	tabHTML+="</center>";
			tabHTML+="<div class=\"floatleft\"><img src=\"pic/btn_first.gif\" style=\"margin-top:5px; margin-left:225px;margin-bottom:5px;"+cursor1+"\" onclick=\""+btclick1+"\" /></div>";
			tabHTML+="<div class=\"floatRight\"><img src=\"pic/btn_last.gif\" style=\"margin-top:5px; margin-right: 5px; margin-bottom:5px;"+cursor2+"\" onclick=\""+btclick2+"\" /></div>";
		$('rightTabWeb').innerHTML=tabHTML;
	
	//cp.call(fileTabMenu,'changeRightWebboard',resRightWebboard,tab);
		if(type=='white'){ 	cp.call(fileTabMenu,'changeRightWebboard',resRightWebboard,tab); 	}
		else if(type=='black')	{	cp.call(fileTabMenu,'changeRightWebboard',resRightBlackWebboard,tab); 	}
		//resRightBlackWebboard
}
function resRightWebboard(result){    
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var webID=tab.getElementsByTagName('webID');
	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";

	for(var i=0;i<webID.length;i++){
		
		var id=$value(webID[i],'id');
		var webTopic=spacialChar($value(webID[i],'webTopic'));
		var webImg=$value(webID[i],'webImg');
		var webVote=$value(webID[i],'webVote');
		var webView=$value(webID[i],'webView');
		var shotDetail=$value(webID[i],"webDetail");
		//var webDetail=strip_tags(spacialChar($value(webID[i],'webDetail')));
		//var comment=$value(webID[i],'comment');
		//alert (gallName);
		var cutName=webTopic.substring(0,20);
		var shotDetail=spacialChar(shotDetail);
		var shotDetail=strip_tags(shotDetail);
		
		tabHTML+="<div class=\"PastcontentWG\">";
			tabHTML+="<div class=\"VoteWG\">";
  				tabHTML+="<div class=\"WGimgVote\" >";
					tabHTML+="<input type=\"button\" id=\"bt-r-web_"+id+"\" onclick=\"upVoteWeb('bt-r-web_"+id+"','"+id+"')\" value=\""+webVote+"\" class=\"btClassWG\" style=\"vertical-align:top; text-align:center;\" />";
      			tabHTML+="</div>";					
      			tabHTML+="<div class=\"TxtVoteWG\"><a href=\"javascript:void(0)\" onclick=\"upVoteWeb('bt-r-web_"+id+"','"+id+"');\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
			//tabHTML+="<a href=\"webboard_detail.php?webID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWG\"><a href=\"webboard_detail.php?webID="+id+"\" ><img src=\""+webImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideo\"><a href=\"webboard_detail.php?webID="+id+"\" onmouseover=\"showTip(this,event,'"+webTopic+"','"+webTopic+"','"+shotDetail+"','"+webImg+"');\">"+cutName+"</a></div>";
			tabHTML+="<div class=\"ViewWG\">"+$('lang_view').value+" : "+webView+"</div>";///////////////////////////////////////////////////////////////////////////////////////////////////////////////
			//tabHTML+="<input type=\"text\" value=\""+shotDetail+"\" >";
		tabHTML+="</div>";
			
			if(numTab=='a'){
				var rplID=tab.getElementsByTagName('rplID'+id);
				for(var j=0;j<rplID.length;j++){
					var id2=$value(rplID[j],'id2');
					var webboardrpl_page=$value(rplID[i],'webboardrpl_page');
					var webboardrpl1_detail=$value(rplID[j],'webboardrpl1_detail');
					
					var webboardrpl1_detail=spacialChar(webboardrpl1_detail);
					var webboardrpl1_detail=strip_tags(webboardrpl1_detail);
					
					if (webboardrpl1_detail==''){
					} else {
					tabHTML+="<div  class=\"list_reply\"><li class=\"to_reply\"><a href=\"webboard_detail.php?webID="+id+"&page="+webboardrpl_page+"#"+id2+"\" >"+webboardrpl1_detail+"</a></li></div>";
					}
				}
			}
			
	}
	$('boxRightWeb').innerHTML=tabHTML;
	
}
function resRightBlackWebboard(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var webID=tab.getElementsByTagName('webID');
	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";

	for(var i=0;i<webID.length;i++){
		
		var id=$value(webID[i],'id');
		var webTopic=spacialChar($value(webID[i],'webTopic'));
		var webImg=$value(webID[i],'webImg');
		var webVote=$value(webID[i],'webVote');
		var webView=$value(webID[i],'webView');
		var shotDetail=$value(webID[i],"webDetail");
		//var webDetail=strip_tags(spacialChar($value(webID[i],'webDetail')));
		//var comment=$value(webID[i],'comment');
		//alert (gallName);
		var cutName=webTopic.substring(0,20);
		var shotDetail=spacialChar(shotDetail);
		var shotDetail=strip_tags(shotDetail);
		
		tabHTML+="<div class=\"PastcontentWGVi\">";
			tabHTML+="<div class=\"VoteWGVi\">";
  				tabHTML+="<div class=\"WGimgVoteVi\" >";
					tabHTML+="<input type=\"button\" id=\"bt-r-web_"+id+"\" onclick=\"upVoteWeb('bt-r-web_"+id+"','"+id+"')\" value=\""+webVote+"\" class=\"btClassWG\" style=\"vertical-align:top; text-align:center;\" />";
      			tabHTML+="</div>";					
      			tabHTML+="<div class=\"TxtVoteWGVi\"><a href=\"javascript:void(0)\" onclick=\"upVoteWeb('bt-r-web_"+id+"','"+id+"');\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
			//tabHTML+="<a href=\"webboard_detail.php?webID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWGVi\"><a href=\"webboard_detail.php?webID="+id+"\" ><img src=\""+webImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideoVi\"><a href=\"webboard_detail.php?webID="+id+"\" onmouseover=\"showTip(this,event,'"+webTopic+"','"+webTopic+"','"+shotDetail+"','"+webImg+"');\">"+cutName+"</a></div>";
			tabHTML+="<div class=\"ViewWGVi\">"+$('lang_view').value+" : "+webView+"</div>";///////////////////////////////////////////////////////////////////////////////////////////////////////////////
			//tabHTML+="<input type=\"text\" value=\""+shotDetail+"\" >";
		tabHTML+="</div>";
			
			if(numTab=='a'){
				var rplID=tab.getElementsByTagName('rplID'+id);
				for(var j=0;j<rplID.length;j++){
					var id2=$value(rplID[j],'id2');
					var webboardrpl_page=$value(rplID[i],'webboardrpl_page');
					var webboardrpl1_detail=$value(rplID[j],'webboardrpl1_detail');
					
					var webboardrpl1_detail=spacialChar(webboardrpl1_detail);
					var webboardrpl1_detail=strip_tags(webboardrpl1_detail);
					
					if (webboardrpl1_detail==''){
					} else {
					tabHTML+="<div  class=\"list_reply\"><li class=\"to_reply\"><a href=\"webboard_detail.php?webID="+id+"&page="+webboardrpl_page+"#"+id2+"\" >"+webboardrpl1_detail+"</a></li></div>";
					}
				}
			}
			
	}
	$('boxRightWeb').innerHTML=tabHTML;
	
}
function upVoteWeb(box,id){
	//alert(box,id);
	cp.call(fileTabMenu,'upVoteWeb',resVoteWeb,box,id);
}
function resVoteWeb(result){
	var boxVote=result.getElementsByTagName('boxVote')[0];
	var webID=$value(boxVote,'id');
	var box=$value(boxVote,'box');
	var vote=$value(boxVote,'vote');
	var state=$value(boxVote,'state');

	if(state=='0'){
		alert(""+$('lang_voteOnce').value+"");
	}
	$(box).value=""+vote+"";
}

function upVoteAc(box,id){
	//alert(box);
	cp.call(fileTabMenu,'upVoteAc',resVoteAc,box,id);
}
function resVoteAc(result){ //alert(555); 
	var boxVote=result.getElementsByTagName('boxVote')[0];
	var webID=$value(boxVote,'id');
	var box=$value(boxVote,'box');
	var vote=$value(boxVote,'vote');
	var state=$value(boxVote,'state');

	if(state=='0'){
		alert(""+$('lang_voteOnce').value+"");
	}
	$(box).value=""+vote+"";
}

function upVoteSpon(box,id){
	cp.call(fileTabMenu,'upVoteSpon',resVoteSpon,box,id);
}
function resVoteSpon(result){
	var boxVote=result.getElementsByTagName('boxVote')[0];
	var webID=$value(boxVote,'id');
	var box=$value(boxVote,'box');
	var vote=$value(boxVote,'vote');
	var state=$value(boxVote,'state');

	if(state=='0'){
		alert(""+$('lang_voteOnce').value+"");
	}
	$(box).value=""+vote+"";
}

function sendReport(id,type){  
	loaddingRE(closeManageRE);
	if(window.confirm(""+$('lang_confirmReport').value+"")){  
		cp.call(fileTabMenu,'upSendReport',resSendReport,id,type);
	}else{
		cancelLoadRE();
	}
}
function resSendReport(result){
	loaddingRE(closeManageRE);
	var replyNode=result.getElementsByTagName('report')[0];
	var id=$value(replyNode,'report');
	var state=$value(replyNode,'state');
	if(state==1){
		alert (""+$('lang_sendReport').value+"");
		cancelLoadRE();
	}else{
		alert (""+$('lang_reportOnce').value+"");
		cancelLoadRE();
	}
	cancelLoadRE();
}
function sendReportReply(topicID,rplID,type,level){
	loaddingRE(closeManageRE);
	if(window.confirm(""+$('lang_confirmReport').value+"")){
		cp.call(fileTabMenu,'upSendReportReply',resSendReportReply,topicID,rplID,type,level);
	}else{
		cancelLoadRE();
	}
}
function resSendReportReply(result){
	loaddingRE(closeManageRE);
	var replyNode=result.getElementsByTagName('report')[0];
	var id=$value(replyNode,'report');
	var state=$value(replyNode,'state');
	if(state==1){
		alert (""+$('lang_sendReport').value+"");
		cancelLoadRE();
	}else{
		alert (""+$('lang_reportOnce').value+"");
		cancelLoadRE();
	}
	cancelLoadRE();
}
function changeWebStatus(box,webID,dis){
	cp.call(fileTabMenu,'changeWebStatus',resWebStatus,box,webID,dis);
}
function resWebStatus(result){
	var boxVote=result.getElementsByTagName('boxVote')[0];
	var webID=$value(boxVote,'id');
	var box=$value(boxVote,'box');
	var val=$value(boxVote,'dis');

	if(val==1){
		//status=$('lang_publish').value;
		var dis=2;
		var disTxt=$('lang_publish').value;
		var disTxtTooltip=$('lang_clickToHide').value;
	}else if(val==2){
		//status=$('lang_hide').value;
		var dis=1;
		var disTxt=$('lang_hide').value;
		var disTxtTooltip=$('lang_clickToPublish').value
	}
	//$(box).innerHTML=""+status+"";
	$('chgDisWeb'+webID).innerHTML=disTxt;
	$('chgDisWeb'+webID).title=disTxtTooltip;
	$('chgDisWeb'+webID).onclick=function(){changeWebStatus(box,webID,dis);};
}

function changeTabWebCate(tab,catID,subCatID,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />"; ,catID,subCatID
	if(tab==1){
		document.getElementById('Board1Tab').className='current';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';	
		$('page-index-web').innerHTML="";
	}else if(tab==2){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='current';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-web').innerHTML="";
	}
	else if(tab==3){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='current';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='modernbricksmenu';
		pagecutTab(rowPerPage,allPage,1,pagePerGroup,typePage,linkPage,box,catID,subCatID);
	}
	else if(tab==4){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='current';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-web').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='current';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-web').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='current';
		$('page-index-web').innerHTML="";
	}
	cp.call(fileTabMenu,'changeTabWebCate',resTabWebboard,tab,catID,subCatID);

}

function shareEmail(pathLink){
	loadding(closeManage);
	
	var htmlOwnBox ="";
		htmlOwnBox+="<form method=\"post\" >";
			htmlOwnBox+="<div class=\"boxShare\" >";
				htmlOwnBox+="<div class=\"bsTop\">"+$('lang_shareEmail').value+"";
					htmlOwnBox+="<span class=\"floatRight txtlogin\"><img src=\"images/icon/cross.png\" onclick=\"closeManage();\" style=\"cursor:pointer;\" /></span>";
				htmlOwnBox+="</div>";
				htmlOwnBox+="<div class=\"bsDetail\" style=\"text-align:right;\">";
					htmlOwnBox+="<span class=\"bsText\" >"+$('lang_from').value+" : </span>";
					htmlOwnBox+="<input id=\"fromEmail\" name=\"email\" style=\"width:178px; float:right;\" class=\"bsInput\" value=\""+$('lang_name').value+"\" onfocus=\"this.value=''\" onblur=\"if(this.value==''){this.value='"+$('lang_email').value+"'}\"/></span>";
				htmlOwnBox+="</div>";
				htmlOwnBox+="<div class=\"bsDetail\" style=\"text-align:right;\">";
				htmlOwnBox+="<span class=\"bsText\" >"+$('lang_to').value+" : </span>";
					htmlOwnBox+="<input id=\"toEmail\" name=\"email\" style=\"width:178px; float:right;\" class=\"bsInput\" value=\""+$('lang_email').value+"\" onfocus=\"this.value=''\" onblur=\"if(this.value==''){this.value='"+$('lang_email').value+"'}\"/></span>";
				htmlOwnBox+="</div>";
				htmlOwnBox+="<div class=\"bsDetail\" style=\"text-align:center;\">";
					htmlOwnBox+="<input class=\"btClass\" type=\"button\" value=\""+$('lang_send').value+"\" onclick=\"sendEmail('"+pathLink+"')\" />";
				  	htmlOwnBox+="<input class=\"btClass\" type=\"button\" value=\""+$('lang_clear').value+"\" onclick=\"\" style=\"margin-left:10px;\" />";
				htmlOwnBox+="</div>";
			htmlOwnBox+="</div>";
		htmlOwnBox+="</form>";
		
//	alert(htmlOwnBox);
	showManageNode=document.createElement('div');	
	showManageNode.className="popupBox";
	showManageNode.setAttribute("id","showManage");	
	showManageNode.innerHTML=htmlOwnBox;
	document.body.appendChild(showManageNode);
	setCenter('showManage');
	
}
function sendEmail(pathLink){
		var fromEmail=$('fromEmail').value;
		var toEmail=$('toEmail').value;
		cp.call(fileTabMenu,'sendEmail',resSendEmail,fromEmail,toEmail,pathLink);
	
}
function resSendEmail(result){
	var send=result.getElementsByTagName('send')[0];
	var message=$value(send,'message');
	var email=$value(send,'email');

	if(message=='0'){
		alert ($('lang_msgNotSend').value);
		closeManage();
	}else if(message=='1'){
		alert ($('lang_msgComplete').value);
		closeManage();
	}else if(message=='2'){
		alert ($('lang_msgChk').value);
	}
	
}


// ----------------------------------- Tab Accident ----------------------------------------//
function changeRightAccident(tab,current,type){
	//$('boxTabGallery').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(type=='black'){ cClick="btAJClickVi"; cNoClick="btAJClassVi";	}
	else if(type=='white'){ cClick="btAJClick"; cNoClick="btAJClass";	}
	if(tab=='a'){	//lang_tabRecentReply
		b1=$('lang_tabRecentReply').value;			class1=cClick;			onmouseover1="changeRightAccident('a',1,'"+type+"')";
		b2=$('lang_tabRecentTopic').value;			class2=cNoClick;		onmouseover2="changeRightAccident('b',2,'"+type+"')";
		b3=$('lang_tabMostRead').value;				class3=cNoClick;		onmouseover3="changeRightAccident('c',3,'"+type+"')";
		cursor1="";							btclick1="";
		cursor2="cursor:pointer;";		btclick2="changeRightAccident('b',2,'"+type+"')";
	}
	
	else if(tab=='b'){ //lang_tabRecentTopic
		if(current==2){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onmouseover1="changeRightAccident('a',1,'"+type+"')";
			b2=$('lang_tabRecentTopic').value;		class2=cClick;			onmouseover2="changeRightAccident('b',2,'"+type+"')";
			b3=$('lang_tabMostRead').value;			class3=cNoClick;		onmouseover3="changeRightAccident('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightAccident('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightAccident('c',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabRecentTopic').value;		class1=cClick;			onmouseover1="changeRightAccident('b',1,'"+type+"')";
			b2=$('lang_tabMostRead').value;			class2=cNoClick;		onmouseover2="changeRightAccident('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onmouseover3="changeRightAccident('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightAccident('a',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightAccident('c',2,'"+type+"')";
		}
	}
	
	else if(tab=='c'){ //lang_tabMostView
		if(current==3){
			b1=$('lang_tabRecentReply').value;		class1=cNoClick;		onmouseover1="changeRightAccident('a',1,'"+type+"')";
			b2=$('lang_tabRecentTopic').value;		class2=cNoClick;		onmouseover2="changeRightAccident('b',2,'"+type+"')";
			b3=$('lang_tabMostRead').value;			class3=cClick;			onmouseover3="changeRightAccident('c',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightAccident('b',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightAccident('d',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabRecentTopic').value;		class1=cNoClick;		onmouseover1="changeRightAccident('b',1,'"+type+"')";
			b2=$('lang_tabMostRead').value;			class2=cClick;			onmouseover2="changeRightAccident('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cNoClick;		onmouseover3="changeRightAccident('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightAccident('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightAccident('d',3,'"+type+"')";
		}else if(current==1){
			b1=$('lang_tabMostRead').value;			class1=cClick;			onmouseover1="changeRightAccident('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cNoClick;		onmouseover2="changeRightAccident('d',2,'"+type+"')";
			b3=$('lang_tabMostVote').value;			class3=cNoClick;		onmouseover3="changeRightAccident('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightAccident('b',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightAccident('d',2,'"+type+"')";
		}
	}
	
	else if(tab=='d'){ //lang_tabMostReply
		if(current==3){
			b1=$('lang_tabRecentTopic').value;		class1=cNoClick;		onmouseover1="changeRightAccident('b',1,'"+type+"')";
			b2=$('lang_tabMostRead').value;			class2=cNoClick;		onmouseover2="changeRightAccident('c',2,'"+type+"')";
			b3=$('lang_tabMostReply').value;		class3=cClick;			onmouseover3="changeRightAccident('d',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightAccident('c',2,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightAccident('e',3,'"+type+"')";
		}else if(current==2){
			b1=$('lang_tabMostRead').value;			class1=cNoClick;		onmouseover1="changeRightAccident('c',1,'"+type+"')";
			b2=$('lang_tabMostReply').value;		class2=cClick;			onmouseover2="changeRightAccident('d',2,'"+type+"')";
			b3=$('lang_tabMostVote').value;			class3=cNoClick;		onmouseover3="changeRightAccident('e',3,'"+type+"')";
			cursor1="cursor:pointer;";		btclick1="changeRightAccident('c',1,'"+type+"')";
			cursor2="cursor:pointer;";		btclick2="changeRightAccident('e',3,'"+type+"')";
		}
	}
	else if(tab=='e'){ //lang_tabMostVote
		b1=$('lang_tabMostRead').value;				class1=cNoClick;		onmouseover1="changeRightAccident('c',1,'"+type+"')";
		b2=$('lang_tabMostReply').value;			class2=cNoClick;		onmouseover2="changeRightAccident('d',2,'"+type+"')";
		b3=$('lang_tabMostVote').value;				class3=cClick;			onmouseover3="changeRightAccident('e',3,'"+type+"')";
		cursor1="cursor:pointer;";		btclick1="changeRightAccident('d',2,'"+type+"')";
		cursor2="";							btclick2="";
	}
		var tabHTML ="";
		
        	tabHTML+="<center>";
        		tabHTML+="<input type=\"button\" name=\"tab1\" value=\""+b1+"\" class=\""+class1+"\" onclick=\""+onmouseover1+"\" />";	
        		tabHTML+="<input type=\"button\" name=\"tab2\" value=\""+b2+"\" class=\""+class2+"\" onclick=\""+onmouseover2+"\"/>";	
        		tabHTML+="<input type=\"button\" name=\"tab3\" value=\""+b3+"\" class=\""+class3+"\" onclick=\""+onmouseover3+"\"/>";	
        	tabHTML+="</center>";
			tabHTML+="<div class=\"floatleft\"><img src=\"pic/btn_first.gif\" style=\"margin-top:5px; margin-left:225px;margin-bottom:5px;"+cursor1+"\" onclick=\""+btclick1+"\" /></div>";
			tabHTML+="<div class=\"floatRight\"><img src=\"pic/btn_last.gif\" style=\"margin-top:5px; margin-right: 5px; margin-bottom:5px;"+cursor2+"\" onclick=\""+btclick2+"\" /></div>";
		$('rightTabAcd').innerHTML=tabHTML;
	
	//cp.call(fileTabMenu,'changeRightAccident',resRightWebboard,tab);
		if(type=='white'){ 	cp.call(fileTabMenu,'changeRightAccident',resRightAccident,tab); 	}
		else if(type=='black')	{	cp.call(fileTabMenu,'changeRightAccident',resRightBlackAccident,tab); 	}
		//resRightBlackWebboard
}
function resRightAccident(result){    
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var webID=tab.getElementsByTagName('webID');
	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";
	
	for(var i=0;i<webID.length;i++){
		
		var id=$value(webID[i],'id');
		var name=spacialChar($value(webID[i],'name'));
		var outcome=spacialChar($value(webID[i],'outcome'));
		var types_of_diving=spacialChar($value(webID[i],'diving'));
		var country=spacialChar($value(webID[i],'country'));
		var arrDate0=spacialChar($value(webID[i],'arrDate0'));
		var arrDate1=spacialChar($value(webID[i],'arrDate1'));
		var arrDate2=spacialChar($value(webID[i],'arrDate2'));
		var update=$value(webID[i],'update');
		var webVote=$value(webID[i],'webVote');
		var webView=$value(webID[i],'webView');
		var webImg=$value(webID[i],'webImg');
		var description=$value(webID[i],'description');
	
		//var name2=name.replace(/\'/gi,"");
		//var description2=description.replace(/\'/gi,"");
		
		//var name=spacialChar(name);
		//var name=strip_tags(name);
		//var country=spacialChar(country);
		//var country=strip_tags(country);
		//var divesSite=spacialChar(divesSite);
		//var divesSite=strip_tags(divesSite);
		//var dateIncident=spacialChar(dateIncident);
		//var dateIncident=strip_tags(dateIncident);
		var description=spacialChar(description);
		var description=strip_tags(description);
		
		tabHTML+="<div class=\"PastcontentWG\">";
			tabHTML+="<div class=\"VoteWG\">";
  				tabHTML+="<div class=\"WGimgVote\" >";
					tabHTML+="<input type=\"button\" id=\"bt-r-web_"+id+"\" onclick=\"upVoteAc('bt-r-web_"+id+"','"+id+"')\" value=\""+webVote+"\" class=\"btClassWG\" style=\"vertical-align:top; text-align:center;\" />";
      			tabHTML+="</div>";					
      			tabHTML+="<div class=\"TxtVoteWG\"><a href=\"javascript:void(0)\" onclick=\"upVoteAc('bt-r-web_"+id+"','"+id+"');\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>"; 
			//tabHTML+="<a href=\"webboard_detail.php?webID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWG\"><a href=\"webboard_detail_Acd.php?webID="+id+"\" ><img src=\""+webImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideo\"><a href=\"webboard_detail_Acd.php?webID="+id+"\"  onmouseover=\"showTip(this,event,'"+name+"','"+name+","+outcome+","+types_of_diving+","+country+","+arrDate0+"-"+arrDate1+"-"+arrDate2+"','"+description+"','"+webImg+"');\">"+name+","+outcome+","+types_of_diving+","+country+","+arrDate0+"-"+arrDate1+"-"+arrDate2+"</a></div>";
				//tabHTML+="<div class=\"TitleWGVideo\"><a href=\"webboard_detail.php?webID="+id+"\" onmouseover=\"showTip(this,event,'"+webTopic+"','"+webTopic+"','"+shotDetail+"','"+webImg+"');\">"+cutName+"</a></div>";
			tabHTML+="<div class=\"ViewWG\">"+$('lang_view').value+" : "+webView+"</div>";///////////////////////////////////////////////////////////////////////////////////////////////////////////////onmouseover=\"showTip(this,event,'"+webTopic+"','"+webTopic+"','"+shotDetail+"','"+webImg+"');
			//tabHTML+="<input type=\"text\" value=\""+shotDetail+"\" >";
		tabHTML+="</div>";
			
			//if(numTab=='a'){
				var rplID=tab.getElementsByTagName('rplID'+id);
				for(var j=0;j<rplID.length;j++){
					var id2=$value(rplID[j],'id2');
					var webboardrpl_page=$value(rplID[i],'acRpl_page');
					var webboardrpl1_detail=$value(rplID[j],'acRpl1_detail');
					
					var webboardrpl1_detail=spacialChar(webboardrpl1_detail);
					var webboardrpl1_detail=strip_tags(webboardrpl1_detail);
					
					tabHTML+="<div  class=\"list_reply\"><li class=\"to_reply\"><a href=\"webboard_detail_Acd.php?webID="+id+"&page="+webboardrpl_page+"#"+id2+"\" >"+webboardrpl1_detail+"</a></li></div>";
				}
			//}
			
	}
	$('boxRightAcd').innerHTML=tabHTML;
	
}
function resRightBlackAccident(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var webID=tab.getElementsByTagName('webID');
	
	var tabHTML ="";
	tabHTML+="<div class=\"Pastblank-short\"></div>";

	for(var i=0;i<webID.length;i++){
		
		var id=$value(webID[i],'id');
		var id=$value(webID[i],'id');
		var name=spacialChar($value(webID[i],'name'));
		var outcome=spacialChar($value(webID[i],'outcome'));
		var types_of_diving=spacialChar($value(webID[i],'diving'));
		var country=spacialChar($value(webID[i],'country'));
		var arrDate0=spacialChar($value(webID[i],'arrDate0'));
		var arrDate1=spacialChar($value(webID[i],'arrDate1'));
		var arrDate2=spacialChar($value(webID[i],'arrDate2'));
		var update=$value(webID[i],'update');
		var webVote=$value(webID[i],'webVote');
		var webView=$value(webID[i],'webView');
		var webImg=$value(webID[i],'webImg');
		var description=$value(webID[i],'description');
		
		//var divesSite2=divesSite.replace(/\'/gi,"");
		var description2=description.replace(/\'/gi,"");
		
		//var nearestTown=spacialChar(nearestTown);
		//var nearestTown=strip_tags(nearestTown);
		//var country=spacialChar(country);
		//var country=strip_tags(country);
		//var divesSite=spacialChar(divesSite);
		//var divesSite=strip_tags(divesSite);
		//var dateIncident=spacialChar(dateIncident);
		//var dateIncident=strip_tags(dateIncident);
		//var divesSite2=spacialChar(divesSite2);
		//var divesSite2=strip_tags(divesSite2);
		var description2=spacialChar(description2);
		var description2=strip_tags(description2);
		
		tabHTML+="<div class=\"PastcontentWGVi\">";
			tabHTML+="<div class=\"VoteWGVi\">";
  				tabHTML+="<div class=\"WGimgVoteVi\" >";
					tabHTML+="<input type=\"button\" id=\"bt-r-web_"+id+"\" onclick=\"upVoteAc('bt-r-web_"+id+"','"+id+"')\" value=\""+webVote+"\" class=\"btClassWG\" style=\"vertical-align:top; text-align:center;\" />";
      			tabHTML+="</div>";					
      			tabHTML+="<div class=\"TxtVoteWGVi\"><c href=\"javascript:void(0)\" onclick=\"upVoteAc('bt-r-web_"+id+"','"+id+"');\">"+$('lang_vote').value+"</c></div>";
      		tabHTML+="</div>"; 
			//tabHTML+="<a href=\"webboard_detail.php?webID="+id+"\">";
				tabHTML+="<div class=\"imgvideoWGVi\"><a href=\"webboard_detail_Acd.php?webID="+id+"\" ><img src=\""+webImg+"\" width=\"50\" height=\"50\"/></a></div>";
				tabHTML+="<div class=\"TitleWGVideoVi\"><a href=\"webboard_detail_Acd.php?webID="+id+"\"  onmouseover=\"showTip(this,event,'"+name+"','"+name+","+outcome+","+types_of_diving+","+country+","+arrDate0+"-"+arrDate1+"-"+arrDate2+"','"+description+"','"+webImg+"');\">"+name+","+outcome+","+types_of_diving+","+country+","+arrDate0+"-"+arrDate1+"-"+arrDate2+"</a></div>";
			tabHTML+="<div class=\"ViewWGVi\">"+$('lang_view').value+" : "+webView+"</div>";///////////////////////////////////////////////////////////////////////////////////////////////////////////////onmouseover=\"showTip(this,event,'"+webTopic+"','"+webTopic+"','"+shotDetail+"','"+webImg+"');
			//tabHTML+="<input type=\"text\" value=\""+shotDetail+"\" >";
		tabHTML+="</div>";
			
			//if(numTab=='a'){
				var rplID=tab.getElementsByTagName('rplID'+id);
				for(var j=0;j<rplID.length;j++){
					var id2=$value(rplID[j],'id2');
					var webboardrpl_page=$value(rplID[i],'acRpl_page');
					var webboardrpl1_detail=$value(rplID[j],'acRpl1_detail');
					
					var webboardrpl1_detail=spacialChar(webboardrpl1_detail);
					var webboardrpl1_detail=strip_tags(webboardrpl1_detail);
					
					tabHTML+="<div  class=\"list_reply\"><li class=\"to_reply\"><a href=\"webboard_detail_Acd.php?webID="+id+"&page="+webboardrpl_page+"#"+id2+"\" >"+webboardrpl1_detail+"</a></li></div>";
				}
			//}
			
	}
	$('boxRightAcd').innerHTML=tabHTML;
	
}
function changeTabAcdCate(tab,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />"; ,catID,subCatID
	if(tab==1){
		document.getElementById('Board1Tab').className='current';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';	
		$('page-index-acd').innerHTML="";
	}else if(tab==2){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='current';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-acd').innerHTML="";
	}
	else if(tab==3){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='current';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='modernbricksmenu';
		pagecutTab(rowPerPage,allPage,1,pagePerGroup,typePage,linkPage,box,'','');
	}
	else if(tab==4){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='current';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-acd').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='current';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-acd').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='current';
		$('page-index-acd').innerHTML="";
	}
	cp.call(fileTabMenu,'changeTabAcdCate',resTabAcd,tab);

}
function resTabAcd(result){
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var webID=tab.getElementsByTagName('webID');
	
	var tabHTML ="";
	tabHTML+="<div class=\"blankN\"></div>";

	for(var i=0;i<webID.length;i++){
		
		var id=$value(webID[i],'id');
		//var webTopic=spacialChar($value(webID[i],'webTopic'));
		var webImg=$value(webID[i],'webImg');
		var webVote=$value(webID[i],'webVote');
		var webView=$value(webID[i],'webView');
		var update=$value(webID[i],'update');
		var webDetail=strip_tags(spacialChar($value(webID[i],'description')));
		var comment=$value(webID[i],'comment');
		var member=$value(webID[i],'member');
		var memberID=$value(webID[i],'memberID');
		var name=spacialChar($value(webID[i],'name'));
		var outcome=spacialChar($value(webID[i],'outcome'));
		var types_of_diving=spacialChar($value(webID[i],'types_of_diving'));
		var country=spacialChar($value(webID[i],'country'));
		var arrDate0=spacialChar($value(webID[i],'arrDate0'));
		var arrDate1=spacialChar($value(webID[i],'arrDate1'));
		var arrDate2=spacialChar($value(webID[i],'arrDate2'));
		
		tabHTML+="<div class=\"Pastcontent-webboard2\">";
			/*tabHTML+="<div class=\"Vote2New\">";
  				tabHTML+="<div class=\"imgVote\">";
  					tabHTML+="<input type=\"button\" id=\"bt-l-web_"+id+"\" onclick=\"upVoteWeb('bt-l-web_"+id+"','"+id+"')\" value=\""+webVote+"\" class=\"btClassV\" style=\"vertical-align:top;\" />";
      			tabHTML+="</div>";
        		tabHTML+="<div class=\"TxtVoteN\"><a href=\"javascript:void(0)\" onclick=\"upVoteWeb('bt-l-web_"+id+"','"+id+"')\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
        	//tabHTML+="<a href=\"webboard_detail.php?webID="+id+"\">";*/
            	tabHTML+="<div class=\"picRightN\">";
                	tabHTML+="<div class=\"imgsize\"><a href=\"webboard_detail.php?webID="+id+"\" ><img src=\""+webImg+"\" width=\"80\" height=\"80\"></a></div>";
            	tabHTML+="</div>";
            	tabHTML+="<div class=\"TitleN\"><a href=\"webboard_detail.php?webID="+id+"\" >"+name+","+outcome+","+types_of_diving+","+country+","+arrDate0+"-"+arrDate1+"-"+arrDate2+"</a></div>";
            	tabHTML+="<div class=\"TextBoardN2\">";
                	tabHTML+="<a1><a href=\"webboard_detail.php?webID="+id+"\" >"+webDetail+"</a></a1>";
            	tabHTML+="</div>";
        	//tabHTML+="</a>";
	  		tabHTML+="<div class=\"TextBoard-footer\">";
            	tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
				tabHTML+=""+$('lang_view').value+" : "+webView+"&nbsp;";
				tabHTML+=""+$('lang_comment').value+" : "+comment+"&nbsp;";
				tabHTML+=""+$('lang_date').value+" :"+update+"";
				tabHTML+="<b><a href=\"javascript:void(0);\" title=\"Share Facebook\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"webboard_detail.php?webID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            		tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            	tabHTML+="<a href=\"javascript:void(0);\" title=\"Share Twitter\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"webboard_detail.php?webID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
					tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
				tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"webboard_detail.php?webID="+id+"')\">";
            		tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b>";
				//tabHTML+=""+$('lang_date').value+"&nbsp;"+update+"";
        	tabHTML+="</div>";
  		tabHTML+="</div>";
	}
//		 
	$('boxTabAccident').innerHTML=tabHTML;
	
}
function resTabAccident(result){ 	 
	var tab=result.getElementsByTagName('tab')[0]; 
	var numTab=tab.getAttribute('id');
	var webID=tab.getElementsByTagName('webID');
	
	var tabHTML ="";
	tabHTML+="<div class=\"blankN\"></div>";

	for(var i=0;i<webID.length;i++){ 
		
		var id=$value(webID[i],'id');
		var name=spacialChar($value(webID[i],'name'));
		var outcome=spacialChar($value(webID[i],'outcome'));
		var types_of_diving=spacialChar($value(webID[i],'types_of_diving'));
		var country=spacialChar($value(webID[i],'country'));
		var arrDate0=spacialChar($value(webID[i],'arrDate0'));
		var arrDate1=spacialChar($value(webID[i],'arrDate1'));
		var arrDate2=spacialChar($value(webID[i],'arrDate2'));
		var webImg=$value(webID[i],'webImg');
		var webVote=$value(webID[i],'webVote');
		var webView=$value(webID[i],'webView');
		var update=$value(webID[i],'update');
		var webDetail=strip_tags(spacialChar($value(webID[i],'webDetail')));
		var comment=$value(webID[i],'comment');
		var member=$value(webID[i],'member');
		var memberID=$value(webID[i],'memberID');
		//var webCat=$value(webID[i],'webCat');
		
		tabHTML+="<div class=\"Pastcontent-webboard2\">";
			/*tabHTML+="<div class=\"Vote2New\">";
  				tabHTML+="<div class=\"imgVote\">";
  					tabHTML+="<input type=\"button\" id=\"bt-l-web_"+id+"\" onclick=\"upVoteWeb('bt-l-web_"+id+"','"+id+"')\" value=\""+webVote+"\" class=\"btClassV\" style=\"vertical-align:top;\" />";
      			tabHTML+="</div>";
        		tabHTML+="<div class=\"TxtVoteN\"><a href=\"javascript:void(0)\" onclick=\"upVoteWeb('bt-l-web_"+id+"','"+id+"')\">"+$('lang_vote').value+"</a></div>";
      		tabHTML+="</div>";
        	//tabHTML+="<a href=\"webboard_detail.php?webID="+id+"\">";*/
          		tabHTML+="<div class=\"picRightN\">";
                	tabHTML+="<div class=\"imgsize\"><a href=\"webboard_detail.php?webID="+id+"\" ><img src=\""+webImg+"\" width=\"80\" height=\"80\"></a></div>";
            	tabHTML+="</div>";
            	tabHTML+="<div class=\"TitleN\"><a href=\"webboard_detail.php?webID="+id+"\" >"+name+","+outcome+","+types_of_diving+","+country+","+arrDate0+"-"+arrDate1+"-"+arrDate2+"</a></div>";
            	tabHTML+="<div class=\"TextBoardN2\">";
                	tabHTML+="<a1><a href=\"webboard_detail.php?webID="+id+"\" >"+webDetail+"</a></a1>";
            	tabHTML+="</div>";
        	//tabHTML+="</a>";
	  		tabHTML+="<div class=\"TextBoard-footer\">";
            	tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
				tabHTML+=""+$('lang_view').value+" : "+webView+"&nbsp;";
				tabHTML+=""+$('lang_comment').value+" : "+comment+"&nbsp;";
				tabHTML+=""+$('lang_date').value+" :"+update+"";
				tabHTML+="<b><a href=\"javascript:void(0);\" title=\"Share Facebook\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"webboard_detail.php?webID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            		tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            	tabHTML+="<a href=\"javascript:void(0);\" title=\"Share Twitter\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"webboard_detail.php?webID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
					tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
				tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"webboard_detail.php?webID="+id+"')\">";
            		tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b>";
				//tabHTML+=""+$('lang_date').value+"&nbsp;"+update+"";
        	tabHTML+="</div>";
  		tabHTML+="</div>";
	}
		 
	$('boxTabAccident').innerHTML=tabHTML;
	
}
// ----------------------------------- Tab Sponsor ----------------------------------------//
function changeTabAds(tab,catID){	
	
	var count=document.getElementById('count').value;	
	for(var i=1;i<count;i++){
		if(tab==i){
			document.getElementById('Ads'+i+'Tab').className='current';
		}else{
			document.getElementById('Ads'+i+'Tab').className='modernbricksmenu';
		}	
	}
	document.getElementById('cat_id').value=catID;
	cp.call(fileTabMenu,'changeTabAds',resTabAds,tab,catID);	
}
function resTabAds(result){			
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var subID=tab.getElementsByTagName('subID');
	
	var tabHTML ="";
	
	for(var i=0;i<subID.length;i++){
		var id=$value(subID[i],'id');
		var subName=$value(subID[i],'subName');
		var catID=$value(subID[i],'catID');
		tabHTML+='<div class="ImgSpon2"><a href="cate_sponsor.php?catID='+catID+'&subCatID='+id+'">'+subName+'</div>';
	}
	var where=tab.getElementsByTagName('where');
	var whereCat=strip_tags(spacialChar($value(where[0],'whereCat')));
	//alert(whereCat);
	document.getElementById('boxTabAds').innerHTML=tabHTML;
	
	
	var nameCatID=tab.getElementsByTagName('nameCatID');
	var categoryID=$value(nameCatID[0],'id');
	var catName=strip_tags(spacialChar($value(nameCatID[0],'catName')));
	var rowPerPage=$value(nameCatID[0],'rowPerPage');
	var allPage=$value(nameCatID[0],'allPage');
	var pagePerGroup=$value(nameCatID[0],'pagePerGroup');
	var typePage=$value(nameCatID[0],'typePage');
	var linkPage=$value(nameCatID[0],'linkPage');
	var limit=$value(nameCatID[0],'limit');
	var thisPage=1;
	document.getElementById('categoryName').innerHTML=catName;
	//alert(linkPage);
	///////////////////////////////////cutPage///////////////////////////////////////////////////
	var thisGroup=Math.ceil(thisPage/pagePerGroup);
	var allGroup=Math.ceil(allPage/pagePerGroup);
	var box="page-index-spon";
	var subCatID="";
	var pages="";
	
	if(thisGroup>1&&allGroup>1){
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" onclick=\"pagecutTab("+rowPerPage+","+allPage+",1,'"+pagePerGroup+"','"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"');\" style=\"cursor:pointer;\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt((thisGroup-2)*pagePerGroup+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"')\" style=\"cursor:pointer;\" />&nbsp;&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" />&nbsp;&nbsp;";
	}
	for(i=1;(i<=pagePerGroup)&&(i+pagePerGroup*(thisGroup-1)<=allPage);i++){
		if(i+pagePerGroup*(thisGroup-1)==thisPage){
			pages+="<font id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" style=\"font-weight:bold; color:#3399FF;\">"+(i+pagePerGroup*(thisGroup-1))+"</font>&nbsp;&nbsp;";
		}else{
			var limit=(((i+pagePerGroup*(thisGroup-1))-1)*rowPerPage)+","+rowPerPage;
			pages+="<a href=\"javascript:void(0);\" id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt(i+pagePerGroup*(thisGroup-1))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"')\">"+(i+pagePerGroup*(thisGroup-1))+"</a>&nbsp;&nbsp;";
		}
	}
	if(thisGroup<allGroup&&allGroup>1){
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt(parseInt(thisPage)+parseInt(5))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"')\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTab("+rowPerPage+","+allPage+","+parseInt((allPage-pagePerGroup)+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"')\" />&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" />";
	}
	
	$('page-index-spon').innerHTML=pages;
	

	//////////////////////////////TAB////////////////////////////////////
	tabHTML ="";
	
	   	tabHTML+="<div class=\"modernbricksmenu\">";
			tabHTML+="<div id=\"Board1Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsor(1,'"+categoryID+"','');\" >"+$('lang_tabBestTopic').value+"</b></div>";
            
            tabHTML+="<div id=\"Board2Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsor(2,'"+categoryID+"','');\" >"+$('lang_tabRecentReply').value+"</b></div>";
            
            tabHTML+="<div id=\"Board3Tab\"  class=\"current\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsor(3,'"+categoryID+"','"+rowPerPage+"','"+allPage+"',1,'"+pagePerGroup+"','"+typePage+"','"+linkPage+"','page-index-spon');\" >"+$('lang_tabRecentTopic').value+"</b></div>";
          
		 // changeTabSponsor(tab,catID,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box)
		  
            tabHTML+="<div id=\"Board4Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsor(4,'"+categoryID+"','');\" >"+$('lang_tabMostRead').value+"</b></div>";
            
            tabHTML+="<div id=\"Board5Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsor(5,'"+categoryID+"','');\" >"+$('lang_tabMostReply').value+"</b></div>";
            
            tabHTML+="<div id=\"Board6Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsor(6,'"+categoryID+"','');\" >"+$('lang_tabMostVote').value+"</b></div>";
            tabHTML+="</div>";
        tabHTML+="</div>";
	
	$('boxChangeTabSpon').innerHTML=tabHTML;
	
	
	
	var sponID=tab.getElementsByTagName('sponID');
	var countCkk=1;
	var tabHTML ="";
	tabHTML+="<div class=\"blankN\"></div>";

	for(var i=0;i<sponID.length;i++){
		
		var id=$value(sponID[i],'id');
		var sponTopic=spacialChar($value(sponID[i],'sponTopic'));
		var sponImg=$value(sponID[i],'sponImg');
		var sponVote=$value(sponID[i],'sponVote');
		var sponView=$value(sponID[i],'sponView');
		var update=$value(sponID[i],'update');
		var sponDetail=strip_tags(spacialChar($value(sponID[i],'sponDetail')));
		var sponDetail=sponDetail.substring(0,300); 
		var comment=$value(sponID[i],'comment');
		var member=$value(sponID[i],'member');
		var memberID=$value(sponID[i],'memberID');
		var sponCat=$value(sponID[i],'sponCat');
		var sponSubCat=$value(sponID[i],'sponSubCat');
		var sticky=$value(sponID[i],'sticky');
		var opinion=$value(sponID[i],'opinion')
		var can=$value(sponID[i],'can');
		
		tabHTML+="<div class=\"Pastcontent-webboard2\">";

			if(can==1){
					tabHTML+="<div class=\"checkBoxBoard\"><input name=\"checkbox"+countCkk+"\" type=\"checkbox\" value=\""+id+"\"></div>";
				}
            	tabHTML+="<div class=\"picRightN\">";
				
                	tabHTML+="<div class=\"imgsize\"><a href=\"sponsor_detail.php?sponID="+id+"\" ><img src=\""+sponImg+"\" width=\"80\" height=\"80\"></a></div>";
            	tabHTML+="</div>";
            	tabHTML+="<div class=\"TitleN\">";
				if(sticky==2){ tabHTML+="<span style=\"color:#FF0000; font-size:11px;\">News </span>"; }
				 tabHTML+="<a href=\"sponsor_detail.php?sponID="+id+"\" >"+sponTopic+"</a></div>";
            	tabHTML+="<div class=\"TextBoardN2\">";
                	tabHTML+="<a1><a href=\"sponsor_detail.php?sponID="+id+"\" >"+sponDetail+"</a></a1>";
            	tabHTML+="</div>";
        	//tabHTML2+="</a>";
	  		tabHTML+="<div class=\"TextBoard-footer\">";
            	tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
				tabHTML+=""+$('lang_view').value+" : "+sponView+"&nbsp;";
				tabHTML+=""+$('lang_comment').value+" : "+comment+"&nbsp;";
				tabHTML+=""+$('lang_date').value+" :"+update+"";
				tabHTML+="<b><a href=\"javascript:void(0);\" title=\"Share Facebook\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"sponsor_detail.php?sponID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            		tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            	tabHTML+="<a href=\"javascript:void(0);\" title=\"Share Twitter\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"sponsor_detail.php?sponID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
					tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
				tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"sponsor_detail.php?sponID="+id+"')\">";
            		tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b>";
				//tabHTML2+=""+$('lang_date').value+"&nbsp;"+update+"";
        	tabHTML+="</div>";
  		tabHTML+="</div>";
		
		countCkk++;
	}
//		 
	$('boxTabSponsor').innerHTML=tabHTML;
	
	
}
function selectLang(langID){	
	var catID=document.getElementById('cat_id').value;		
	cp.call(fileTabMenu,'changeLangSpon',resTabLang,catID,langID);
}
function resTabLang(result){				
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var subID=tab.getElementsByTagName('subID');
	
	var tabHTML ="";
	
	for(var i=0;i<subID.length;i++){
		var id=$value(subID[i],'id');
		var subName=$value(subID[i],'subName');
		var catID=$value(subID[i],'catID');
		tabHTML+='<div class="ImgSpon2"><a href="cate_sponsor.php?catID='+catID+'&subCatID='+id+'">'+subName+'</div>';
	}
	var where=tab.getElementsByTagName('where');
	var whereCat=strip_tags(spacialChar($value(where[0],'whereCat')));
	//alert(whereCat);
	document.getElementById('boxTabAds').innerHTML=tabHTML;
	
	
	var nameCatID=tab.getElementsByTagName('nameCatID');
	var categoryID=$value(nameCatID[0],'id');
	var catName=strip_tags(spacialChar($value(nameCatID[0],'catName')));
	var rowPerPage=$value(nameCatID[0],'rowPerPage');
	var allPage=$value(nameCatID[0],'allPage');
	var pagePerGroup=$value(nameCatID[0],'pagePerGroup');
	var typePage=$value(nameCatID[0],'typePage');
	var linkPage=$value(nameCatID[0],'linkPage');
	var limit=$value(nameCatID[0],'limit');
	var thisPage=1;
	document.getElementById('categoryName').innerHTML=catName;
	//alert(linkPage);
	///////////////////////////////////cutPage///////////////////////////////////////////////////
	var thisGroup=Math.ceil(thisPage/pagePerGroup);
	var allGroup=Math.ceil(allPage/pagePerGroup);
	var box="page-index-spon";
	var subCatID="";
	var pages="";
	
	if(thisGroup>1&&allGroup>1){
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" onclick=\"pagecutTabLang("+rowPerPage+","+allPage+",1,'"+pagePerGroup+"','"+typePage+"','"+linkPage+"','"+box+"','"+catID+"','"+subCatID+"','"+whereCat+"');\" style=\"cursor:pointer;\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt((thisGroup-2)*pagePerGroup+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"','"+whereCat+"')\" style=\"cursor:pointer;\" />&nbsp;&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_first.gif\" title=\"First Page\" id=\"pageFitst\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_previous.gif\" title=\"Previous\" id=\"pagePrevious\" />&nbsp;&nbsp;";
	}
	for(i=1;(i<=pagePerGroup)&&(i+pagePerGroup*(thisGroup-1)<=allPage);i++){
		if(i+pagePerGroup*(thisGroup-1)==thisPage){
			pages+="<font id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" style=\"font-weight:bold; color:#3399FF;\">"+(i+pagePerGroup*(thisGroup-1))+"</font>&nbsp;&nbsp;";
		}else{
			var limit=(((i+pagePerGroup*(thisGroup-1))-1)*rowPerPage)+","+rowPerPage;
			pages+="<a href=\"javascript:void(0);\" id=\"pageNum"+(i+pagePerGroup*(thisGroup-1))+"\" onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt(i+pagePerGroup*(thisGroup-1))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"','"+whereCat+"')\">"+(i+pagePerGroup*(thisGroup-1))+"</a>&nbsp;&nbsp;";
		}
	}
	if(thisGroup<allGroup&&allGroup>1){
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt(parseInt(thisPage)+parseInt(5))+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"','"+whereCat+"')\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" style=\"cursor:pointer;\"";
		pages+="onclick=\"pagecutTabLang("+rowPerPage+","+allPage+","+parseInt((allPage-pagePerGroup)+1)+","+pagePerGroup+",'"+typePage+"','"+linkPage+"','"+box+"','"+categoryID+"','"+subCatID+"','"+whereCat+"')\" />&nbsp;";
	}else{
		pages+="<img src=\"images/icon/btn_next.gif\" title=\"Next\" id=\"pageNext\" />&nbsp;";
		pages+="<img src=\"images/icon/btn_last.gif\" title=\"Last Page\" id=\"pageLast\" />";
	}
	
	$('page-index-spon').innerHTML=pages;
	

	//////////////////////////////TAB////////////////////////////////////
	tabHTML ="";
	
	   	tabHTML+="<div class=\"modernbricksmenu\">";
			tabHTML+="<div id=\"Board1Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsorLang(1,'"+categoryID+"','"+whereCat+"');\" >"+$('lang_tabBestTopic').value+"</b></div>";
            
            tabHTML+="<div id=\"Board2Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsorLang(2,'"+categoryID+"','"+whereCat+"');\" >"+$('lang_tabRecentReply').value+"</b></div>";
            
            tabHTML+="<div id=\"Board3Tab\"  class=\"current\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsorLang(3,'"+categoryID+"','"+rowPerPage+"','"+allPage+"',1,'"+pagePerGroup+"','"+typePage+"','"+linkPage+"','page-index-spon','"+whereCat+"');\" >"+$('lang_tabRecentTopic').value+"</b></div>";
            	
            tabHTML+="<div id=\"Board4Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsorLang(4,'"+categoryID+"','"+whereCat+"');\" >"+$('lang_tabMostRead').value+"</b></div>";
            
            tabHTML+="<div id=\"Board5Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsorLang(5,'"+categoryID+"','"+whereCat+"');\" >"+$('lang_tabMostReply').value+"</b></div>";
            
            tabHTML+="<div id=\"Board6Tab\">";
                tabHTML+="<b href=\"javascript:void(0);\"  onClick=\"changeTabSponsorLang(6,'"+categoryID+"','"+whereCat+"');\" >"+$('lang_tabMostVote').value+"</b></div>";
            tabHTML+="</div>";
        tabHTML+="</div>";
	
	$('boxChangeTabSpon').innerHTML=tabHTML;
	
	
	
	var sponID=tab.getElementsByTagName('sponID');
	var countCkk=1;
	var tabHTML ="";
	tabHTML+="<div class=\"blankN\"></div>";

	for(var i=0;i<sponID.length;i++){
		
		var id=$value(sponID[i],'id');
		var sponTopic=spacialChar($value(sponID[i],'sponTopic'));
		var sponImg=$value(sponID[i],'sponImg');
		var sponVote=$value(sponID[i],'sponVote');
		var sponView=$value(sponID[i],'sponView');
		var update=$value(sponID[i],'update');
		var sponDetail=strip_tags(spacialChar($value(sponID[i],'sponDetail')));
		var sponDetail=sponDetail.substring(0,300); 
		var comment=$value(sponID[i],'comment');
		var member=$value(sponID[i],'member');
		var memberID=$value(sponID[i],'memberID');
		var sponCat=$value(sponID[i],'sponCat');
		var sponSubCat=$value(sponID[i],'sponSubCat');
		var sticky=$value(sponID[i],'sticky');
		var opinion=$value(sponID[i],'opinion')
		var can=$value(sponID[i],'can');
		
		tabHTML+="<div class=\"Pastcontent-webboard2\">";

			if(can==1){
					tabHTML+="<div class=\"checkBoxBoard\"><input name=\"checkbox"+countCkk+"\" type=\"checkbox\" value=\""+id+"\"></div>";
				}
            	tabHTML+="<div class=\"picRightN\">";
				
                	tabHTML+="<div class=\"imgsize\"><a href=\"sponsor_detail.php?sponID="+id+"\" ><img src=\""+sponImg+"\" width=\"80\" height=\"80\"></a></div>";
            	tabHTML+="</div>";
            	tabHTML+="<div class=\"TitleN\">";
				if(sticky==2){ tabHTML+="<span style=\"color:#FF0000; font-size:11px;\">News </span>"; }
				 tabHTML+="<a href=\"sponsor_detail.php?sponID="+id+"\" >"+sponTopic+"</a></div>";
            	tabHTML+="<div class=\"TextBoardN2\">";
                	tabHTML+="<a1><a href=\"sponsor_detail.php?sponID="+id+"\" >"+sponDetail+"</a></a1>";
            	tabHTML+="</div>";
        	//tabHTML2+="</a>";
	  		tabHTML+="<div class=\"TextBoard-footer\">";
            	tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
				tabHTML+=""+$('lang_view').value+" : "+sponView+"&nbsp;";
				tabHTML+=""+$('lang_comment').value+" : "+comment+"&nbsp;";
				tabHTML+=""+$('lang_date').value+" :"+update+"";
				tabHTML+="<b><a href=\"javascript:void(0);\" title=\"Share Facebook\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"sponsor_detail.php?sponID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            		tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            	tabHTML+="<a href=\"javascript:void(0);\" title=\"Share Twitter\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"sponsor_detail.php?sponID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
					tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
				tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"sponsor_detail.php?sponID="+id+"')\">";
            		tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b>";
				//tabHTML2+=""+$('lang_date').value+"&nbsp;"+update+"";
        	tabHTML+="</div>";
  		tabHTML+="</div>";
		
		countCkk++;
	}
//		 
	$('boxTabSponsor').innerHTML=tabHTML;
	
	
}
function changeTabSponsor(tab,catID,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){
		document.getElementById('Board1Tab').className='current';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';	
		$('page-index-spon').innerHTML="";
	}else if(tab==2){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='current';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==3){	
		
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='current';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='modernbricksmenu';
		pagecutTab(rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,"");
	}
	else if(tab==4){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='current';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='current';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='current';
		$('page-index-spon').innerHTML="";
	}	
	cp.call(fileTabMenu,'changeTabSponsor',resTabSponsor,tab);

}
function resTabSponsor(result){		
	var tab=result.getElementsByTagName('tab')[0];
	var numTab=tab.getAttribute('id');
	var sponID=tab.getElementsByTagName('sponID');
	var countCkk=1;
	
	var tabHTML ="";
	tabHTML+="<div class=\"blankN\"></div>";

	for(var i=0;i<sponID.length;i++){
		
		var id=$value(sponID[i],'id');
		var sponTopic=spacialChar($value(sponID[i],'sponTopic'));
		var sponImg=$value(sponID[i],'sponImg');
		var sponVote=$value(sponID[i],'sponVote');
		var sponView=$value(sponID[i],'sponView');
		var update=$value(sponID[i],'update');
		var sponDetail=strip_tags(spacialChar($value(sponID[i],'sponDetail')));
		var sponDetail=sponDetail.substring(0,300); 
		var comment=$value(sponID[i],'comment');
		var member=$value(sponID[i],'member');
		var memberID=$value(sponID[i],'memberID');
		//var sponCat=$value(sponID[i],'sponCat');
		//var sponSubCat=$value(sponID[i],'sponSubCat');
		var sticky=$value(sponID[i],'sticky');
		var opinion=$value(sponID[i],'opinion')
		var can=$value(sponID[i],'can');
		
		tabHTML+="<div class=\"Pastcontent-webboard2\">";

			if(can==1){
					tabHTML+="<div class=\"checkBoxBoard\"><input name=\"checkbox"+countCkk+"\" type=\"checkbox\" value=\""+id+"\"></div>";
				}
            	tabHTML+="<div class=\"picRightN\">";
				
                	tabHTML+="<div class=\"imgsize\"><a href=\"sponsor_detail.php?sponID="+id+"\" ><img src=\""+sponImg+"\" width=\"80\" height=\"80\"></a></div>";
            	tabHTML+="</div>";
            	tabHTML+="<div class=\"TitleN\">";
				if(sticky==2){ tabHTML+="<span style=\"color:#FF0000; font-size:11px;\">News </span>"; }
				 tabHTML+="<a href=\"sponsor_detail.php?sponID="+id+"\" >"+sponTopic+"</a></div>";
            	tabHTML+="<div class=\"TextBoardN2\">";
                	tabHTML+="<a1><a href=\"sponsor_detail.php?sponID="+id+"\" >"+sponDetail+"</a></a1>";
            	tabHTML+="</div>";
        	//tabHTML+="</a>";
	  		tabHTML+="<div class=\"TextBoard-footer\">";
            	tabHTML+=""+$('lang_publisher').value+" <a href=\"member.php?user="+memberID+"\"> "+member+"</a>&nbsp;";
				tabHTML+=""+$('lang_view').value+" : "+sponView+"&nbsp;";
				tabHTML+=""+$('lang_comment').value+" : "+comment+"&nbsp;";
				tabHTML+=""+$('lang_date').value+" :"+update+"";
				tabHTML+="<b><a href=\"javascript:void(0);\" title=\"Share Facebook\" onClick=\"javascript:window.open('http://www.facebook.com/sharer.php?u="+$('pathMain').value+"sponsor_detail.php?sponID="+id+"','Facebook','status = 1, height = 450, width = 500, resizable = 0');\">";
            		tabHTML+="<img src=\"images/icon/facebook_w.png\" width=\"15\" height=\"15\" align=\"bottom margin-top:3px;\"/></a>&nbsp;";
            	tabHTML+="<a href=\"javascript:void(0);\" title=\"Share Twitter\" onClick=\"javascript:window.open('http://twitter.com/home?status="+$('pathMain').value+"sponsor_detail.php?sponID="+id+"','Twitter','status = 1, height = 520, width = 800, resizable = 0');\">";
					tabHTML+="<img src=\"images/icon/twitter_w.png\" width=\"15\" height=\"15\" align=\"bottom\" /></a>&nbsp;";
				tabHTML+="<a href=\"javascript:void(0);\" title=\""+$('lang_shareEmail').value+"\" onClick=\"shareEmail('"+$('pathMain').value+"sponsor_detail.php?sponID="+id+"')\">";
            		tabHTML+="<img src=\"images/icon/mail_w.png\" width=\"15\" height=\"17\" align=\"top\" /></a></b>";
				//tabHTML+=""+$('lang_date').value+"&nbsp;"+update+"";
        	tabHTML+="</div>";
  		tabHTML+="</div>";
		
		countCkk++;
	}
//		 
	$('boxTabSponsor').innerHTML=tabHTML;
	
	
}
function changeTabSponCate(tab,catID,subCatID,whereCat,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box){		
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />"; ,catID,subCatID
	if(tab==1){
		document.getElementById('Board1Tab').className='current';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';	
		$('page-index-spon').innerHTML="";
	}else if(tab==2){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='current';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==3){	
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='current';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='modernbricksmenu';
		pagecutTab(rowPerPage,allPage,1,pagePerGroup,typePage,linkPage,box,catID,subCatID);
	}
	else if(tab==4){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='current';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='current';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='current';
		$('page-index-spon').innerHTML="";
	}	
	cp.call(fileTabMenu,'changeTabSponCate',resTabSponsor,tab,catID,subCatID,whereCat);

}
function changeTabSponsorLang(tab,catID,rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,whereCat){
	//$('boxTabVideo').innerHTML="<img src=\""+$('pathMain').value+"images/icon/loader.gif\"  />";
	if(tab==1){
		document.getElementById('Board1Tab').className='current';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';	
		$('page-index-spon').innerHTML="";
	}else if(tab==2){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='current';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==3){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='current';
		document.getElementById('Board4Tab').className='modernbricksmenu';	
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='modernbricksmenu';
		pagecutTabLang(rowPerPage,allPage,thisPage,pagePerGroup,typePage,linkPage,box,catID,"",whereCat);
	}
	else if(tab==4){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='current';
		document.getElementById('Board5Tab').className='modernbricksmenu';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==5){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='current';	
		document.getElementById('Board6Tab').className='modernbricksmenu';
		$('page-index-spon').innerHTML="";
	}
	else if(tab==6){
		document.getElementById('Board1Tab').className='modernbricksmenu';
		document.getElementById('Board2Tab').className='modernbricksmenu';
		document.getElementById('Board3Tab').className='modernbricksmenu';
		document.getElementById('Board4Tab').className='modernbricksmenu';
		document.getElementById('Board5Tab').className='modernbricksmenu';
		document.getElementById('Board6Tab').className='current';
		$('page-index-spon').innerHTML="";
	}	
	cp.call(fileTabMenu,'changeTabSponsor',resTabSponsor,tab);

}
function changeSponStatus(box,sponID,dis){
	cp.call(fileTabMenu,'changeSponStatus',resSponStatus,box,sponID,dis);
}
function resSponStatus(result){
	var boxVote=result.getElementsByTagName('boxVote')[0];
	var sponID=$value(boxVote,'id');
	var box=$value(boxVote,'box');
	var val=$value(boxVote,'dis');

	if(val==1){
		//status=$('lang_publish').value;
		var dis=2;
		var disTxt=$('lang_publish').value;
		var disTxtTooltip=$('lang_clickToHide').value;
	}else if(val==2){
		//status=$('lang_hide').value;
		var dis=1;
		var disTxt=$('lang_hide').value;
		var disTxtTooltip=$('lang_clickToPublish').value
	}
	//$(box).innerHTML=""+status+"";
	$('chgDisSpon'+sponID).innerHTML=disTxt;
	$('chgDisSpon'+sponID).title=disTxtTooltip;
	$('chgDisSpon'+sponID).onclick=function(){changeSponStatus(box,sponID,dis);};
}
