$(document).ready(function() {
								$('#globalContainer').click(function() {
												$('#msIcoFrCov').hide();
												$('#msIcoReCov').hide();
												$('#msIcoMsCov').hide();
												$('#goldBox').hide();
												$('#logInfoSq').hide();
												});
								});
function Did(x) {
				if (typeof x == "string") return document.getElementById(x);
				return x;
}

function headMenuDisplay() {
				hideMsgMenu();
				if(Did('logInfoSq').style.display=='block')
								Did('logInfoSq').style.display='none';
				else{
								Did('logInfoSq').style.left=$('#headerLoginLC').offset().left+'px';
								Did('logInfoSq').style.display='block';
				}
}

function hideUserMenu() {
				if(Did('logInfoSq')){
								Did('logInfoSq').style.display='none';
				}
}
function hideMsgMenu() {
				$('#msIcoFrCov').hide();
				$('#msIcoReCov').hide();
				$('#msIcoMsCov').hide();
				$('#goldBox').hide();
}
function goldPop(bl,m1,m2,m3) {
				hideMsgMenu();
				hideUserMenu();
				var gcn='';
				if(bl=='f'){
								if(m1<1)
												gcn="<div class='gcText01'>沒有新的交友邀請。</div>";
								else
												gcn="<a href='../acc/invEvt.php' class='gcBtn63'>你有 <span class='gcBtn64'>"+m1+"</span> 則交友邀請</a>";
								$('#gcTitle').html('交友');
								$('#gcCont').html(gcn);
								$('#msIcoFrCov').show();
								$('#goldBox').css('left',$('#msIcoFr').offset().left+'px');
								$('#msIcoFrCov').css('left',$('#msIcoFr').offset().left+'px');
				}
				if(bl=='r'){
								if(m1 + m2<1)
												gcn="<div class='gcText01'>沒有新的回應。</div>";
								else{
												if(m1>0)
																gcn="<a href='../acc/reply.php' class='gcBtn63'>你有 <span class='gcBtn64'>"+m1+"</span> 則作品回應</a>";
												if(m2>0)
																gcn+="<a href='../acc/blogReplyNotice.php' class='gcBtn63'>你有 <span class='gcBtn64'>"+m2+"</span> 則回覆通知</a>";
								}
								$('#gcCont').html(gcn);
								$('#gcTitle').html('回應');
								$('#msIcoReCov').show();
								$('#goldBox').css('left',$('#msIcoRe').offset().left+'px');
								$('#msIcoReCov').css('left',$('#msIcoRe').offset().left+'px');
				}
				if(bl=='m'){
								if(m1 + m2 + m3<1)
												gcn="<div class='gcText01'>沒有新的訊息。</div>";
								else {
												if(m1>0)
																gcn="<a href='../acc/viewInv.php' class='gcBtn63'>你有 <span class='gcBtn64'>"+m1+"</span> 則新作品通知</a>";
												if(m2>0)
																gcn+="<a href='../acc/usrMsg.php' class='gcBtn63'>你有 <span class='gcBtn64'>"+m2+"</span> 則個人訊息</a>";
												if(m3>0)
																gcn+="<a href='../acc/sysMsg.php' class='gcBtn63'>你有 <span class='gcBtn64'>"+m3+"</span> 則網站訊息</a>";
								}
								$('#gcTitle').html('訊息');
								$('#gcCont').html(gcn);
								$('#msIcoMsCov').show();
								$('#goldBox').css('left',$('#msIcoMs').offset().left+'px');
								$('#msIcoMsCov').css('left',$('#msIcoMs').offset().left+'px');
				}
				$('#goldBox').show();
}

function flexMemActs(_act) {
				var lR = Did('liBContent');
				if(_act=="loginseccuss" || _act=="regsuccess"){
								lR.innerHTML='';
								var url=location.href;
								url=url.replace('?a=frgp',''); 
								url=url.replace('?a=login','');
								location.href=url;

				}
				else if(_act=='fPw'){
								lR.innerHTML='';
								Did('liBContent').style.display='none';
								alert('密碼已經寄送至您的信箱');
				}
				else if(_act=="closeApp"){
								lR.innerHTML='';
								Did('liBContent').style.display='none';
				}
}

function logRegProcess(_ac) {
				self.scrollTo(0, 0);
				Did('liBContent').style.display='block';
				Did('liBContent').innerHTML="<object classid='clsid:D27CDB6E-AE6D-11cf-96B8-444553540000' codebase='http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0' width='592' height='484' id='memLogReg'><param name='wmode' value='transparent'><param name='movie' value='http://peport.com/jss/memLogReg.swf?ac="+_ac+"'></param><param name='allowScriptAccess' value='always'><embed src='http://peport.com/jss/memLogReg.swf?ac="+_ac+"' wmode='transparent' type='application/x-shockwave-flash' width='592' height='484' allowScriptAccess='always'></embed></object>";
}

function views(_obj){
				if(Did(_obj).style.display=='block')
								Did(_obj).style.display='none';
				else
								Did(_obj).style.display='block';
}
function hide(_obj){
				_obj.style.display='none';
}

function show(_obj,_m){
				_obj.style.display=_m;
}

function ajxObj(){
				if(window.XMLHttpRequest) {
								r = new XMLHttpRequest();
				}else if(window.ActiveXObject) {
								r = new ActiveXObject("Microsoft.XMLHTTP");
				}
				return r;
}

function getVar(name)
{
				get_string = document.location.search;
				return_value = '';
				do { //This loop is made to catch all instances of any get variable.
								name_index = get_string.indexOf(name + '=');

								if(name_index != -1)
								{
												get_string = get_string.substr(name_index + name.length + 1, get_string.length - name_index);

												end_of_value = get_string.indexOf('&');
												if(end_of_value != -1)
																value = get_string.substr(0, end_of_value);
												else
																value = get_string;

												if(return_value == '' || value == '')
																return_value += value;
												else
																return_value += ', ' + value;
								}
				} while(name_index != -1)
				//Restores all the blank spaces.
				space = return_value.indexOf('+');
				while(space != -1)
				{
								return_value = return_value.substr(0, space) + ' ' +
												return_value.substr(space + 1, return_value.length);
								space = return_value.indexOf('+');
				}
				return(return_value);
}

function chkall(input1)
{
				var objForm = document.forms[input1];
				var objLen = objForm.length;
				for (var iCount = 0; iCount < objLen; iCount++)
				{
								if (objForm.elements[iCount].type == "checkbox")
								{
												objForm.elements[iCount].checked = true;
								}
				}
}

function smtForm(f){
				var fm=document.forms[f];
				fm.method='post';
				fm.submit();
}

