var popupCalendar=null;var gypsii_valid_icon_images_type=['JPG','TIF','GIF','PNG','TIF'];if(typeof gps_global_style=='undefined'){gps_global_style='gitter';}
var common_processing_img="<img border=0 width='16' height='16' src='"+gps_global_urlroot+"/skins/"+gps_global_skin_dir+"/images/"+gps_global_style+"/en-us/processing.gif'>";var statusBusy=false;var gajax_HTTPObj=null;var gajax_CurrentOp='';var gajax_CallbackHandler=null;var plugin_ID='';var plugin_FadeTimer=null;var plugin_SleepWait=3000;var plugin_InfoCallback=null;var plugin_Silent=false;function GPSJS_AJAXGetHTTPObject(){var http;/*@cc_on
  @if (@_jscript_version >= 5)
    try {
      http = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
      try {
        http = new ActiveXObject("Microsoft.XMLHTTP");
      } catch (E) {
        http = false;
      }
    }
  @else
  http = false;
  @end @*/
if(!http&&typeof XMLHttpRequest!='undefined'){try{http=new XMLHttpRequest();}catch(e){http=false;}}
return http;}
function GPSJS_AJAXGetState(aState)
{if(aState==0)
{return'Uninitialized';}
else if(aState==1)
{return'Sending Request';}
else if(aState==2)
{return'Server Contacted';}
else if(aState==3)
{return'Receiving Data';}
else if(aState==4)
{return'Complete';}}
function GPSJS_AJAXPostRequest(aHTTP,aSID,aCallback,aURL,aOperation,doAsync,aPostData)
{var pData;if(aHTTP==null){return;}
if(aHTTP.readyState==4||aHTTP.readyState==0){pData='operation='+aOperation+'&sid='+aSID;if(aPostData!='')
{pData=pData+'&'+aPostData;}
aHTTP.open("POST",aURL,doAsync);aHTTP.setRequestHeader('Content-Type','application/x-www-form-urlencoded; charset=utf-8');aHTTP.onreadystatechange=aCallback;aHTTP.send(pData);if(!doAsync)
{$handlerFunction();}}}
function GAJAX_ShowBusyNetwork()
{var bObj=document.getElementById('gypsii_ajax_progress');if(bObj)
{bObj.innerHTML=common_processing_img;}}
function GAJAX_HideBusyNetwork()
{var bObj=document.getElementById('gypsii_ajax_progress');if(bObj)
{bObj.innerHTML='';}}
function GAJAX_ShowUserMessage(aMsg)
{var bObj=document.getElementById('gypsii_ajax_progress');if(bObj)
{bObj.innerHTML=aMsg;}}
function GAJAX_NetworkCallback()
{if(gajax_HTTPObj.readyState==4)
{if(gajax_HTTPObj.status==200)
{GAJAX_WinSetContent(gajax_HTTPObj.responseText);if(typeof(gajax_CallbackHandler)!="undefined")
{gajax_CallbackHandler(gajax_HTTPObj.responseText);gajax_CallbackHandler=null;}}}}
function GAJAX_NetworkRequest(opType,postInfo,callbackHandler,subOpType)
{if(!gajax_HTTPObj){gajax_HTTPObj=GPSJS_AJAXGetHTTPObject();}
if(!gajax_HTTPObj){return;}
var tPostInfo='ajax=1&op='+opType;if(postInfo!='')
{tPostInfo=tPostInfo+'&'+postInfo;}
if((typeof(subOpType)!="undefined")&&(subOpType!=''))
{tPostInfo=tPostInfo+'&subop='+subOpType;}
if(document.getElementById('fb_gui'))
{tPostInfo=tPostInfo+'&fb_gui=1';}
gajax_CurrentOp=opType;gajax_CurrentSubOp=subOpType;gajax_CallbackHandler=callbackHandler;GPSJS_AJAXPostRequest(gajax_HTTPObj,gps_global_sessionid,GAJAX_NetworkCallback,gps_global_urlroot+'/home.cgi',opType,true,tPostInfo);}
function GAJAX_WinHide()
{if(plugin_FadeTimer)
{clearTimeout(plugin_FadeTimer);plugin_FadeTimer=null;}
if(gajax_WinFadeStarted){return;}
gajax_WinFadeStarted=true;GAJAX_WinFadeEx('gypsii_ajax_win');return;}
function GAJAX_WinSetContent(aContent)
{var element=document.getElementById('gypsii_ajax_win');if(element==null){return;}
element.innerHTML=aContent;return;}
function GAJAX_WinSetDimensions(tWidth,tHeight)
{if(typeof(tWidth)=="undefined"){tWidth=500;}
if(typeof(tHeight)=="undefined"){var g_a_h=document.getElementById('gypsii_ajax_win').style.height;if(g_a_h!=''){document.getElementById('gypsii_ajax_win').style.height='';}}
var IE5=NN4=NN6=OPA=false;if(navigator.userAgent.toLowerCase().indexOf("opera")+1){OPA=true;}
else if(document.all){IE5=true;}
else if(document.layers){NN4=true;}
else if(document.getElementById){NN6=true;}
var aObj=document.getElementById('gypsii_ajax_win');var xObj=document.getElementById('main');if(aObj)
{aObj.style.width=tWidth+'px';if((typeof(tHeight)!="undefined")&&(tHeight!=null))
{aObj.style.height=tHeight+'px';}
if(/Konqueror|Safari|KHTML/.test(navigator.userAgent))
{xc=((window.innerWidth/2)-(parseInt(aObj.style.width)/2));}
else if(NN4||NN6)
{xc=Math.round(((window.innerWidth-(window.innerWidth-xObj.clientWidth))/2)-(tWidth/2));yc=Math.round((window.innerHeight/2)-(tHeight/2));if((navigator.userAgent.indexOf("Firefox")!=-1)&&(navigator.userAgent.indexOf("3.5")!=-1))
{xc=Math.round(((window.innerWidth)/2)-(tWidth/2));}}
else
{xc=Math.round(((document.body.clientWidth)/2)-(tWidth/2));yc=Math.round((document.body.clientHeight/2)-(tHeight/2));}
var arrayPageScroll=getPageScroll();yc=arrayPageScroll[1]+40;if(this.NN4)
{aObj.moveTo(xc,yc);}
else{aObj.style.left=xc+"px";aObj.style.top=yc+"px";}
aObj.style.display='block';aObj.style.visibility='visible';}
aObj.style.opacity=2;aObj.style.filter='alpha(opacity=100)';aObj.FadeState=2;return;}
function GAJAX_WinBuildAndShow(aHeader,aContent,saveCaption,saveAction,cancelCaption,cancelAction,formID,aWidth)
{if(typeof(saveAction)=="undefined"){saveAction='';}
if(typeof(cancelAction)=="undefined"){cancelAction='';}
if(typeof(formID)=="undefined"){formID='';}
var rCont='';rCont=rCont+'<div style=\'border: 1px solid #777777;\'>';rCont=rCont+'<div style=\'padding: 3px 3px 3px 6px; background-color: #0092B5; color: white;\'>';rCont=rCont+'<font size=+2>'+aHeader+"</font>";rCont=rCont+'</div>';rCont=rCont+'<div style=\'padding: 3px 6px 3px 6px;\'>';rCont=rCont+aContent;rCont=rCont+'</div>';if((saveAction!='')||(cancelAction!=''))
{rCont=rCont+'<p style=\"margin: 0px 0px 8px 0px;\"></p>';rCont=rCont+'<div align=right style="margin: 0; border-top: 1px solid #CCCCCC; background-color: #F9F9F9; padding: 4px 6px 8px 6px;">';rCont=rCont+"<div align=right>";rCont=rCont+"<div style='padding:0px;display: inline;' id='gypsii_ajax_progress'></div>&nbsp;&nbsp;";if(saveAction!='')
{rCont=rCont+"<input class=wcbutton type='button' onclick='"+saveAction+"' value='"+saveCaption+"'>";rCont=rCont+'&nbsp;&nbsp;&nbsp;';}
if(cancelAction!='')
{rCont=rCont+"<input class=wcbutton type='button' onclick='"+cancelAction+"' value='"+cancelCaption+"'>";}
rCont=rCont+"</div>";rCont=rCont+'</div>';}
if(typeof(aWidth)!="undefined")
{GAJAX_WinShow(aWidth);}
else
{GAJAX_WinShow(550);}
rCont=rCont+'</div>';if(formID!='')
{GAJAX_WinSetContent('<form id="'+formID+'">'+rCont+'</form>');}
else
{GAJAX_WinSetContent(rCont);}}
function GAJAX_WinShow(tWidth,hideBackground,tHeight)
{if(typeof(hideBackground)=="undefined"){hideBackground=0;}
if(plugin_FadeTimer)
{clearTimeout(plugin_FadeTimer);plugin_FadeTimer=null;}
GAJAX_WinHideProblemObjects();if(!hideBackground)
{showBackGround();}
GAJAX_WinSetContent('<b><font size=+2>&nbsp;'+res_ajax_processing+'</font></b>');GAJAX_WinSetDimensions(tWidth,tHeight);return false;}
function GAJAX_WinShowProblemElements()
{var menuObj=document.getElementById('gypsii_add_menu');if(menuObj)
{menuObj.style.visibility='inherit';}
if(document.all)
{selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="visible";}}
var embed=document.getElementsByTagName("embed");for(i=0;i!=embed.length;i++){embed[i].style.visibility="visible";}
var tobject=document.getElementsByTagName("object");for(i=0;i!=tobject.length;i++){tobject[i].style.visibility="visible";}}
function GAJAX_WinHideProblemObjects()
{var menuObj=document.getElementById('gypsii_add_menu');if(menuObj)
{menuObj.style.visibility='hidden';}
if(document.all)
{var selects=document.getElementsByTagName("select");for(i=0;i!=selects.length;i++){selects[i].style.visibility="hidden";}}
var embed=document.getElementsByTagName("embed");for(i=0;i!=embed.length;i++){embed[i].style.visibility="hidden";}
var tobject=document.getElementsByTagName("object");for(i=0;i!=tobject.length;i++){tobject[i].style.visibility="hidden";}}
function doSearch()
{var tVal=document.gypsii_search_header.gps_psterm.value;if(tVal.length<2)
{alert(res_search_min);document.gypsii_search_header.gps_psterm.focus();return false;}
document.gypsii_search_header.submit();}
function doSearchCheck(ev)
{var key=ev.keyCode||ev.which;if(key!=13){return false;}
var tVal=document.gypsii_search_header.gps_psterm.value;var tVal=aForm.value;if(tVal.length==0){return;}
doSearch();}
var gajax_WinFadeStarted=false;var TimeToFade=350.0;function GAJAX_WinAnimateFade(lastTick,eid)
{var curTick=new Date().getTime();var elapsedTicks=curTick-lastTick;var element=document.getElementById(eid);if(element.FadeTimeLeft<=elapsedTicks)
{element.style.opacity=element.FadeState==1?'1':'0';element.style.filter='alpha(opacity = '
+(element.FadeState==1?'100':'0')+')';element.FadeState=element.FadeState==1?2:-2;GAJAX_WinShowProblemElements();element.style.display='none';element.style.visibility='hidden';gajax_WinFadeStarted=false;plugin_FadeTimer=null;var bgObj=document.getElementById('gypsii_ajax_win_bg');if(bgObj)
{bgObj.style.display='none';bgObj.style.visibility='hidden';}
return;}
element.FadeTimeLeft-=elapsedTicks;var newOpVal=element.FadeTimeLeft/TimeToFade;if(element.FadeState==1)
newOpVal=1-newOpVal;element.style.opacity=newOpVal;element.style.filter='alpha(opacity = '+(newOpVal*100)+')';setTimeout("GAJAX_WinAnimateFade("+curTick+",'"+eid+"')",33);}
function GAJAX_WinFadeEx(eid)
{var element=document.getElementById(eid);if(element==null){return;}
if(element.FadeState==null)
{if(element.style.opacity==null||element.style.opacity==''||element.style.opacity=='1')
{element.FadeState=2;}
else
{element.FadeState=-2;}}
if(element.FadeState==1||element.FadeState==-1)
{element.FadeState=element.FadeState==1?-1:1;element.FadeTimeLeft=TimeToFade-element.FadeTimeLeft;}
else
{element.FadeState=element.FadeState==2?-1:1;element.FadeTimeLeft=TimeToFade;setTimeout("GAJAX_WinAnimateFade("+new Date().getTime()+",'"+eid+"')",33);}}
function gpsProcessLoginPage(tact)
{if(typeof tact=="undefined"){tact='';}
var aForm=document.getElementById('gps_gui');if(aForm.wcp_form_login.value=='')
{alert(res_enter_name);return false;}
if(aForm.wcp_form_password.value=='')
{alert(res_enter_pw);return false;}
gpsSaveLoginCookie();gpsSetStatusMessage(res_login_prog);if(tact!='')
{aForm.action=tact;}
aForm.submit();}
function gpsGetLoginCookie(typedVal)
{username=gpsUTFUnescape(getCookie("GU1"));var aForm=document.getElementById('gps_gui');var aCheckbox=document.getElementById('wcp_form_save_username');if(username.length>0){aCheckbox.checked=true;aForm.wcp_form_login.value=username;}else{aCheckbox.checked=false;aForm.wcp_form_login.value=typedVal;}}
function getCookie(c_name)
{if(document.cookie.length>0)
{c_start=document.cookie.indexOf(c_name+"=");if(c_start!=-1)
{c_start=c_start+c_name.length+1;c_end=document.cookie.indexOf(";",c_start);if(c_end==-1)c_end=document.cookie.length;return unescape(document.cookie.substring(c_start,c_end));}}
return"";}
function gpsSaveLoginCookie()
{var aForm=document.getElementById('gps_gui');var aCheckbox=document.getElementById('wcp_form_save_username');if(aCheckbox.checked)
{var exdate=new Date();exdate.setDate(exdate.getDate()+720);document.cookie="GU1="+encodeURI(aForm.wcp_form_login.value)+"; expires="+exdate.toGMTString()+"; path=/";}
else
{if(aForm.wcp_form_login.value==gpsUTFUnescape(getCookie("GU1")))
{var exdate=new Date();exdate.setDate(exdate.getDate()-1);document.cookie="GU1=; expires="+exdate.toGMTString()+"; path=/";}}}
function gpsSetLoginFocus()
{var aForm=document.getElementById('gps_gui');if(aForm)
{if(aForm.wcp_form_login)
{if(aForm.wcp_form_login.value=='')
{aForm.wcp_form_login.focus();}
else
{aForm.wcp_form_password.focus();}}}}
function doActionURL(aURL)
{var hIFRAME=parent.document.getElementById('gypsii_mframe');if(hIFRAME){hIFRAME.src=aURL;}
else{parent.location=aURL;}}
function doAction(tact,op,aID,aSubOp)
{if(typeof tact=="undefined"){tact='home.cgi';}
if(typeof op=="undefined"){op='';}
if(typeof aID=="undefined"){aID='';}
if(typeof aSubOp=="undefined"){aSubOp='';}
window.status='';var aForm=document.getElementById('gps_gui');if(!aForm)
{alert(res_browser_error);doActionURL(parent.location);}
if(tact!='')
{var tSep='';var tQues='?';var basePath=gps_global_urlroot+'/';basePath=basePath+tact;if(op!='')
{basePath=basePath+tQues+tSep+'op='+op;tSep='&';tQues='';}
if(aSubOp!='')
{basePath=basePath+tQues+tSep+'subop='+escape(aSubOp);tSep='&';tQues='';}
if(aID!='')
{basePath=basePath+tQues+tSep+'id='+escape(aID);tSep='&';tQues='';}
doActionURL(basePath);}
else
{aForm.id.value=aID;aForm.op.value=op;aForm.subop.value=aSubOp;var aGID=document.getElementById('gps_id');if(aGID){aGID.value=aID;}
if(tact!='')
{aForm.action=tact;}
document.gps_gui.submit();}}
function gpsUnsetHighlight(aField)
{aField.style.background='white';}
function gpsSetHighlight(aField)
{aField.style.background='#FFFFC0';}
function gpsDisplayInNewWindow(aURL)
{var dispWin=null;dispWin=window.open(aURL);if(!(dispWin))
{alert(rep_popup_error);return;}}
function gpsSetErrorMessage(aMsg)
{var aObj=document.getElementById('gps_top_ad');if(aObj)
{aObj.style.width='400px';aObj.style.height='50px';aObj.innerHTML='<center><b class=font3><br>'+aMsg+'</b></center>';aObj.style.background='#ffebe8';aObj.style.border='dashed';}}
function gpsSetStatusMessage(aMsg)
{var aObj=document.getElementById('gps_top_ad');if(aObj)
{aObj.style.width='400px';aObj.style.height='50px';aObj.innerHTML='<center class=font3><br>'+aMsg+'</center>';aObj.style.background='#fffbe2';aObj.style.border='dashed';}}
function CalSelected(cal,date)
{cal.sel.value=date;if(cal.dateClicked)
{cal.callCloseHandler();}}
function CalCloseHandler(cal)
{cal.hide();popupCalendar=null;}
function CalendarShow(tid,format,showsTime,showsOtherMonths,customHandler)
{var el=document.getElementById(tid);if(popupCalendar!=null)
{popupCalendar.hide();}
else
{var cal=null;if(customHandler!=null)
{cal=new Calendar(1,null,CalSelected,customHandler);}
else
{cal=new Calendar(1,null,CalSelected,CalCloseHandler);}
if(showsTime){cal.showsTime=true;cal.time24=(showsTime=="24");}
if(showsOtherMonths){cal.showsOtherMonths=true;}
popupCalendar=cal;cal.setRange(1900,2070);cal.create();cal.setFirstDayOfWeek(0);}
popupCalendar.setDateFormat(format);popupCalendar.parseDate(el.value);popupCalendar.sel=el;popupCalendar.showAtElement(el,"Br");return false;}
function gpsTruncate(aObj,aLen)
{if(aObj.value.length>aLen)
{aObj.value=aObj.value.substring(0,aLen);}}
function gpsAddEvent(obj,evType,fn)
{if(obj.addEventListener){obj.addEventListener(evType,fn,false);return true;}else if(obj.attachEvent){var r=obj.attachEvent("on"+evType,fn);return r;}else{return false;}}
function gpsInputCheck(aField,aCharSet,aMaxLen)
{var aChar;var rstring="";for(var i=0;i<aField.value.length;i++)
{aChar=aField.value.substring(i,i+1);if(aCharSet.indexOf(aChar.toUpperCase())!="-1")
{rstring=rstring+aChar;}}
aField.value=rstring.substring(0,aMaxLen);}
var gpsUtf8={encode:function(string){string=string.replace(/\r\n/g,"\n");var utftext="";for(var n=0;n<string.length;n++){var c=string.charCodeAt(n);if(c<128){utftext+=String.fromCharCode(c);}
else if((c>127)&&(c<2048)){utftext+=String.fromCharCode((c>>6)|192);utftext+=String.fromCharCode((c&63)|128);}
else{utftext+=String.fromCharCode((c>>12)|224);utftext+=String.fromCharCode(((c>>6)&63)|128);utftext+=String.fromCharCode((c&63)|128);}}
return utftext;},decode:function(utftext){var string="";var i=0;var c=c1=c2=0;while(i<utftext.length){c=utftext.charCodeAt(i);if(c<128){string+=String.fromCharCode(c);i++;}
else if((c>191)&&(c<224)){c2=utftext.charCodeAt(i+1);string+=String.fromCharCode(((c&31)<<6)|(c2&63));i+=2;}
else{c2=utftext.charCodeAt(i+1);c3=utftext.charCodeAt(i+2);String+=String.fromCharCode(((c&15)<<12)|((c2&63)<<6)|(c3&63));i+=3;}}
return string;}};function gpsUTFUnescape(aString)
{return gpsUtf8.decode(unescape(aString));}
function gpsUTFEscape(aString)
{return escape(gpsUtf8.encode(aString));}
function doCondAction(aURL,aMsg)
{var rc=confirm(aMsg);if(rc!=1){return false;}
parent.location=aURL;return false;}
function driveGUI(mapOP,mapID)
{var guiIFRAME=parent.document.getElementById('gypsii_uiframe');if(guiIFRAME)
{var oDoc=guiIFRAME.contentWindow||guiIFRAME.contentDocument;if(oDoc)
{if(typeof oDoc.iGUIDriver!="undefined")
{oDoc.iGUIDriver(mapOP,mapID);}}}}
function showAllImages()
{var aObj=document.getElementById('gypsii_hidden_images');if(aObj)
{if(aObj.style.display=="none")
{aObj.style.visibility="visible";aObj.style.display="block";}}
var bObj=document.getElementById('moreimages');if(bObj)
{bObj.style.visibility="invisible";bObj.style.display="none";}}
function showAllVideo()
{var aObj=document.getElementById('gypsii_hidden_videos');if(aObj)
{if(aObj.style.display=="none")
{aObj.style.visibility="visible";aObj.style.display="block";}}
var bObj=document.getElementById('morevids');if(bObj)
{bObj.style.visibility="invisible";bObj.style.display="none";}}
function showAllAudio()
{var aObj=document.getElementById('gypsii_hidden_audio');if(aObj)
{if(aObj.style.display=="none")
{aObj.style.visibility="visible";aObj.style.display="block";}}
var bObj=document.getElementById('moreaud');if(bObj)
{bObj.style.visibility="invisible";bObj.style.display="none";}}
function isEmail(str)
{var at="@";var dot=".";var lat=str.indexOf(at);var lstr=str.length;var ldot=str.indexOf(dot);if(str.indexOf(at)==-1)
{return false;}
if(str.indexOf(at)==-1||str.indexOf(at)==0||str.indexOf(at)==lstr){return false;}
if(str.indexOf(dot)==-1||str.indexOf(dot)==0||str.indexOf(dot)==lstr){return false;}
if(str.indexOf(at,(lat+1))!=-1){return false;}
if(str.substring(lat-1,lat)==dot||str.substring(lat+1,lat+2)==dot){return false;}
if(str.indexOf(dot,(lat+2))==-1){return false;}
if(str.indexOf(" ")!=-1){return false;}
var filter=/^([A-Za-z0-9!#$%&'*+/=?^_`{|}~-])+(?:\.[A-Za-z0-9!#$%&'*+/=?^_`{|}~-]+)*@(?:[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?\.)+[A-Za-z0-9](?:[A-Za-z0-9-]*[A-Za-z0-9])?/;

   if (!filter.test(str))
   {
     return false;
   }
   else
   {
    return true;
   }

}

function gypsii_common_status_message(div_id,msg,success)
{
  if(success){ document.getElementById(div_id).innerHTML="<font style='arial' color='#555555'>"+common_processing_img+" <b>"+msg+"</b></font>"; }
  else{ document.getElementById(div_id).innerHTML="<font style='arial' color='#4d4c4c'>"+common_processing_img+" <b>"+msg+"</b></font>";  }
}

/////////////////////////////////////////
// For New Menus
/////////////////////////////////////////
function SDMenu(id) {
	if (!document.getElementById || !document.getElementsByTagName)
		return false;
	this.menu = document.getElementById(id);
	if (!this.menu) { return false; }
	this.submenus = this.menu.getElementsByTagName("div");
	this.remember = true;
	this.speed = 5;
	this.markCurrent = true;
	this.oneSmOnly = false;
}
SDMenu.prototype.init = function() {
	var mainInstance = this;
	if (!this.submenus) { return false; }
	for (var i = 0; i < this.submenus.length; i++)
		this.submenus[i].getElementsByTagName("span")[0].onclick = function() {
			mainInstance.toggleMenu(this.parentNode);
		};
	if (this.markCurrent) {
		var links = this.menu.getElementsByTagName("a");
		for (var i = 0; i < links.length; i++)
			if (links[i].href == document.location.href) {
				links[i].className = "current";
				break;
			}
	}
	if (this.remember) {
		var regex = new RegExp("sdmenu_" + encodeURIComponent(this.menu.id) + "=([01]+)");
		var match = regex.exec(document.cookie);
		if (match) {
			var states = match[1].split("");
			for (var i = 0; i < states.length; i++)
				this.submenus[i].className = (states[i] == 0 ? "collapsed" : "");
		}
		else
	  {
	    //rhp: to start all closed: this.collapseAll();
	  }
	}
};
SDMenu.prototype.toggleMenu = function(submenu) {
	if (submenu.className == "collapsed")
		this.expandMenu(submenu);
	else
		this.collapseMenu(submenu);
};
SDMenu.prototype.expandMenu = function(submenu) {
	var fullHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var links = submenu.getElementsByTagName("a");
	for (var i = 0; i < links.length; i++)
		fullHeight += links[i].offsetHeight;
	var moveBy = Math.round(this.speed * links.length);

	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight + moveBy;
		if (newHeight < fullHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "";
			mainInstance.memorize();
		}
	}, 30);
	this.collapseOthers(submenu);
};
SDMenu.prototype.collapseMenu = function(submenu) {
  if (submenu.getAttribute("state") == 'keepopen') { return; }
	var minHeight = submenu.getElementsByTagName("span")[0].offsetHeight;
	var moveBy = Math.round(this.speed * submenu.getElementsByTagName("a").length);
	var mainInstance = this;
	var intId = setInterval(function() {
		var curHeight = submenu.offsetHeight;
		var newHeight = curHeight - moveBy;
		if (newHeight > minHeight)
			submenu.style.height = newHeight + "px";
		else {
			clearInterval(intId);
			submenu.style.height = "";
			submenu.className = "collapsed";
			mainInstance.memorize();
		}
	}, 30);
};
SDMenu.prototype.collapseOthers = function(submenu) {
	if (this.oneSmOnly) {
		for (var i = 0; i < this.submenus.length; i++)
			if (this.submenus[i] != submenu && this.submenus[i].className != "collapsed")
				this.collapseMenu(this.submenus[i]);
	}
};
SDMenu.prototype.expandAll = function() {
	var oldOneSmOnly = this.oneSmOnly;
	this.oneSmOnly = false;
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className == "collapsed")
			this.expandMenu(this.submenus[i]);
	this.oneSmOnly = oldOneSmOnly;
};
SDMenu.prototype.collapseAll = function() {
	for (var i = 0; i < this.submenus.length; i++)
		if (this.submenus[i].className != "collapsed")
			this.collapseMenu(this.submenus[i]);
};
SDMenu.prototype.memorize = function() {
	if (this.remember) {
		var states = new Array();
		for (var i = 0; i < this.submenus.length; i++)
			states.push(this.submenus[i].className == "collapsed" ? 0 : 1);
		var d = new Date();
		d.setTime(d.getTime() + (30 * 24 * 60 * 60 * 1000));
		document.cookie = "sdmenu_" + encodeURIComponent(this.menu.id) + "=" + states.join("") + "; expires=" + d.toGMTString() + "; path=/";
	}
};

function checkForEnter(aEvent, aFunction, arg1, arg2, arg3)
{
  // aEvent is event object passed from function invocation
  // literal character code will be stored in this variable
  var characterCode;
  if (aEvent && aEvent.which)
  {
    // if which property of event object is supported (NN4)
    aEvent = aEvent;
    //character code is contained in NN4's which property
characterCode=aEvent.which;}
else
{if(typeof event!='undefined')
{aEvent=event;}
characterCode=aEvent.keyCode;}
if(characterCode==13)
{if(typeof aFunction!='undefined')
{aFunction(arg1,arg2,arg3);}
return false;}
else if(characterCode==27)
{GAJAX_WinHide();return true;}
else
{return true;}}
var currentCommentObjID=-1;var currentCommentType='';var commentHTTPObj=null;var pageHTTPObj=null;var currentPageNum=-1;var statusHTTPObj=null;var statusDefQuestion='';function setStatus(aStatus,userName,statQuestion)
{var ptn=/^\s+$/;if((aStatus=='')||(aStatus==statQuestion)||(ptn.test(aStatus)))
{return;}
if(!statusHTTPObj)
{statusHTTPObj=GPSJS_AJAXGetHTTPObject();}
statusBusy=true;document.getElementById('gps_status_button').style.visibility='hidden';var infoURL=gps_global_urlroot+'/home.cgi';var postInfo='ajax=1&op=setstatus'+'&status='+gpsUTFEscape(aStatus);gypsii_common_status_message('gps_setstatus_processing',res_rat_processing,false);GPSJS_AJAXPostRequest(statusHTTPObj,gps_global_sessionid,setStatus_handleAjaxResponse,infoURL,'',true,postInfo);}
function delStatus(statID)
{if(!statusHTTPObj)
{statusHTTPObj=GPSJS_AJAXGetHTTPObject();}
var y=confirm(res_stat_del_ques);aObj=document.getElementById('stat_proc'+statID);if(aObj)
{if(aObj.style.display=="none")
{aObj.style.visibility="visible";aObj.style.display="block";}}
if(y==1){statusBusy=true;var infoURL=gps_global_urlroot+'/home.cgi';var postInfo='ajax=1&op=delstatus'+'&statusid='+statID;GPSJS_AJAXPostRequest(statusHTTPObj,gps_global_sessionid,setStatus_handleAjaxResponse,infoURL,'',true,postInfo);}
}
function clearStatus()
{var aStatus=" ";if(!statusHTTPObj)
{statusHTTPObj=GPSJS_AJAXGetHTTPObject();}
statusBusy=true;var infoURL=gps_global_urlroot+'/home.cgi';var postInfo='ajax=1&op=setstatus'+'&status='+gpsUTFEscape(aStatus);gypsii_common_status_message('gps_setstatus_processing',res_rat_processing,false);GPSJS_AJAXPostRequest(statusHTTPObj,gps_global_sessionid,setStatus_handleAjaxResponse,infoURL,'',true,postInfo);}
function setStatus_handleAjaxResponse()
{if(statusHTTPObj.readyState==4)
{if(statusHTTPObj.status==200)
{document.getElementById('gps_setstatus_processing').innerHTML="";document.getElementById('gps_status').value=statusDefQuestion;document.getElementById('gps_status').style.color='#777777';document.getElementById('gps_status').blur();document.getElementById('gps_current_status').innerHTML=statusHTTPObj.responseText;statusBusy=false;}}}
function addComment(opType,objID,aComment,parentID,commID,isCommPost)
{if(aComment==''||aComment==res_comm_post_msg||aComment==res_comm_post_msg2)
{return;}
if(!commentHTTPObj)
{commentHTTPObj=GPSJS_AJAXGetHTTPObject();}
currentCommentObjID=objID;currentCommentType=opType;document.getElementById('gps_button_'+opType+'_'+objID).style.visibility='hidden';var infoURL=gps_global_urlroot+'/home.cgi';var postInfo='ajax=1&return_html=1&op='+opType+'&id='+objID+'&gps_comment='+gpsUTFEscape(aComment);if(parentID!='')
{postInfo=postInfo+'&parent='+parentID;}
if(commID!='')
{postInfo=postInfo+'&commid='+commID;}
var tObj=document.getElementById('gps_cres_'+currentCommentType+'_'+currentCommentObjID);if(tObj.innerHTML=='')
{postInfo=postInfo+'&hide_arrow=0';}
else{postInfo=postInfo+'&hide_arrow=1';}
gypsii_common_status_message('gps_com_proc_'+opType+'_'+objID,res_rat_processing,false);if(isCommPost=='true'){GPSJS_AJAXPostRequest(commentHTTPObj,gps_global_sessionid,addComment_commPost_handleAjaxResponse,infoURL,'',true,postInfo);}
else{GPSJS_AJAXPostRequest(commentHTTPObj,gps_global_sessionid,addComment_handleAjaxResponse,infoURL,'',true,postInfo);}}
function toggleBlockGypsii(blockID,buttonID,textID)
{var aObj=document.getElementById(blockID);if(aObj)
{if(aObj.style.display=="none")
{if(currentCommentObjID>0){return;}
aObj.style.visibility="visible";aObj.style.display="block";var tObj=document.getElementById(textID);if(tObj)
{tObj.focus();}}
else
{aObj.style.display="none";}}}
function nextPage(pageNum,lastId,blockID,buttonID,textID,userset,feeds)
{currentPageNum=pageNum;var aObj=document.getElementById(blockID);if(aObj)
{if(aObj.style.display=="none")
{aObj.style.visibility="visible";aObj.style.display="block";}}
document.getElementById(buttonID).style.visibility='hidden';aObj=document.getElementById('PROC'+pageNum);if(aObj)
{if(aObj.style.display=="none")
{aObj.style.visibility="visible";aObj.style.display="block";}}
gypsii_common_status_message('PROC'+pageNum,res_rat_processing,false);var infoURL=gps_global_urlroot+'/home.cgi';var postInfo='ajax=1&return_html=1&op=nextpage&lastid='+lastId+'&page='+currentPageNum+'&uid='+userset+'&feeds='+feeds;pageHTTPObj=GPSJS_AJAXGetHTTPObject();GPSJS_AJAXPostRequest(pageHTTPObj,gps_global_sessionid,nextPage_handleAjaxResponse,infoURL,'',true,postInfo);}
function hideBoxIfEmpty(aObj,blockID)
{if(aObj.value!=''){return;}
var aObj=document.getElementById(blockID);if(aObj)
{aObj.style.visibility="hidden";aObj.style.display="none";}}
function setupComment(aTextObj,aButID,resetString)
{if(aTextObj.value==resetString)
{aTextObj.value='';}
aTextObj.style.color='#4d4c4c';aTextObj.style.height='30px';aTextObj.style.background='#FFFFC0';var aButObj=document.getElementById(aButID);if(aButObj)
{aButObj.style.visibility="visible";aButObj.style.display="block";}}
function setupCommComment(aTextObj,aButID,resetString)
{if(aTextObj.value==resetString)
{aTextObj.value='';}
aTextObj.style.color='#4d4c4c';aTextObj.style.height='50px';aTextObj.style.background='#FFFFC0';var aButObj=document.getElementById(aButID);if(aButObj)
{aButObj.style.visibility="visible";aButObj.style.display="block";}}
function resetCommentIfEmpty(aTextObj,aButID,resetString)
{if(aTextObj.value!='')
{return;}
aTextObj.style.color='#777777';aTextObj.style.height='20px';aTextObj.style.background='white';if(aTextObj.value=='')
{aTextObj.value=resetString;}
var aButObj=document.getElementById(aButID);if(aButObj)
{aButObj.style.visibility="hidden";aButObj.style.display="none";}}
function resetCommentIfEmptyComm(aTextObj,aButID,resetString)
{if(aTextObj.value!='')
{return;}
aTextObj.style.color='#777777';aTextObj.style.height='50px';aTextObj.style.background='white';if(aTextObj.value=='')
{aTextObj.value=resetString;}
var aButObj=document.getElementById(aButID);if(aButObj)
{}}
function addComment_commPost_handleAjaxResponse(){if(commentHTTPObj.readyState==4)
{if(commentHTTPObj.status==200)
{document.getElementById('gps_com_proc_'+currentCommentType+'_'+currentCommentObjID).innerHTML="";document.getElementById('gps_button_'+currentCommentType+'_'+currentCommentObjID).style.visibility='visible';var tObj=document.getElementById('gps_cres_addcommunitycomment_post');var tDiv='';if(tObj.innerHTML=='')
{tObj.innerHTML=tDiv+commentHTTPObj.responseText;}
else
{tObj.innerHTML=tDiv+commentHTTPObj.responseText+tObj.innerHTML;}
document.getElementById('gps_cres_'+currentCommentType+'_'+currentCommentObjID).style.display="block";document.getElementById('gps_cres_'+currentCommentType+'_'+currentCommentObjID).style.visibility="visible";document.getElementById('gps_comment_'+currentCommentType+'_'+currentCommentObjID).value='';document.getElementById('gps_comment_'+currentCommentType+'_'+currentCommentObjID).blur();currentCommentObjID=-1;currentCommentType='';}}}
function nextPage_handleAjaxResponse()
{if(pageHTTPObj.readyState==4)
{if(pageHTTPObj.status==200)
{var tObj=document.getElementById('PAGEFEED'+currentPageNum);if(tObj.innerHTML=='')
{tObj.innerHTML=pageHTTPObj.responseText;}
else
{var tDiv=' ';tObj.innerHTML=tObj.innerHTML+tDiv+pageHTTPObj.responseText;}
var tObj2=document.getElementById('PROC'+currentPageNum);tObj2.style.display='none';}}}
function addComment_handleAjaxResponse()
{if(commentHTTPObj.readyState==4)
{if(commentHTTPObj.status==200)
{document.getElementById('gps_com_proc_'+currentCommentType+'_'+currentCommentObjID).innerHTML="";document.getElementById('gps_button_'+currentCommentType+'_'+currentCommentObjID).style.visibility='visible';var tObj=document.getElementById('gps_cres_'+currentCommentType+'_'+currentCommentObjID);if(tObj.innerHTML=='')
{tObj.innerHTML=commentHTTPObj.responseText;}
else
{var tDiv='';tObj.innerHTML=tObj.innerHTML+tDiv+commentHTTPObj.responseText;}
document.getElementById('gps_cres_'+currentCommentType+'_'+currentCommentObjID).style.display="block";document.getElementById('gps_cres_'+currentCommentType+'_'+currentCommentObjID).style.visibility="visible";document.getElementById('gps_comment_'+currentCommentType+'_'+currentCommentObjID).value='';document.getElementById('gps_comment_'+currentCommentType+'_'+currentCommentObjID).blur();currentCommentObjID=-1;currentCommentType='';}}}
function statusFocus(aField,userName,statQuestion)
{statusDefQuestion=statQuestion;aField.style.color='#4d4c4c';document.getElementById('gps_status_button').style.visibility='visible';if(aField.value==statQuestion)
{aField.value='';}}
function statusUnfocus(aField,userName,statQuestion)
{if(statusBusy)
{return;}
statusDefQuestion=statQuestion;aField.style.color='#777777';if(aField.value=='')
{aField.value=statQuestion;document.getElementById('gps_status_button').style.visibility='hidden';}}
function processFriendSuggestion(action,userid,friendid)
{var element=document.getElementById('suggest_invbtn_'+friendid);if(element)
{if(action=='accept')
{var rc=confirm(res_add_to_friends);if(rc!=1)
{return false;}
element.innerHTML=common_processing_img;}}
element=document.getElementById('suggest_rembtn_'+friendid);if(element)
{if(action=='reject')
{element.innerHTML=common_processing_img;}}
if(!commentHTTPObj)
{commentHTTPObj=GPSJS_AJAXGetHTTPObject();}
var infoURL=gps_global_urlroot+'/home.cgi';var postInfo='ajax=1&op=processsuggestion&action='+action+'&uid='+userid+'&fid='+friendid;GPSJS_AJAXPostRequest(commentHTTPObj,gps_global_sessionid,friendSuggest_handleAjaxResponse,infoURL,'',true,postInfo);}
function friendSuggest_handleAjaxResponse()
{if(commentHTTPObj.readyState==4)
{if(commentHTTPObj.status==200)
{var responseCodeStr=commentHTTPObj.responseText;var codes=responseCodeStr.split(";");if(codes[0]=='1')
{var element=document.getElementById('suggest_invbtn_'+codes[1]);if(element)
{element.style.display="none";element.style.visibility="hidden";}
element=document.getElementById('suggest_rembtn_'+codes[1]);if(element)
{element.style.display="none";element.style.visibility="hidden";}}
else
{}}
else
{}}
else
{}}
function blendBorderColor(div_id)
{var divContent=document.getElementById(div_id);if(divContent)
{divContent.style.border="3px solid #CCCCCC";var gypsii_shift_div_color3="document.getElementById('"+div_id+"').style.border='2px solid #CCCCCC'";setTimeout(gypsii_shift_div_color3,500);var gypsii_shift_div_color="document.getElementById('"+div_id+"').style.border='1px solid #CCCCCC'";setTimeout(gypsii_shift_div_color,600);var gypsii_shift_div_color4="document.getElementById('"+div_id+"').style.border='1px dashed #CCCCCC'";setTimeout(gypsii_shift_div_color4,750);var gypsii_shift_div_color1="document.getElementById('"+div_id+"').style.border='0px dashed #CCCCCC'";setTimeout(gypsii_shift_div_color1,900);}}
function translateDivContent(div_id,gps_host_lang,gps_user_lang)
{var k=document.getElementById('a_'+div_id).cache;if(typeof(k)=='undefined'){document.getElementById('a_'+div_id).history=document.getElementById(div_id+'').innerHTML;}
else{if(document.getElementById('a_'+div_id).history==document.getElementById(div_id+'').innerHTML){document.getElementById(div_id+'').innerHTML=document.getElementById('a_'+div_id).cache;}
else{document.getElementById(div_id+'').innerHTML=document.getElementById('a_'+div_id).history;}
return;}
var host_lang=gps_host_lang;host_lang=getLanguageName(host_lang);var dest_lang=getLanguageName(gps_user_lang);var trans_text=document.getElementById(div_id).innerHTML;google.language.translate(trans_text,host_lang,dest_lang,function(result)
{if(!result.error)
{var container=document.getElementById(div_id);if(container)
{if(result!="")
{container.innerHTML=removeBrTags(result.translation).replace(/&#39;/g,'\'');document.getElementById('a_'+div_id).cache=container.innerHTML;blendBorderColor(div_id);}
else
{}}}
else
{}});}
function getLanguageName(gps_user_lang)
{switch(gps_user_lang)
{case'en-us':gps_user_lang='en';break;case'en-gb':gps_user_lang='en';break;case'es':break;case'fr':break;case'de':break;case'ru':break;case'it':break;case'ko':break;case'zh-chs':gps_user_lang='zh';break;case'zh-cht':gps_user_lang='zh';break;default:}
return gps_user_lang;}
function removeBrTags(inStr)
{var t=inStr.split('<br>');if(t.length==1)
{t=inStr.split('<BR>');}
var pc='';if(t.length>1)
{for(var k=0;k<t.length;k++)
{pc+=t[k]+' ';}
return pc;}
else
{return inStr;}}
function getPageSize(){var xScroll,yScroll;if(window.innerHeight&&window.scrollMaxY){xScroll=window.innerWidth+window.scrollMaxX;yScroll=window.innerHeight+window.scrollMaxY;}else if(document.body.scrollHeight>document.body.offsetHeight){xScroll=document.body.scrollWidth;yScroll=document.body.scrollHeight;}else{xScroll=document.body.offsetWidth;yScroll=document.body.offsetHeight;}
var windowWidth,windowHeight;if(self.innerHeight){if(document.documentElement.clientWidth){windowWidth=document.documentElement.clientWidth;}else{windowWidth=self.innerWidth;}
windowHeight=self.innerHeight;}else if(document.documentElement&&document.documentElement.clientHeight){windowWidth=document.documentElement.clientWidth;windowHeight=document.documentElement.clientHeight;}else if(document.body){windowWidth=document.body.clientWidth;windowHeight=document.body.clientHeight;}
if(yScroll<windowHeight){pageHeight=windowHeight;}else{pageHeight=yScroll;}
if(xScroll<windowWidth){pageWidth=xScroll;}else{pageWidth=windowWidth;}
arrayPageSize=new Array(pageWidth,pageHeight,windowWidth,windowHeight)
return arrayPageSize;}
function getPageScroll(){var xScroll,yScroll;if(self.pageYOffset){yScroll=self.pageYOffset;xScroll=self.pageXOffset;}else if(document.documentElement&&document.documentElement.scrollTop){yScroll=document.documentElement.scrollTop;xScroll=document.documentElement.scrollLeft;}else if(document.body){yScroll=document.body.scrollTop;xScroll=document.body.scrollLeft;}
arrayPageScroll=new Array(xScroll,yScroll)
return arrayPageScroll;}
function gpstoggle(id1,id2)
{if(document.getElementById(id1+'').style.display=='none')
{document.getElementById(id1+'').style.display='inline';document.getElementById(id2+'').style.display='none';}
else
{document.getElementById(id1+'').style.display='none';document.getElementById(id2+'').style.display='inline';}}
var friendAddButton=null;var friendIgnoreButton=null;var friendSuggestOthers=false;function friendCallbackHandler(aResponse)
{if(gajax_CurrentOp=='add_friend_a'||gajax_CurrentOp=='ignore_friend'||gajax_CurrentOp=='add_friend_r')
{if(friendAddButton)
{friendAddButton.disabled=true;friendAddButton.style.display='none';}
friendAddButton=null;if(friendIgnoreButton)
{friendIgnoreButton.disabled=true;friendIgnoreButton.style.display='none';}
friendIgnoreButton=null;if(!friendSuggestOthers)
{plugin_FadeTimer=setTimeout("GAJAX_WinHide()",2000);friendSuggestOthers=false;}}}
function friendAddRequest(aID,butObjadd)
{GAJAX_WinShow(500);friendAddButton=butObjadd;friendIgnoreButton=document.getElementById('gps_action_ignore_'+aID);var postInfo='gps_friend_id='+aID;GAJAX_NetworkRequest('add_friend_q',postInfo,friendCallbackHandler);}
function friendAddAction(aID,aSuggestOthers)
{friendSuggestOthers=false;if(typeof(friendSuggestOthers)!="undefined")
{friendSuggestOthers=aSuggestOthers;}
var postInfo='gps_friend_id='+aID;var aNoteObj=document.getElementById('gps_friend_note');if(aNoteObj)
{postInfo+='&gps_note='+gpsUTFEscape(aNoteObj.value);}
GAJAX_ShowBusyNetwork();if(friendSuggestOthers)
{GAJAX_NetworkRequest('add_friend_r',postInfo,friendCallbackHandler);}
else
{GAJAX_NetworkRequest('add_friend_a',postInfo,friendCallbackHandler);}}
function friendIgnoreSuggestion(aID,butObjignore)
{var friendBlock=document.getElementById('gps_friend_info_'+aID);if(friendBlock)
{GAJAX_WinFadeEx('gps_friend_info_'+aID);GAJAX_WinFadeEx('gps_friend_sep_'+aID);}
else
{friendIgnoreButton=butObjignore;friendAddButton=document.getElementById('gps_action_add_'+aID);if(friendAddButton)
{friendAddButton.disabled=true;friendAddButton.style.display='none';}
if(friendIgnoreButton)
{friendIgnoreButton.disabled=true;friendIgnoreButton.style.display='none';}}
friendAddButton=null;friendIgnoreButton=null;var postInfo='gps_friend_id='+aID;GAJAX_NetworkRequest('ignore_friend',postInfo,friendCallbackHandler);}
function feedbackCallbackHandler(aResponse)
{if(gajax_CurrentOp=='feedback_a')
{plugin_FadeTimer=setTimeout("GAJAX_WinHide()",4000);}}
function feedbackRequest()
{GAJAX_WinShow(500);var postInfo='';GAJAX_NetworkRequest('feedback_q',postInfo,feedbackCallbackHandler);}
function feedbackAction()
{var postInfo='';var aFeedObj=document.getElementById('gps_feedback');if(aFeedObj.value=='')
{GAJAX_ShowUserMessage('<font color=red>'+res_feedback_req+'</font>');aFeedObj.focus();return;}
postInfo+='&gps_feedback='+gpsUTFEscape(aFeedObj.value);GAJAX_ShowBusyNetwork();GAJAX_NetworkRequest('feedback_a',postInfo,feedbackCallbackHandler);}
function messageCallbackHandler(aResponse)
{if(gajax_CurrentOp=='message_a')
{plugin_FadeTimer=setTimeout("GAJAX_WinHide()",2000);}}
function messageRequest(aToID,aSub,aBod,aPlaceID,aAttachID,aFriendID)
{GAJAX_WinShow(550);var postInfo='';postInfo+='gps_id='+aToID;if(typeof(aSub)!="undefined")
{postInfo+='&gps_subject='+gpsUTFEscape(aSub);}
if(typeof(aBod)!="undefined")
{postInfo+='&gps_message='+gpsUTFEscape(aBod);}
if(typeof(aPlaceID)!="undefined")
{postInfo+='&gps_poi_id='+aPlaceID;}
if(typeof(aAttachID)!="undefined")
{postInfo+='&gps_attach_id='+aAttachID;}
if(typeof(aFriendID)!="undefined")
{postInfo+='&gps_friend_id='+aFriendID;}
GAJAX_NetworkRequest('message_q',postInfo,messageCallbackHandler);}
function messageAction()
{var postInfo='';var aToID=document.getElementById('gps_id');if(aToID.value=='-999;')
{GAJAX_ShowUserMessage('<font color=red>'+res_ajax_to+'</font>');aToID.focus();return;}
var aSub=document.getElementById('gps_subject');if(aSub.value=='')
{GAJAX_ShowUserMessage('<font color=red>'+res_ajax_sub+'</font>');aSub.focus();return;}
var aBod=document.getElementById('gps_message');if(aBod.value=='')
{GAJAX_ShowUserMessage('<font color=red>'+res_ajax_msg+'</font>');aBod.focus();return;}
var aPlaceID=document.getElementById('gps_poi_id');var aAttachID=document.getElementById('gps_attach_id');var aFriendID=document.getElementById('gps_friend_id');postInfo+='gps_id='+aToID.value;postInfo+='&gps_subject='+gpsUTFEscape(aSub.value);postInfo+='&gps_message='+gpsUTFEscape(aBod.value);postInfo+='&gps_poi_id='+aPlaceID.value;postInfo+='&gps_attach_id='+aAttachID.value;postInfo+='&gps_friend_id='+aFriendID.value;GAJAX_ShowBusyNetwork();GAJAX_NetworkRequest('message_a',postInfo,messageCallbackHandler);}
function fullNameAction()
{var postInfo='';var tDispName=document.getElementById('gps_display_name').value;tDispName=tDispName.replace(/^\s*/,'').replace(/\s*$/,'');if((tDispName.length<3)||(tDispName.indexOf(' ')<0))
{if(!isChinaSite()){GAJAX_ShowUserMessage('<font color=red>'+res_fullname_req+'</font>');document.getElementById('gps_display_name').focus();return false;}}
postInfo+='gps_display_name='+tDispName;GAJAX_ShowBusyNetwork();GAJAX_NetworkRequest('fullname_a',postInfo,noticeCallbackHandler);}
function pluginGatherFormVars(formObj,aType)
{var inputs=formObj.getElementsByTagName(aType);var returnVars='';for(i=0;i<inputs.length;i++)
{var aKey=inputs[i].id;if(aKey.search(/^plugin_/)>=0)
{if(inputs[i].type=='radio')
{if(inputs[i].checked)
{returnVars+=inputs[i].id+'='+gpsUTFEscape(inputs[i].value)+'&';}}
else if(inputs[i].type=='checkbox')
{if(inputs[i].checked)
{returnVars+=inputs[i].id+'='+gpsUTFEscape(inputs[i].value)+'&';}}
else
{returnVars+=inputs[i].id+'='+gpsUTFEscape(inputs[i].value)+'&';}}}
return returnVars;}
function pluginGetFormPostVars()
{var postVars='';var aObj=document.getElementById('plugin_form');postVars+=pluginGatherFormVars(aObj,'input');postVars+=pluginGatherFormVars(aObj,'select');postVars+=pluginGatherFormVars(aObj,'textarea');return postVars;}
function pluginValidateFormVars(formObj,aType)
{var inputs=formObj.getElementsByTagName(aType);for(i=0;i<inputs.length;i++)
{var aKey=inputs[i].id;if(aKey.search(/^plugin_r_/)>=0)
{if(inputs[i].type=='select-one')
{if(inputs[i].value=='-999;'){inputs[i].focus();return false;}}
else
{if(inputs[i].value==''){inputs[i].focus();return false;}}}}
return true;}
function pluginDefaultValidation()
{var aObj=document.getElementById('plugin_form');if(!pluginValidateFormVars(aObj,'input')){return false;}
if(!pluginValidateFormVars(aObj,'select')){return false;}
if(!pluginValidateFormVars(aObj,'textarea')){return false;}
return true;}
function pluginFriendSelect(aID)
{var aObj=document.getElementById('plugin_uid_'+aID);if(aObj.checked)
{aObj.checked=false;}
else
{aObj.checked=true;}}
function pluginFriendHighlight(aID)
{var aObj=document.getElementById('friend_pic_'+aID);if(aObj)
{aObj.style.width='46px';aObj.style.height='46px';aObj.style.border='2px dotted #CCCCCC';}
return true;}
function pluginFriendUnhighlight(aID)
{var aObj=document.getElementById('friend_pic_'+aID);if(aObj)
{aObj.style.width='48px';aObj.style.height='48px';aObj.style.border='1px solid #CCCCCC';}
return true;}
function pluginFriendSetAllCheckboxes(aTrueFalse)
{var aObj=document.getElementById('plugin_form');if(!aObj){return;}
if(typeof(aObj.plugin_uid.length)=="undefined")
{aObj.plugin_uid.checked=aTrueFalse;}
else
{for(i=0;i<aObj.plugin_uid.length;i++)
{aObj.plugin_uid[i].checked=aTrueFalse;}}}
function pluginFriendValidation()
{var aObj=document.getElementById('plugin_form');if(!aObj){return;}
var rVal='';if(typeof(aObj.plugin_uid.length)=="undefined")
{if(aObj.plugin_uid.checked)
{rVal+=aObj.plugin_uid.value+';';}}
else
{for(i=0;i<aObj.plugin_uid.length;i++)
{if(aObj.plugin_uid[i].checked)
{rVal+=aObj.plugin_uid[i].value+';';}}}
if(rVal=='')
{GAJAX_ShowUserMessage('<font color=red>'+res_friend_one+'</font>');return false;}
else
{return true;}}
function pluginCallbackHandler(aResponse)
{if((plugin_OP=='a')||(plugin_OP=='r')||(plugin_OP=='d'))
{if(plugin_Silent)
{return;}
else
{plugin_FadeTimer=setTimeout("GAJAX_WinHide()",plugin_SleepWait);}}
else if(plugin_OP=='i')
{if(typeof(plugin_InfoCallback)!="undefined")
{if(plugin_InfoCallback(aResponse)==false)
{return;}}}}
function pluginAction(plugID,pluginOp,aSleepWait,aValidationCallback)
{plugin_ID=plugID;var postInfo='';plugin_Silent=false;if(typeof(aSleepWait)!="undefined")
{if(aSleepWait==0)
{plugin_Silent=true;}
else
{plugin_SleepWait=aSleepWait;}}
else
{plugin_SleepWait=3000;}
if((typeof(aValidationCallback)!="undefined")&&(aValidationCallback))
{if(aValidationCallback()==false)
{return;}}
else
{if(pluginDefaultValidation()==false)
{GAJAX_ShowUserMessage('<font color=red>'+res_plugin_def_input+'</font>');return;}
else
{var aObj=document.getElementById('plugin_form');if((typeof(aObj.plugin_r_password1)!="undefined")&&(typeof(aObj.plugin_r_password2)!="undefined"))
{if(aObj.plugin_r_password1.value!=aObj.plugin_r_password2.value)
{aObj.plugin_r_password1.focus();GAJAX_ShowUserMessage('<font color=red>'+res_plugin_pw_match+'</font>');return;}}}}
postInfo+=pluginGetFormPostVars();GAJAX_ShowBusyNetwork();plugin_OP=pluginOp;GAJAX_NetworkRequest('plugin',postInfo,pluginCallbackHandler,plugID+'_'+plugin_OP);}
function pluginQuestion(plugID,pluginOp,postData,aWidth,infoCallback)
{plugin_ID=plugID;plugin_InfoCallback=infoCallback;plugin_Silent=false;if((typeof(aWidth)!="undefined")&&(aWidth>0))
{GAJAX_WinShow(aWidth);}
else if(aWidth==0)
{plugin_Silent=true;}
else
{GAJAX_WinShow(500);}
var postInfo='';if(typeof(postData)!="undefined")
{postInfo=postData;}
plugin_OP=pluginOp;GAJAX_NetworkRequest('plugin',postInfo,pluginCallbackHandler,plugID+'_'+plugin_OP);}
var callingRedirectURL=null;function noticeCallbackHandler(aResponse)
{if((gajax_CurrentOp=='favorites_add')||(gajax_CurrentOp=='inapprop_obj_a')||(gajax_CurrentOp=='fullname_a')||(gajax_CurrentOp=='delete_obj_a'))
{plugin_FadeTimer=setTimeout("GAJAX_WinHide()",2000);if(gajax_CurrentOp=='delete_obj_a')
{if((callingRedirectURL)&&(callingRedirectURL!=''))
{doActionURL(callingRedirectURL);}}}
else
{if(gajax_CurrentOp.indexOf("_a")!=-1)
{plugin_FadeTimer=setTimeout("GAJAX_WinHide()",500);}}}
function noticeShow(aOp,aArgs,redirURL)
{if(aOp=='fullname_q'){if(isChinaSite()){return;}}
callingRedirectURL=null;if(typeof(redirURL)!="undefined"){callingRedirectURL=redirURL;}
GAJAX_WinShow(500);GAJAX_NetworkRequest(aOp,aArgs,noticeCallbackHandler);}
function noticeHide(aOp,aArgs,redirURL)
{callingRedirectURL=null;if(typeof(redirURL)!="undefined"){callingRedirectURL=redirURL;}
GAJAX_ShowBusyNetwork();GAJAX_NetworkRequest(aOp,aArgs,noticeCallbackHandler);}
function addContentCallbackHandler(aResponse)
{}
function delAcctCallbackHandler(aResponse)
{}
function addContentShow(aOp,aArgs)
{GAJAX_WinShow(500);GAJAX_NetworkRequest(aOp,aArgs,addContentCallbackHandler);}
function deleteAccountShow(aOp,aArgs)
{GAJAX_WinShow(500);GAJAX_NetworkRequest(aOp,aArgs,delAcctCallbackHandler);}
function addContentSubmit(aFormID)
{var postInfo='';var aName=document.getElementById('gps_name');if((aName)&&(aName.value==''))
{GAJAX_ShowUserMessage('<font color=red>'+res_album_name+'</font>');aName.focus();return;}
else
{var aCap=document.getElementById('gps_desc');if((aCap)&&(aCap.value==''))
{GAJAX_ShowUserMessage('<font color=red>'+res_album_caption+'</font>');aCap.focus();return;}}
var aFile=document.getElementById('data1');if(aFile.value=='')
{GAJAX_ShowUserMessage('<font color=red>'+res_album_file+'</font>');aFile.focus();return;}
GAJAX_ShowUserMessage(res_album_upload);var aForm=document.getElementById(aFormID);if(aForm)
{aForm.submit();}}
var gps_img_tag_id=0;var gps_autocomplete=[];var gps_autocomp_fids=[];var gps_autocomplete_temp='';var dont_show_processing=false;var gps_img_tag_cached_ids=[];var gps_img_tag_cache=[];var cache_pool=[];var cache_lookup=false;var cache_lookup_id=0;function checkCache(image_id){for(var t=0;t<=gps_img_tag_cached_ids.length;t++){if(gps_img_tag_cached_ids[t]==image_id){return t;}}
return-1;}
function insertIntoCache(image_id,img_tag_content){gps_img_tag_cached_ids[gps_img_tag_cached_ids.length]=image_id;gps_img_tag_cache[gps_img_tag_cached_ids.length]=img_tag_content;}
function getImageTagCache(image_id){var g=checkCache(image_id);g=g+1;return gps_img_tag_cache[g];}
function deleteCache(image_id2){var g=checkCache(image_id2);gps_img_tag_cached_ids[g]='';g=g+1;gps_img_tag_cache[g]='';}
function startTaggingN(image_id){dont_show_processing=true;var cache_check=checkCache(image_id);if(cache_check==-1){cache_pool=[];startTagging(image_id);}
else{showBackGround();gps_img_tag_id=image_id;cache_lookup=true;cache_lookup_id=image_id;taggingCallbackHandler();}}
function startTagging(imageID)
{gps_img_tag_id=imageID;var cache_check=checkCache(imageID);if(cache_check!=-1){startTaggingN(imageID);return;}
else{if(document.getElementById('gypsii_ajax_win').style.display=='none'){dont_show_processing=false;}}
if(!dont_show_processing){GAJAX_WinShow(500);}
else{dont_show_processing=false;GAJAX_ShowBusyNetwork();}
var postInfo='id='+imageID;if(gps_autocomplete.length==0){postInfo+="&f_list=1";}
else{postInfo+="&f_list=0";}
gajax_CurrentOp='imagetagging';GAJAX_NetworkRequest('imagetag_ui',postInfo,taggingCallbackHandler);}
function taggingActionCallbackHandler(){if(gps_att_httpobj.readyState==4)
{if(gps_att_httpobj.status==200)
{loginCheck(gps_att_httpobj.responseText);if(gajax_CurrentOp=='imagetag_add'){var p1=n-1;gps_icons[p1]=gps_att_httpobj.responseText;showTag('gps_test'+p1,p1);deleteCache(gps_save_img_id);}
else if(gajax_CurrentOp=='imagetag_del'){deleteCache(gps_del_img_id);}
GAJAX_HideBusyNetwork();}}}
function removeHTMLComments(html_comment){var g_temp=html_comment.split('<!--');g_temp=g_temp[1].split('-->');return g_temp[0];}
function getImageId(){return gps_img_tag_id;}
function loginCheck(ajax_response){var temp=ajax_response.split(',');if(temp.length==2){if(temp[0]==0){GAJAX_WinHide();window.location.href=window.location.href;}}}
function taggingCallbackHandler(aResponse)
{if(cache_lookup){var image_id1=cache_lookup_id;aResponse=getImageTagCache(image_id1);cache_lookup=false;}
loginCheck(aResponse);document.getElementById('gypsii_ajax_win').innerHTML=aResponse;var t_w=0;var t_h=0;var js_vars=aResponse.split('<!-- gypsii_seperator -->');var js_var=removeHTMLComments(js_vars[0]).split('###');var js_var_ids=removeHTMLComments(js_vars[1]).split('###');n=js_var[0];if(gps_autocomplete.length!=0){gps_autocomplete=gps_autocomplete_temp.split(',');}
if(n>0){t_ids=js_var[1].split(',');s_x=js_var[2].split(',');s_y=js_var[3].split(',');s_w=js_var[4].split(',');s_h=js_var[5].split(',');s_title=js_var[6].split(',');s_fids=js_var[7].split(',');if(gps_autocomplete.length==0){gps_autocomplete=js_var[8].split(',');gps_autocomplete_temp=js_var[8];suggest_library=[''];suggest_library=gps_autocomplete;gps_friend_uids=js_var[9].split(',');gps_autocomp_fids=gps_friend_uids;}
else{suggest_library=[''];suggest_library=gps_autocomplete;gps_friend_uids=gps_autocomp_fids;}
t_w=js_var[10];t_h=js_var[11];if(js_var[12]==1){isOwner=true;}
else{isOwner=false;}
gps_icons=js_var[13].split(',');}
else{if(gps_autocomplete.length==0){gps_autocomplete=js_var[1].split(',');gps_autocomplete_temp=js_var[1];suggest_library=gps_autocomplete;gps_friend_uids=js_var[2].split(',');gps_autocomp_fids=gps_friend_uids;}
else{suggest_library=[];suggest_library=gps_autocomplete;gps_friend_uids=gps_autocomp_fids;}
t_w=js_var[3];t_h=js_var[4];if(js_var[5]==1){isOwner=true;}
else{isOwner=false;}}
for(var p=0;p<n;p++){removeSuggestion(s_title[p]);}
gps_img_width=parseInt(t_w);gps_img_height=parseInt(t_h);GAJAX_WinSetDimensions((gps_img_width+13));setHeight();if(navigator.appName=="Microsoft Internet Explorer"){fixIEWidth();}
var image_id=js_var_ids[0];var cache_check=checkCache(image_id);if(cache_check==-1){insertIntoCache(image_id,aResponse);}
cache_pool=[];if(js_var_ids[1]){if(checkCache(js_var_ids[1])==-1){cache_pool[cache_pool.length]=js_var_ids[1];prev_cache_id=js_var_ids[1];show_prev_arrow=false;}
else{if(document.getElementById('image_prev')){document.getElementById('image_prev').style.visibility="visible";show_prev_arrow=true;}}}
if(js_var_ids[2]){if(checkCache(js_var_ids[2])==-1){cache_pool[cache_pool.length]=js_var_ids[2];next_cache_id=js_var_ids[2];show_next_arrow=false;}
else{if(document.getElementById('image_next')){document.getElementById('image_next').style.visibility="visible";show_next_arrow=true;}}}
showPrevNext(show_prev_arrow,show_next_arrow);if(!cache_pool_in_progress){getLookAheadCache();}}
function fixIEWidth(){var i_padding=12;var new_w=gps_img_width+i_padding;document.getElementById('imgtag_titlebar').style.width=new_w;document.getElementById('imgtag_hr').style.width=new_w;document.getElementById('imgtag_footer').style.width=new_w;}
var cache_httpObj;var prev_cache_id=0;var next_cache_id=0;var show_next_arrow=false;var show_prev_arrow=false;var cache_pool_in_progress=false;function getLookAheadCache(){var cache_lookup_id=0;if(cache_pool.length>0){cache_pool_in_progress=true;cache_lookup_id=cache_pool[0];if(checkCache(cache_pool[0])!=-1){if(prev_cache_id==cache_pool[0]){show_prev_arrow=true;if(document.getElementById('image_prev')){document.getElementById('image_prev').style.visibility="visible";}}
cache_pool_in_progress=false;return;}
if(cache_pool.length>1){var temp=cache_pool[1];cache_pool=[];cache_pool[0]=temp;}
else{cache_pool=[];}
if(cache_lookup_id!=0){if(!cache_httpObj){cache_httpObj=GPSJS_AJAXGetHTTPObject();}
if(cache_httpObj)
{var infoURL=gps_global_urlroot+'/home.cgi';var postInfo='id='+cache_lookup_id+'&ajax=1&op=imagetag_ui&f_list=0';GPSJS_AJAXPostRequest(cache_httpObj,gps_global_sessionid,taggingCallbackHandler_cache,infoURL,'imagetag_ui',true,postInfo);}}}
else{cache_pool_in_progress=false;return;}}
function taggingCallbackHandler_cache(){if(cache_httpObj.readyState==4)
{if(cache_httpObj.status==200)
{var js_vars=cache_httpObj.responseText.split('<!-- gypsii_seperator -->');var js_var_ids=removeHTMLComments(js_vars[1]).split('###');var image_id=js_var_ids[0];if(next_cache_id==image_id){show_next_arrow=true;if(document.getElementById('image_next')){document.getElementById('image_next').style.visibility="visible";document.getElementById("image_next2").style.opacity='0.99';document.getElementById("image_next2").style.filter='alpha(opacity=99)';}}
else if(prev_cache_id==image_id){show_prev_arrow=true;if(document.getElementById('image_prev')){document.getElementById('image_prev').style.visibility="visible";document.getElementById("image_prev2").style.opacity='0.99';document.getElementById("image_prev2").style.filter='alpha(opacity=99)';}}
insertIntoCache(image_id,cache_httpObj.responseText);getLookAheadCache();}}}
function showPrevNext(prev_t_f,next_t_f){disable_onmouseover=false;if(!prev_t_f){document.getElementById('image_prev').style.visibility="visible";document.getElementById("image_prev2").style.opacity='0.50';document.getElementById("image_prev2").style.filter='alpha(opacity=50)';}
if(!next_t_f){document.getElementById('image_next').style.visibility="visible";document.getElementById("image_next2").style.opacity='0.50';document.getElementById("image_next2").style.filter='alpha(opacity=50)';}
return;}
function startTagging1(id,div_id){if(id==0){return;}
if(add_tag_on){return;}
if(document.getElementById(div_id+'')){if(document.getElementById(div_id+'').style.opacity==0.50){return;}}
if(document.getElementById('img_next')){document.getElementById('image_next').style.display="none";}
if(document.getElementById('img_prev'))
{document.getElementById('img_prev').style.display="none";}
disable_onmouseover=true;startTaggingN(id);}
function showBackGround(){var bgObj=document.getElementById('gypsii_ajax_win_bg');if(bgObj)
{if(navigator.userAgent.toLowerCase().indexOf("msie")+1)
{bgObj.style.position="absolute";}
bgObj.style.display='block';bgObj.style.visibility='visible';}
}
function isChinaSite(){if(gps_global_urlroot=='http://www.gypsii.com.cn'||gps_global_urlroot=='http://space.wo-store.net'){return true;}
else{return false;}}