function sack(file){this.xmlhttp=null;this.resetData=function(){this.method="POST";this.queryStringSeparator="?";this.argumentSeparator="&";this.URLString="";this.encodeURIString=true;this.execute=false;this.element=null;this.elementObj=null;this.requestFile=file;this.vars=new Object();this.responseStatus=new Array(2);};this.resetFunctions=function(){this.onLoading=function(){};this.onLoaded=function(){};this.onInteractive=function(){};this.onCompletion=function(){};this.onError=function(){};this.onFail=function(){};};this.reset=function(){this.resetFunctions();this.resetData();};this.createAJAX=function(){try{this.xmlhttp=new ActiveXObject("Msxml2.XMLHTTP");}catch(e1){try{this.xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");}catch(e2){this.xmlhttp=null;}}
if(!this.xmlhttp){if(typeof XMLHttpRequest!="undefined"){this.xmlhttp=new XMLHttpRequest();}else{this.failed=true;}}};this.setVar=function(name,value){this.vars[name]=Array(value,false);};this.encVar=function(name,value,returnvars){if(true==returnvars){return Array(encodeURIComponent(name),encodeURIComponent(value));}else{this.vars[encodeURIComponent(name)]=Array(encodeURIComponent(value),true);}}
this.processURLString=function(string,encode){encoded=encodeURIComponent(this.argumentSeparator);regexp=new RegExp(this.argumentSeparator+"|"+encoded);varArray=string.split(regexp);for(i=0;i<varArray.length;i++){urlVars=varArray[i].split("=");if(true==encode){this.encVar(urlVars[0],urlVars[1]);}else{this.setVar(urlVars[0],urlVars[1]);}}}
this.createURLString=function(urlstring){if(this.encodeURIString&&this.URLString.length){this.processURLString(this.URLString,true);}
if(urlstring){if(this.URLString.length){this.URLString+=this.argumentSeparator+urlstring;}else{this.URLString=urlstring;}}
this.setVar("rndval",new Date().getTime());urlstringtemp=new Array();for(key in this.vars){if(false==this.vars[key][1]&&true==this.encodeURIString){encoded=this.encVar(key,this.vars[key][0],true);delete this.vars[key];this.vars[encoded[0]]=Array(encoded[1],true);key=encoded[0];}
urlstringtemp[urlstringtemp.length]=key+"="+this.vars[key][0];}
if(urlstring){this.URLString+=this.argumentSeparator+urlstringtemp.join(this.argumentSeparator);}else{this.URLString+=urlstringtemp.join(this.argumentSeparator);}}
this.runResponse=function(){eval(this.response);}
this.runAJAX=function(urlstring){if(this.failed){this.onFail();}else{this.createURLString(urlstring);if(this.element){this.elementObj=document.getElementById(this.element);}
if(this.xmlhttp){var self=this;if(this.method=="GET"){totalurlstring=this.requestFile+this.queryStringSeparator+this.URLString;this.xmlhttp.open(this.method,totalurlstring,true);}else{this.xmlhttp.open(this.method,this.requestFile,true);try{this.xmlhttp.setRequestHeader("Content-Type","application/x-www-form-urlencoded")}catch(e){}}
this.xmlhttp.onreadystatechange=function(){switch(self.xmlhttp.readyState){case 1:self.onLoading();break;case 2:self.onLoaded();break;case 3:self.onInteractive();break;case 4:self.response=self.xmlhttp.responseText;self.responseXML=self.xmlhttp.responseXML;self.responseStatus[0]=self.xmlhttp.status;self.responseStatus[1]=self.xmlhttp.statusText;if(self.execute){self.runResponse();}
if(self.elementObj){elemNodeName=self.elementObj.nodeName;elemNodeName.toLowerCase();if(elemNodeName=="input"||elemNodeName=="select"||elemNodeName=="option"||elemNodeName=="textarea"){self.elementObj.value=self.response;}else{self.elementObj.innerHTML=self.response;}}
if(self.responseStatus[0]=="200"){self.onCompletion();}else{self.onError();}
self.URLString="";break;}};this.xmlhttp.send(this.URLString);}}};this.reset();this.createAJAX();}
function blogs_trip_edit(id)
{popUp(PATH+'modules/trips/form.php?id='+id);}
function blogs_trip_file_uploaded(param)
{jQuery('#trip_filename').val(param);document.uploading=false;}
function blogs_trip_presave(callback)
{jQuery.ajax({type:'POST',url:PATH+'modules/trips/presave.php',success:function(response)
{if(response>0){jQuery('#trip_id').val(response);callback();}}});}
function blogs_trips_gm_countries(blog_name,google_map_ref)
{jQuery.ajax({type:'get',async:false,url:PATH+'modules/trips/google_map_countries.php',data:{blog_name:blog_name},success:function(response)
{var v_data=response.split('|');if(v_data.length>1){for(var i=1;i<v_data.length;i++){v_data[i]=v_data[i].split(',');v_data[i][2]=urldecode(v_data[i][2]);var gm_point=new GLatLng(v_data[i][0],v_data[i][1]);var gm_icon=new GIcon(G_DEFAULT_ICON);gm_icon.iconSize=new GSize(20,15);gm_icon.iconAnchor=new GPoint(10,5);gm_icon.image=PATH+'html/img/flags/'+v_data[i][3]+'.gif';gm_icon.shadow='';var gm_marker=new GMarker(gm_point,{icon:gm_icon,title:v_data[i][2]});google_map_ref.addOverlay(gm_marker);}}}});}
function blogs_trips_gm_cities(id_trip,google_map_ref)
{jQuery.ajax({type:'get',async:false,url:PATH+'modules/trips/google_map_cities.php',data:{id_trip:id_trip},success:function(response)
{var v_data=response.split('|');if(v_data.length>1){for(var i=1;i<v_data.length;i++){v_data[i]=v_data[i].split(',');v_data[i][2]=urldecode(v_data[i][2]);var gm_point=new GLatLng(v_data[i][0],v_data[i][1]);var gm_icon=new GIcon(G_DEFAULT_ICON);var gm_marker=new GMarker(gm_point,{icon:gm_icon,title:v_data[i][2]});google_map_ref.addOverlay(gm_marker);}}}});}
function blogs_trip_save()
{var trip_id=jQuery('#trip_id').val();if(trip_id==0){blogs_trip_presave(blogs_trip_save);return;}
if(!jQuery.isReady||document.sending)return;jQuery('#div_trip_msg').hide();var trip_date_start_check=jQuery('#trip_date_start_d').val()+"/"+jQuery('#trip_date_start_m').val()+"/"+jQuery('#trip_date_start_y').val();var trip_date_start_post=jQuery('#trip_date_start_y').val()+"-"+jQuery('#trip_date_start_m').val()+"-"+jQuery('#trip_date_start_d').val();var trip_date_end_check=jQuery('#trip_date_end_d').val()+"/"+jQuery('#trip_date_end_m').val()+"/"+jQuery('#trip_date_end_y').val();var trip_date_end_post=jQuery('#trip_date_end_y').val()+"-"+jQuery('#trip_date_end_m').val()+"-"+jQuery('#trip_date_end_d').val();if(inputIsEmpty('trip_title')){show_div_alert('div_trip_msg',MSG_MISSING_TITLE);jQuery('#trip_title').focus();}else
if(!is_date(trip_date_start_check)){show_div_alert('div_trip_msg',MSG_INVALID_DATE);jQuery('#trip_date_start_d').focus();}else
if(!is_date(trip_date_end_check)){show_div_alert('div_trip_msg',MSG_INVALID_DATE);jQuery('#trip_end_start_d').focus();}else
if(inputIsEmpty('trip_description')){show_div_alert('div_trip_msg',MSG_MISSING_DESCRIPTION);jQuery('#trip_description').focus();}else
if(jQuery('#trip_cities').val()==0&&jQuery('#trip_is_new').val()==1){show_div_alert('div_trip_msg',MSG_MISSING_LOCATION_CITY);}else
if(document.uploading){show_div_alert('div_trip_msg',MSG_FILE_UPLOADING);return;}else{show_div_alert('div_trip_msg',MSG_SENDING);var objParams=new Object();objParams.id=trip_id;objParams.title=urlencode(jQuery('#trip_title').val());objParams.date_start=trip_date_start_post;objParams.date_end=trip_date_end_post;objParams.description=urlencode(jQuery('#trip_description').val());objParams.image=urlencode(jQuery('#trip_filename').val());var iPrivateTrip=0;if(jQuery('#chkPrivate').is(':checked')){iPrivateTrip=1;}
objParams.is_private=iPrivateTrip;objParams.is_new=jQuery('#trip_is_new').val();jQuery.ajax({type:'POST',data:objParams,url:PATH+'modules/trips/save.php',success:function(response)
{hide_js_alert();if(response==1){if(jQuery('#trip_is_new').val()==1){popUpHide();popUp(PATH+'modules/trips/save_finished.php?id='+trip_id);}else{window.location.reload(false);}}else{show_div_alert('div_trip_msg',MSG_ERROR);}
document.sending=false;}});document.sending=true;}}
function blogs_trip_delete(id)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){show_js_alert(ALERT_OK,{message:MSG_DELETING,close:false});jQuery.ajax({type:'POST',async:false,data:{id:id},url:PATH+'modules/trips/delete.php',success:function(response)
{var v_result=response.split("|");hide_js_alert();if(v_result[0]==1){show_js_alert(ALERT_OK,{message:MSG_DELETED,callback:function(){gotoURL(v_result[1]);}});}else{show_js_alert(ALERT_ERROR,{message:MSG_SERVER_ERROR});}
document.sending=false;}});document.sending=true;}}}
function blogs_trips_add_city()
{if(!jQuery.isReady||document.sending)return;jQuery('#div_trip_msg').hide();var id_world_city=jQuery('#id_world_city').val();var trip_id=jQuery('#trip_id').val();if(id_world_city==0){show_div_alert('div_trip_msg',MSG_MISSING_LOCATION_CITY);return;}else
if(trip_id==0){blogs_trip_presave(blogs_trips_add_city);return;}
jQuery.ajax({type:'POST',data:{trip_id:trip_id,id_world_city:id_world_city},url:PATH+'modules/trips/save_city.php',success:function(response)
{if(response==1){jQuery('#trip_cities').val(jQuery('#trip_cities').val()+1);blogs_trip_update_cities(1);}else{show_div_alert('div_trip_msg',MSG_CITY_ALREADY_ADDED);}
document.sending=false;}});document.sending=true;}
function blogs_trips_remove_city(id_world_city)
{if(!jQuery.isReady||document.sending)return;jQuery('#div_trip_msg').hide();var trip_id=jQuery('#trip_id').val();jQuery.ajax({type:'POST',data:{trip_id:trip_id,id_world_city:id_world_city},url:PATH+'modules/trips/remove_city.php',success:function(response)
{if(response==1){jQuery('#trip_cities').val(jQuery('#trip_cities').val()-1);blogs_trip_update_cities(1);}else{show_div_alert('div_trip_msg',MSG_ERROR);}
document.sending=false;}});document.sending=true;}
function blogs_trip_update_cities(p)
{var trip_id=jQuery('#trip_id').val();var city_list_url=PATH+'modules/trips/form_cities.php?trip_id='+trip_id+'&p='+p;jQuery('#div_trip_city_list').load(city_list_url);}
function blogs_trips_notify()
{var trip_id=jQuery('#trip_id').val();var email_list=jQuery('#trip_email_list').val();if(!trip_id)show_div_alert('div_trip_msg',MSG_ERROR);jQuery.ajax({type:'POST',async:false,data:{trip_id:trip_id,email_list:email_list},url:PATH+'modules/trips/save_notify.php',success:function(response)
{var v_result=response.split("|");if(v_result[0]==1){gotoURL(v_result[1]);}else{show_div_alert('div_trip_msg',MSG_ERROR);}
document.sending=false;}});document.sending=true;}
function blogs_trips_page(blog_name,p)
{jQuery.ajax({type:'GET',async:false,data:{blog_name:blog_name,p:p},url:PATH+'modules/trips/index_ajax.php',success:function(response)
{jQuery('#div_trips_list').html(response);}});}
function blogs_trips_photos_filter(blog_name)
{jQuery.ajax({type:'GET',async:false,data:{blog_name:blog_name,p:1,id_trip:jQuery('#trip_selector').val()},url:PATH+'modules/photos/index_ajax.php',success:function(response)
{jQuery('#photos_list').html(response);}});}
function blogs_recommendations_ajax(module,blog_name,p)
{jQuery.ajax({type:'GET',async:false,data:{blog_name:blog_name,p:p,module:module},url:PATH+'modules/youhaveto/recommendations_ajax.php',success:function(response)
{jQuery('#'+module+'_list').html(response);}});}
function blogs_trip_journals_page(blog_name,id_trip,p)
{jQuery.ajax({type:'GET',async:false,data:{blog_name:blog_name,id_trip:id_trip,p:p},url:PATH+'modules/journals/trip_list.php',success:function(response)
{jQuery('#div_journal_list').html(response);}});}
var module_f_set_sending=false;function module_f_set(id,add)
{if(!module_f_set_sending){module_f_set_sending=true;var div_add=$('div_module_f_'+id+'_add');var div_rem=$('div_module_f_'+id+'_remove');var AJAX=new sack(PATH+"ajax/module_f_config/");AJAX.setVar("id_module_f",id);AJAX.setVar("action",(add)?"add":"remove");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]!=""){if(v_data[1]==1){div_add.hide();div_rem.show();}else{div_add.show();div_rem.hide();}
loadURL("div_APP_PANEL",PATH+"user/app_panel/");}else{globalMsg(MSG_SERVER_ERROR);}
module_f_set_sending=false;}
AJAX.runAJAX();}}
function createSorteable()
{var obj=new Object();obj.tag='div';obj.handle='sorteable_handler';obj.onChange=function()
{var AJAX=new sack(PATH+"ajax/module_f_order/");AJAX.setVar('order',Sortable.serialize('div_blog_container'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{}
AJAX.runAJAX();}
Sortable.create('div_blog_container',obj);}
function Epoch(name,mode,targetelement,multiselect,options){var self=this;if(options==null)options=new Object();function calConfig(){self.versionNumber='2.0.2';self.displayYearInitial=self.curDate.getFullYear();self.displayMonthInitial=self.curDate.getMonth();self.displayYear=self.displayYearInitial;self.displayMonth=self.displayMonthInitial;self.minDate=new Date(2008,0,1);self.maxDate=new Date((new Date().getFullYear()+2),11,31);self.startDay=0;self.showWeeks=false;self.selCurMonthOnly=true;if(options.minDate)self.minDate=options.minDate;if(options.maxDate)self.minDate=options.maxDate;}
function setLangEN(){self.daylist=new Array('S','M','T','W','T','F','S','S','M','T','W','T','F','S');self.months_sh=new Array('January','Febraury','March','April','May','June','July','August','September','October','November','December');self.monthup_title='Go to the next month';self.monthdn_title='Go to the previous month';self.clearbtn_caption='Clear';self.clearbtn_title='Clears any dates selected on the calendar';self.maxrange_caption='This is the maximum range';self.closebtn_caption='Close';self.closebtn_title='Close the calendar';}
function setLang(){self.daylist=new Array('D','L','M','M','J','V','S','D','L','M','M','J','V','S');self.months_sh=new Array('Enero','Febrero','Marzo','Abril','Mayo','Junio','Julio','Agosto','Septiembre','Octubre','Noviembre','Diciembre');self.monthup_title='Mes siguiente';self.monthdn_title='Mes anterior';self.clearbtn_caption='Limpiar';self.clearbtn_title='Limpiar selección';self.maxrange_caption='Este es el mínimo rango';self.closebtn_caption='Cerrar';self.closebtn_title='Cerrar el calendario';}
function setDays(){self.daynames=new Array();var j=0;for(var i=self.startDay;i<self.startDay+7;i++){self.daynames[j++]=self.daylist[i];}
self.monthDayCount=new Array(31,((self.curDate.getFullYear()-2000)%4?28:29),31,30,31,30,31,31,30,31,30,31);}
function createCalendar(){var tbody,tr,td;self.calendar=document.createElement('table');self.calendar.setAttribute('id',self.name+'_calendar');setClass(self.calendar,'calendar');self.calendar.style.display='none';addEventHandler(self.calendar,'selectstart',function(){return false;});addEventHandler(self.calendar,'drag',function(){return false;});tbody=document.createElement('tbody');tr=document.createElement('tr');td=document.createElement('td');setClass(td,'mainheading');td.appendChild(createMainHeading());tr.appendChild(td);tbody.appendChild(tr);tr=document.createElement('tr');td=document.createElement('td');setClass(td,'espacio');tr.appendChild(td);tbody.appendChild(tr);tr=document.createElement('tr');td=document.createElement('td');self.calendar.celltable=document.createElement('table');setClass(self.calendar.celltable,'cells');self.calendar.celltable.border=1;self.calendar.celltable.cellspacing=10;self.calendar.celltable.cellpadding=10
self.calendar.celltable.appendChild(createDayHeading());self.calendar.celltable.appendChild(createCalCells());td.appendChild(self.calendar.celltable);tr.appendChild(td);tbody.appendChild(tr);tr=document.createElement('tr');td=document.createElement('td');tr.appendChild(td);tbody.appendChild(tr);self.calendar.appendChild(tbody);addEventHandler(self.calendar,'mouseover',cal_onmouseover);addEventHandler(self.calendar,'mouseout',cal_onmouseout);}
function createMainHeading(){var container=document.createElement('div');setClass(container,'heading');var divMonth=document.createElement('div');setClass(divMonth,'left');var divYear=document.createElement('div');setClass(divYear,'left_2');self.monthSelect=document.createElement('select');self.yearSelect=document.createElement('select');var monthDn=document.createElement('input');var monthUp=document.createElement('input');var opt,i;for(i=0;i<12;i++){opt=document.createElement('option');opt.setAttribute('value',i);if(self.displayMonth==i){opt.setAttribute('selected','selected');}
opt.appendChild(document.createTextNode(self.months_sh[i]));self.monthSelect.appendChild(opt);}
var yrMax=self.maxDate.getFullYear(),yrMin=self.minDate.getFullYear();for(i=yrMin;i<=yrMax;i++){opt=document.createElement('option');opt.setAttribute('value',i);if(self.displayYear==i){opt.setAttribute('selected','selected');}
opt.appendChild(document.createTextNode(i));self.yearSelect.appendChild(opt);}
monthUp.setAttribute('type','button');monthUp.setAttribute('value','>');monthUp.setAttribute('title',self.monthup_title);monthDn.setAttribute('type','button');monthDn.setAttribute('value','<');monthDn.setAttribute('title',self.monthdn_title);self.monthSelect.owner=self.yearSelect.owner=monthUp.owner=monthDn.owner=self;function selectonchange(){if(self.goToMonth(self.yearSelect.value,self.monthSelect.value)){self.displayMonth=self.monthSelect.value;self.displayYear=self.yearSelect.value;}
else{self.monthSelect.value=self.displayMonth;self.yearSelect.value=self.displayYear;}}
addEventHandler(monthUp,'click',function(){self.nextMonth();});addEventHandler(monthDn,'click',function(){self.prevMonth();});addEventHandler(self.monthSelect,'change',selectonchange);addEventHandler(self.yearSelect,'change',selectonchange);divMonth.appendChild(self.monthSelect);divYear.appendChild(self.yearSelect);container.appendChild(divMonth);container.appendChild(divYear);return container;}
function createFooter(){var container=document.createElement('div');var clearSelected=document.createElement('input');clearSelected.setAttribute('type','button');clearSelected.setAttribute('value',self.clearbtn_caption);clearSelected.setAttribute('title',self.clearbtn_title);clearSelected.owner=self;addEventHandler(clearSelected,'click',function(){self.resetSelections(false);});container.appendChild(clearSelected);if(self.mode=='popup'){var closeBtn=document.createElement('input');closeBtn.setAttribute('type','button');closeBtn.setAttribute('value',self.closebtn_caption);closeBtn.setAttribute('title',self.closebtn_title);addEventHandler(closeBtn,'click',function(){self.hide();});setClass(closeBtn,'closeBtn');container.appendChild(closeBtn);}
return container;}
function createDayHeading(){self.calHeading=document.createElement('thead');setClass(self.calHeading,'caldayheading');var tr=document.createElement('tr'),th;self.cols=new Array(false,false,false,false,false,false,false);if(self.showWeeks){th=document.createElement('th');setClass(th,'wkhead');tr.appendChild(th);}
for(var dow=0;dow<7;dow++){th=document.createElement('th');th.appendChild(document.createTextNode(self.daynames[dow]));if(self.selectMultiple){th.headObj=new CalHeading(self,th,(dow+self.startDay<7?dow+self.startDay:dow+self.startDay-7));}
tr.appendChild(th);}
self.calHeading.appendChild(tr);return self.calHeading;}
function createCalCells(){self.rows=new Array(false,false,false,false,false,false);self.cells=new Array();var row=-1,totalCells=(self.showWeeks?41:35);var beginDate=new Date(self.displayYear,self.displayMonth,1);var endDate=new Date(self.displayYear,self.displayMonth,self.monthDayCount[self.displayMonth]);var sdt=new Date(beginDate);sdt.setDate(sdt.getDate()+(self.startDay-beginDate.getDay())-(self.startDay-beginDate.getDay()>0?7:0));self.calCells=document.createElement('tbody');var tr,td;var cellIdx=0,cell,week,dayval;for(var i=0;i<totalCells;i++){if(self.showWeeks){if(i%8==0){row++;week=sdt.getWeek(self.startDay);tr=document.createElement('tr');td=document.createElement('td');if(self.selectMultiple){td.weekObj=new WeekHeading(self,td,week,row)}
else{setClass(td,'wkhead');}
td.appendChild(document.createTextNode(week));tr.appendChild(td);i++;}}
else if(i%7==0){row++;week=sdt.getWeek(self.startDay);tr=document.createElement('tr');}
dayval=sdt.getDate();td=document.createElement('td');td.appendChild(document.createTextNode(dayval));cell=new CalCell(self,td,sdt,row,week);self.cells[cellIdx]=cell;td.cellObj=cell;tr.appendChild(td);self.calCells.appendChild(tr);self.reDraw(cellIdx++);sdt.setDate(dayval+1);}
return self.calCells;}
function setMode(targetelement){if(self.mode=='popup'){self.calendar.style.position='absolute';}
if(targetelement){switch(self.mode){case'flat':self.tgt=targetelement;self.tgt.appendChild(self.calendar);self.visible=true;break;case'popup':self.calendar.style.position='absolute';document.body.appendChild(self.calendar);self.setTarget(targetelement,false);break;}}
else{document.body.appendChild(self.calendar);self.visible=false;}}
function deleteCells(){self.calendar.celltable.removeChild(self.calendar.celltable.childNodes[1]);}
function setClass(element,className){element.setAttribute('class',className);element.setAttribute('className',className);}
function setCellProperties(cellindex){var cell=self.cells[cellindex];var date;idx=self.dateInArray(self.dates,cell.date);if(idx>-1){date=self.dates[idx];cell.date.selected=date.selected||false;cell.date.type=date.type;cell.date.canSelect=date.canSelect;cell.setTitle(date.title);cell.setURL(date.href,'js');cell.setHTML(date.cellHTML);}
else{cell.date.selected=false;}
if(cell.date.getTime()<self.minDate.getTime()||cell.date.getTime()>self.maxDate.getTime()){cell.date.canSelect=false;}
cell.setClass();}
function cal_onmouseover(){self.mousein=true;}
function cal_onmouseout(){self.mousein=false;}
function updateSelectedDates(){var idx=0;self.selectedDates=new Array();for(i=0;i<self.dates.length;i++){if(self.dates[i].selected){self.selectedDates[idx++]=self.dates[i];}}}
self.dateInArray=function(arr,searchVal,startIndex){startIndex=(startIndex!=null?startIndex:0);for(var i=startIndex;i<arr.length;i++){if(searchVal.getUeDay()==arr[i].getUeDay()){return i;}}
return-1;};self.setTarget=function(targetelement,focus)
{if(self.mode=='popup'){function popupFocus(){self.show();}
function popupBlur(){if(!self.mousein){self.hide();}}
function popupKeyDown(){self.hide();}
if(self.tgt){removeEventHandler(self.tgt,'focus',popupFocus);removeEventHandler(self.tgt,'blur',popupBlur);removeEventHandler(self.tgt,'keydown',popupKeyDown);}
self.tgt=targetelement;var dto=self.tgt.dateObj,pdateArr=new Array;if(dto){if(self.tgt.value.length){pdateArr[0]=dto;}
self.goToMonth(dto.getFullYear(),dto.getMonth());}
self.selectDates(pdateArr,true,true,true);self.topOffset=self.tgt.offsetHeight;self.leftOffset=0;self.updatePos(self.tgt);addEventHandler(self.tgt,'focus',popupFocus);addEventHandler(self.tgt,'blur',popupBlur);addEventHandler(self.tgt,'keydown',popupKeyDown);if(focus!==false){popupFocus();}}
else{if(self.tgt){self.tgt.removeChild(self.calendar);}
self.tgt=targetelement;self.tgt.appendChild(self.calendar);self.show();}};self.nextMonth=function(){var month=self.displayMonth;var year=self.displayYear;if(self.displayMonth<11){month++;}
else if(self.yearSelect.value<self.maxDate.getFullYear()){month=0;year++;}
return self.goToMonth(year,month);};self.prevMonth=function(){var month=self.displayMonth;var year=self.displayYear;if(self.displayMonth>0){month--;}
else{month=11;year--;}
return self.goToMonth(year,month);};self.goToMonth=function(year,month){var testdatemin=new Date(year,month,31);var testdatemax=new Date(year,month,1);if(testdatemin>=self.minDate&&testdatemax<=self.maxDate){self.monthSelect.value=self.displayMonth=month;self.yearSelect.value=self.displayYear=year;createCalCells();deleteCells();self.calendar.celltable.appendChild(self.calCells);if(self.callback)self.callback(self,year,month);return true;}
else{alert(self.maxrange_caption);return false;}};self.updatePos=function(target){if(self.mode=='popup'){self.calendar.style.top=getTop(target)+self.topOffset+'px';self.calendar.style.left=getLeft(target)+self.leftOffset+'px';}};self.show=function(){self.updatePos(self.tgt);self.calendar.style.display='block';self.visible=true;};self.hide=function(){self.calendar.style.display='none';self.visible=false;};self.toggle=function(){self.visible?self.hide():self.show();};self.addDates=function(dates,redraw){var i;for(i=0;i<dates.length;i++){alert(self.dates+" vs "+dates[i]);if(self.dateInArray(self.dates,dates[i])==-1){self.dates[self.dates.length]=dates[i];}}
updateSelectedDates();if(redraw!=false){self.reDraw();}};self.removeDates=function(dates,redraw){var idx;for(var i=0;i<dates.length;i++){idx=self.dateInArray(self.dates,dates[i]);if(idx!=-1){self.dates.splice(idx,1);}}
updateSelectedDates();if(redraw!=false){self.reDraw();}};self.selectDates=function(inpdates,selectVal,redraw,removeothers){var i,idx;if(removeothers==true){for(i=0;i<self.dates.length;i++){self.dates[i].selected=false;}}
for(i=0;i<inpdates.length;i++){idx=self.dateInArray(self.dates,inpdates[i]);if(selectVal==true){inpdates[i].selected=true;if(idx==-1){self.dates[self.dates.length]=inpdates[i];}
else{self.dates[idx].selected=true;}}
else{if(idx>-1){self.dates[idx].selected=inpdates[i].selected=false;if(self.dates[idx].type=='normal'){self.dates.splice(idx,1);}}}}
updateSelectedDates();if(redraw!=false){self.reDraw();}};self.sendForm=function(form,inputname){var inpname=inputname||'epochdates',f,inp;f=(typeof(form)=='string'?document.getElementById(form):form);if(!f){alert('ERROR: Invalid form input');return false;}
for(var i=0;i<self.dates.length;i++){inp=document.createElement('input');inp.setAttribute('type','hidden');inp.setAttribute('name',inpname+'['+i+']');inp.setAttribute('value',encodeURIComponent(self.dates[i].dateFormat('Y-m-d')));f.appendChild(inp);}
return true;};self.resetSelections=function(retMonth){var dateArray=new Array();var dt=self.dates;for(var i=0;i<dt.length;i++){if(dt[i].selected){dateArray[dateArray.length]=dt[i];}}
self.selectDates(dateArray,false,false);self.rows=new Array(false,false,false,false,false,false,false);self.cols=new Array(false,false,false,false,false,false,false);if(self.mode=='popup'){self.tgt.value='';self.hide();}
retMonth==true?self.goToMonth(self.displayYearInitial,self.displayMonthInitial):self.reDraw();};self.reDraw=function(index){self.state=1;var len=index?index+1:self.cells.length;for(var i=index||0;i<len;i++){setCellProperties(i);}
self.state=2;};self.getCellIndex=function(date){for(var i=0;i<self.cells.length;i++){if(self.cells[i].date.getUeDay()==date.getUeDay()){return i;}}
return-1;};self.state=0;self.name=name;self.curDate=new Date();self.mode=mode;self.selectMultiple=(multiselect==true);self.dates=new Array();self.selectedDates=new Array();self.calendar;self.calHeading;self.calCells;self.rows;self.cols;self.cells=new Array();self.monthSelect;self.yearSelect;self.mousein=false;calConfig();setLangEN();setDays();createCalendar();targetelement=typeof(targetelement)=='string'?document.getElementById(targetelement):targetelement;setMode(targetelement);self.state=2;self.visible?self.show():self.hide();}
function CalHeading(owner,tableCell,dayOfWeek){function DayHeadingonclick(){var sdates=owner.dates;var cells=owner.cells;var dateArray=new Array();owner.cols[dayOfWeek]=!owner.cols[dayOfWeek];for(var i=0;i<cells.length;i++){if(cells[i].dayOfWeek==dayOfWeek&&cells[i].date.canSelect&&(!owner.selCurMonthOnly||cells[i].date.getMonth()==owner.displayMonth&&cells[i].date.getFullYear()==owner.displayYear)){dateArray[dateArray.length]=cells[i].date;}}
owner.selectDates(dateArray,owner.cols[dayOfWeek],true);}
var self=this;self.dayOfWeek=dayOfWeek;addEventHandler(tableCell,'mouseup',DayHeadingonclick);}
function WeekHeading(owner,tableCell,week,tableRow){function weekHeadingonclick(){var cells=owner.cells;var sdates=owner.dates;var dateArray=new Array();owner.rows[tableRow]=!owner.rows[tableRow];for(var i=0;i<cells.length;i++){if(cells[i].tableRow==tableRow&&cells[i].date.canSelect&&(!owner.selCurMonthOnly||cells[i].date.getMonth()==owner.displayMonth&&cells[i].date.getFullYear()==owner.displayYear)){dateArray[dateArray.length]=cells[i].date;}}
owner.selectDates(dateArray,owner.rows[tableRow],true);}
var self=this;self.week=week;tableCell.setAttribute('class','wkhead');tableCell.setAttribute('className','wkhead');addEventHandler(tableCell,'mouseup',weekHeadingonclick);}
function CalCell(owner,tableCell,dateObj,row,week){var self=this;function calCellonclick(){if(self.date.canSelect){if(owner.selectMultiple==true){owner.selectDates(new Array(self.date),!self.date.selected,false);self.setClass();}
else{owner.selectDates(new Array(self.date),true,false,true);if(owner.mode=='popup'){owner.tgt.value=self.date.dateFormat();owner.tgt.dateObj=new Date(self.date);owner.hide();}
owner.reDraw();}}else{if(owner.click_cell){owner.click_cell(self.date.dateFormat());}else
if(owner.mode=='popup'){owner.tgt.value=self.date.dateFormat();owner.tgt.dateObj=new Date(self.date);owner.hide();}}}
function calCellonmouseover(){if(self.date.canSelect){tableCell.setAttribute('class',self.cellClass+' hover');tableCell.setAttribute('className',self.cellClass+' hover');}}
function calCellonmouseout(){self.setClass();}
self.setClass=function()
{if(self.date.selected){self.cellClass='cell_selected';}
else if(owner.displayMonth!=self.date.getMonth()){self.cellClass='notmnth';}
else if(self.date.type=='holiday'){self.cellClass='hlday';}
else if(self.dayOfWeek>0&&self.dayOfWeek<6){self.cellClass='wkday';}
else{self.cellClass='wkend';}
if(self.date.getUeDay()==owner.curDate.getUeDay()){self.cellClass=self.cellClass+' curdate';}
tableCell.setAttribute('class',self.cellClass);tableCell.setAttribute('className',self.cellClass);};self.setURL=function(href,type){if(href){if(type=='js'){addEventHandler(self.tableCell,'mousedown',function(){window.location.href=href;});}
else{var url=document.createElement('a');url.setAttribute('href',href);url.appendChild(document.createTextNode(self.date.getDate()));self.tableCell.replaceChild(url,self.tableCell.firstChild);}}};self.setTitle=function(titleStr){if(titleStr&&titleStr.length>0){self.title=titleStr;self.tableCell.setAttribute('title',titleStr);}};self.setHTML=function(html){if(html&&html.length>0){if(self.tableCell.childNodes[1]){self.tableCell.childNodes[1].innerHTML=html;}
else{var htmlCont=document.createElement('div');htmlCont.innerHTML=html;self.tableCell.appendChild(htmlCont);}}};self.cellClass;self.tableRow=row;self.tableCell=tableCell;self.date=new Date(dateObj);self.date.canSelect=false;self.date.type='normal';self.date.selected=false;self.date.cellHTML='';self.dayOfWeek=self.date.getDay();self.week=week;addEventHandler(tableCell,'click',calCellonclick);addEventHandler(tableCell,'mouseover',calCellonmouseover);addEventHandler(tableCell,'mouseout',calCellonmouseout);self.setClass();}
Date.prototype.getDayOfYear=function()
{return parseInt((this.getTime()-new Date(this.getFullYear(),0,1).getTime())/86400000+1);};Date.prototype.getWeek=function(dowOffset){dowOffset=typeof(dowOffset)=='int'?dowOffset:0;var newYear=new Date(this.getFullYear(),0,1);var day=newYear.getDay()-dowOffset;day=(day>=0?day:day+7);var weeknum,daynum=Math.floor((this.getTime()-newYear.getTime()-(this.getTimezoneOffset()-newYear.getTimezoneOffset())*60000)/86400000)+1;if(day<4){weeknum=Math.floor((daynum+day-1)/7)+1;if(weeknum>52){nYear=new Date(this.getFullYear()+1,0,1);nday=nYear.getDay()-dowOffset;nday=nday>=0?nday:nday+7;weeknum=nday<4?1:53;}}
else{weeknum=Math.floor((daynum+day-1)/7);}
return weeknum;};Date.prototype.getUeDay=function()
{return parseInt(Math.floor((this.getTime()-this.getTimezoneOffset()*60000)/86400000));};Date.prototype.dateFormat=function(format)
{if(!format){format='Y-m-d';}
LZ=function(x){return(x<0||x>9?'':'0')+x};var MONTH_NAMES=new Array('January','February','March','April','May','June','July','August','September','October','November','December','Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');var DAY_NAMES=new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday','Sun','Mon','Tue','Wed','Thu','Fri','Sat');var result="";var i_format=0;var c="";var token="";var y=this.getFullYear().toString();var M=this.getMonth()+1;var d=this.getDate();var E=this.getDay();var H=this.getHours();var m=this.getMinutes();var s=this.getSeconds();value={Y:y.toString(),y:y.substring(2),n:M,m:LZ(M),F:MONTH_NAMES[M-1],M:MONTH_NAMES[M+11],j:d,d:LZ(d),D:DAY_NAMES[E+7],l:DAY_NAMES[E],G:H,H:LZ(H)};if(H==0){value['g']=12;}
else if(H>12){value['g']=H-12;}
else{value['g']=H;}
value['h']=LZ(value['g']);if(H>11){value['a']='pm';value['A']='PM';}
else{value['a']='am';value['A']='AM';}
value['i']=LZ(m);value['s']=LZ(s);while(i_format<format.length){c=format.charAt(i_format);token="";while((format.charAt(i_format)==c)&&(i_format<format.length)){token+=format.charAt(i_format++);}
if(value[token]!=null){result=result+value[token];}
else{result=result+token;}}
return result;};function addEventHandler(element,type,func){if(element.addEventListener){element.addEventListener(type,func,false);}
else if(element.attachEvent){element.attachEvent('on'+type,func);}}
function removeEventHandler(element,type,func){if(element.removeEventListener){element.removeEventListener(type,func,false);}
else if(element.attachEvent){element.detachEvent('on'+type,func);}}
function getTop(element){var oNode=element;var iTop=0;while(oNode.tagName!='HTML'){iTop+=oNode.offsetTop||0;if(oNode.offsetParent){oNode=oNode.offsetParent;}
else{break;}}
return iTop;}
function getLeft(element){var oNode=element;var iLeft=0;while(oNode.tagName!='HTML'){iLeft+=oNode.offsetLeft||0;if(oNode.offsetParent){oNode=oNode.offsetParent;}
else{break;}}
return iLeft;}
function update_events(cal,year,month){$('ifr_event_list').src=BLOGPATH+"events/iframe/"+year+"/"+(Number(month)+1)+"/"
AJAX=new sack(BLOGPATH+"events/calendar/"+year+"/"+(Number(month)+1)+"/");AJAX.setVar("Year",year);AJAX.setVar("Month",(month));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_datos=AJAX.response.split("|");if(v_datos.length>1){dates=new Array();for(var i=1;i<v_datos.length;i++){v_datos[i]=v_datos[i].split("&");v_fecha=v_datos[i][1].split("-");v_fecha[2]=v_fecha[2].split(" ")[0]
var d=new Date(v_fecha[0],(v_fecha[1]-1),v_fecha[2]);d.href=v_datos[i][2];d.title=v_datos[i][0];dates[i-1]=d;}
cal.selectDates(dates,true,true,true);}}
AJAX.runAJAX();}
function calendar_open(id,callback)
{if(!$(id)["calendar"]){var obj=new Object();obj.minDate=new Date(1970,0,1);$(id)["calendar"]=new Epoch('cal_'+id,'popup',$(id),false,obj);$("cal_"+id+"_calendar").style.width="200px";$(id)["calendar"].click_cell=function(click_date)
{$(id)["calendar"].hide();callback(click_date);}}
if($F(id)){var arr_date=$F(id).split(" ");arr_date=arr_date[0].split("-");var id_date=new Date(arr_date[0],(arr_date[1]-1),arr_date[2]);$(id)["calendar"].selectDates([id_date],true,true,true);}
$(id)["calendar"].show();}
function runSWF(archivo,ancho,alto,version,bgcolor,id,menu,FlashVars,quality,allowScriptAccess,wMode){if(version!="")var version_data=version;else var version_data="6,0,0,0";if(menu!="")menu_data=menu;else menu_data=false;if(bgcolor!="")var bgcolor_data=bgcolor;else var bgcolor_data="#FFFFFF";if(id!="")id_data=id;else id_data="flashMovie";if(quality!="")quality_data=quality;else quality_data="high";if(allowScriptAccess!="")allowScriptAccess_data=allowScriptAccess;else allowScriptAccess_data="always";if(wMode!="")wmode_data=wMode;else wmode_data="";var quality="high";document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase= "http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version= '+version_data+'" width='+ancho+' height='+alto+' id='+id_data+'>\n');document.write('<param name="movie" value='+archivo+'>\n');document.write('<param name= "allowScriptAccess" value= '+allowScriptAccess_data+'>\n');document.write('<param name="quality" value='+quality_data+'>\n');document.write('<param name="FlashVars" value='+FlashVars+'>\n');document.write('<param name="bgcolor" value='+bgcolor_data+'>\n');document.write('<param name="menu" value='+menu_data+' >\n');document.write('<param name="wmode" value='+wmode_data+' >\n');document.write('<embed src='+archivo+' bgcolor='+bgcolor_data+' FlashVars='+FlashVars+' menu='+menu_data+' allowScriptAccess='+allowScriptAccess_data+' quality='+quality_data+' wmode='+wmode_data+' pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width='+ancho+' height='+alto+' swLiveConnect=true name='+id_data+'></embed>');document.write('</object>\n');}
var id_cont=0;function isIE(){var strBrowser=navigator.userAgent.toLowerCase();return(strBrowser.indexOf("msie")>-1&&strBrowser.indexOf("mac")<0);}
function startFix(){if(isIE()){document.write('<div style="display: none;" id="flash_div_'+id_cont+'">');}}
function endFix(){if(isIE()){document.write('</div>');document.getElementById('flash_div_'+id_cont).outerHTML=document.getElementById('flash_div_'+id_cont).innerHTML;id_cont++;}}
function getFlashMovieObject(movieName)
{if(window.document[movieName])
{return window.document[movieName];}
if(navigator.appName.indexOf("Microsoft Internet")==-1)
{if(document.embeds&&document.embeds[movieName])
return document.embeds[movieName];}
else
{return document.getElementById(movieName);}}
var hs={lang:{cssDirection:'ltr',loadingText:'Loading...',loadingTitle:'Click to cancel',focusTitle:'Click to bring to front',fullExpandTitle:'Expand to actual size (f)',creditsText:'',creditsTitle:'Go to the Highslide JS homepage',restoreTitle:'Click to close image, click and drag to move. Use arrow keys for next and previous.'},graphicsDir:PATH+'_include/js/highslide/graphics/',expandCursor:'zoomin.cur',restoreCursor:'zoomout.cur',expandDuration:250,restoreDuration:250,marginLeft:15,marginRight:15,marginTop:15,marginBottom:15,zIndexCounter:1001,loadingOpacity:0.75,allowMultipleInstances:true,numberOfImagesToPreload:5,outlineWhileAnimating:2,outlineStartOffset:3,padToMinWidth:false,fullExpandPosition:'bottom right',fullExpandOpacity:1,showCredits:false,creditsHref:'',enableKeyListener:true,openerTagNames:['a'],dragByHeading:true,minWidth:520,minHeight:400,allowSizeReduction:true,outlineType:'drop-shadow',wrapperClassName:'highslide-wrapper',preloadTheseImages:[],continuePreloading:true,expanders:[],overrides:['allowSizeReduction','useBox','outlineType','outlineWhileAnimating','captionId','captionText','captionEval','captionOverlay','headingId','headingText','headingEval','headingOverlay','dragByHeading','width','height','wrapperClassName','minWidth','minHeight','maxWidth','maxHeight','slideshowGroup','easing','easingClose','fadeInOut','src'],overlays:[],idCounter:0,oPos:{x:['leftpanel','left','center','right','rightpanel'],y:['above','top','middle','bottom','below']},mouse:{},headingOverlay:{},captionOverlay:{},faders:[],pendingOutlines:{},clones:{},ie:(document.all&&!window.opera),safari:/Safari/.test(navigator.userAgent),geckoMac:/Macintosh.+rv:1\.[0-8].+Gecko/.test(navigator.userAgent),$:function(id){return document.getElementById(id);},push:function(arr,val){arr[arr.length]=val;},createElement:function(tag,attribs,styles,parent,nopad){var el=document.createElement(tag);if(attribs)hs.setAttribs(el,attribs);if(nopad)hs.setStyles(el,{padding:0,border:'none',margin:0});if(styles)hs.setStyles(el,styles);if(parent)parent.appendChild(el);return el;},setAttribs:function(el,attribs){for(var x in attribs)el[x]=attribs[x];},setStyles:function(el,styles){for(var x in styles){if(hs.ie&&x=='opacity'){if(styles[x]>0.99)el.style.removeAttribute('filter');else el.style.filter='alpha(opacity='+(styles[x]*100)+')';}
else el.style[x]=styles[x];}},ieVersion:function(){var arr=navigator.appVersion.split("MSIE");return arr[1]?parseFloat(arr[1]):null;},getPageSize:function(){var d=document,w=window,iebody=d.compatMode&&d.compatMode!='BackCompat'?d.documentElement:d.body;var width=hs.ie?iebody.clientWidth:(d.documentElement.clientWidth||self.innerWidth),height=hs.ie?iebody.clientHeight:self.innerHeight;return{width:width,height:height,scrollLeft:hs.ie?iebody.scrollLeft:pageXOffset,scrollTop:hs.ie?iebody.scrollTop:pageYOffset}},getPosition:function(el){var p={x:el.offsetLeft,y:el.offsetTop};while(el.offsetParent){el=el.offsetParent;p.x+=el.offsetLeft;p.y+=el.offsetTop;if(el!=document.body&&el!=document.documentElement){p.x-=el.scrollLeft;p.y-=el.scrollTop;}}
return p;},expand:function(a,params,custom,type){if(!a)a=hs.createElement('a',null,{display:'none'},hs.container);if(typeof a.getParams=='function')return params;try{new hs.Expander(a,params,custom);return false;}catch(e){return true;}},focusTopmost:function(){var topZ=0,topmostKey=-1;for(var i=0;i<hs.expanders.length;i++){if(hs.expanders[i]){if(hs.expanders[i].wrapper.style.zIndex&&hs.expanders[i].wrapper.style.zIndex>topZ){topZ=hs.expanders[i].wrapper.style.zIndex;topmostKey=i;}}}
if(topmostKey==-1)hs.focusKey=-1;else hs.expanders[topmostKey].focus();},getParam:function(a,param){a.getParams=a.onclick;var p=a.getParams?a.getParams():null;a.getParams=null;return(p&&typeof p[param]!='undefined')?p[param]:(typeof hs[param]!='undefined'?hs[param]:null);},getSrc:function(a){var src=hs.getParam(a,'src');if(src)return src;return a.href;},getNode:function(id){var node=hs.$(id),clone=hs.clones[id],a={};if(!node&&!clone)return null;if(!clone){clone=node.cloneNode(true);clone.id='';hs.clones[id]=clone;return node;}else{return clone.cloneNode(true);}},discardElement:function(d){hs.garbageBin.appendChild(d);hs.garbageBin.innerHTML='';},transit:function(adj,exp){hs.last=exp=exp||hs.getExpander();try{hs.upcoming=adj;adj.onclick();}catch(e){hs.last=hs.upcoming=null;}
try{exp.close();}catch(e){}
return false;},previousOrNext:function(el,op){var exp=hs.getExpander(el),adj=exp.getAdjacentAnchor(op);return hs.transit(adj,exp);},previous:function(el){return hs.previousOrNext(el,-1);},next:function(el){return hs.previousOrNext(el,1);},keyHandler:function(e){if(!e)e=window.event;if(!e.target)e.target=e.srcElement;if(typeof e.target.form!='undefined')return true;var exp=hs.getExpander();var op=null;switch(e.keyCode){case 70:if(exp)exp.doFullExpand();return true;case 32:case 34:case 39:case 40:op=1;break;case 8:case 33:case 37:case 38:op=-1;break;case 27:case 13:op=0;}
if(op!==null){hs.removeEventListener(document,window.opera?'keypress':'keydown',hs.keyHandler);if(!hs.enableKeyListener)return true;if(e.preventDefault)e.preventDefault();else e.returnValue=false;if(exp){if(op==0){exp.close();}else{hs.previousOrNext(exp.key,op);}
return false;}}
return true;},registerOverlay:function(overlay){hs.push(hs.overlays,overlay);},getWrapperKey:function(element,expOnly){var el,re=/^highslide-wrapper-([0-9]+)$/;el=element;while(el.parentNode){if(el.id&&re.test(el.id))return el.id.replace(re,"$1");el=el.parentNode;}
if(!expOnly){el=element;while(el.parentNode){if(el.tagName&&hs.isHsAnchor(el)){for(var key=0;key<hs.expanders.length;key++){var exp=hs.expanders[key];if(exp&&exp.a==el)return key;}}
el=el.parentNode;}}
return null;},getExpander:function(el,expOnly){if(typeof el=='undefined')return hs.expanders[hs.focusKey]||null;if(typeof el=='number')return hs.expanders[el]||null;if(typeof el=='string')el=hs.$(el);return hs.expanders[hs.getWrapperKey(el,expOnly)]||null;},isHsAnchor:function(a){return(a.onclick&&a.onclick.toString().replace(/\s/g,' ').match(/hs.(htmlE|e)xpand/));},reOrder:function(){for(var i=0;i<hs.expanders.length;i++)
if(hs.expanders[i]&&hs.expanders[i].isExpanded)hs.focusTopmost();},mouseClickHandler:function(e)
{if(!e)e=window.event;if(e.button>1)return true;if(!e.target)e.target=e.srcElement;var el=e.target;while(el.parentNode&&!(/highslide-(image|move|html|resize)/.test(el.className)))
{el=el.parentNode;}
var exp=hs.getExpander(el);if(exp&&(exp.isClosing||!exp.isExpanded))return true;if(exp&&e.type=='mousedown'){if(e.target.form)return true;var match=el.className.match(/highslide-(image|move|resize)/);if(match){hs.dragArgs={exp:exp,type:match[1],left:exp.x.pos,width:exp.x.size,top:exp.y.pos,height:exp.y.size,clickX:e.clientX,clickY:e.clientY};hs.addEventListener(document,'mousemove',hs.dragHandler);if(e.preventDefault)e.preventDefault();if(/highslide-(image|html)-blur/.test(exp.content.className)){exp.focus();hs.hasFocused=true;}
return false;}}else if(e.type=='mouseup'){hs.removeEventListener(document,'mousemove',hs.dragHandler);if(hs.dragArgs){if(hs.styleRestoreCursor&&hs.dragArgs.type=='image')
hs.dragArgs.exp.content.style.cursor=hs.styleRestoreCursor;var hasDragged=hs.dragArgs.hasDragged;if(!hasDragged&&!hs.hasFocused&&!/(move|resize)/.test(hs.dragArgs.type)){exp.close();}
else if(hasDragged||(!hasDragged&&hs.hasHtmlExpanders)){hs.dragArgs.exp.doShowHide('hidden');}
hs.hasFocused=false;hs.dragArgs=null;}else if(/highslide-image-blur/.test(el.className)){el.style.cursor=hs.styleRestoreCursor;}}
return false;},dragHandler:function(e)
{if(!hs.dragArgs)return true;if(!e)e=window.event;var a=hs.dragArgs,exp=a.exp;a.dX=e.clientX-a.clickX;a.dY=e.clientY-a.clickY;var distance=Math.sqrt(Math.pow(a.dX,2)+Math.pow(a.dY,2));if(!a.hasDragged)a.hasDragged=(a.type!='image'&&distance>0)||(distance>(hs.dragSensitivity||5));if(a.hasDragged&&e.clientX>5&&e.clientY>5){if(a.type=='resize')exp.resize(a);else{exp.moveTo(a.left+a.dX,a.top+a.dY);if(a.type=='image')exp.content.style.cursor='move';}}
return false;},wrapperMouseHandler:function(e){try{if(!e)e=window.event;var over=/mouseover/i.test(e.type);if(!e.target)e.target=e.srcElement;if(hs.ie)e.relatedTarget=over?e.fromElement:e.toElement;var exp=hs.getExpander(e.target);if(!exp.isExpanded)return;if(!exp||!e.relatedTarget||hs.getExpander(e.relatedTarget,true)==exp||hs.dragArgs)return;for(var i=0;i<exp.overlays.length;i++){var o=hs.$('hsId'+exp.overlays[i]);if(o&&o.hideOnMouseOut){var from=over?0:o.opacity,to=over?o.opacity:0;hs.fade(o,from,to);}}}catch(e){}},addEventListener:function(el,event,func){try{el.addEventListener(event,func,false);}catch(e){try{el.detachEvent('on'+event,func);el.attachEvent('on'+event,func);}catch(e){el['on'+event]=func;}}},removeEventListener:function(el,event,func){try{el.removeEventListener(event,func,false);}catch(e){try{el.detachEvent('on'+event,func);}catch(e){el['on'+event]=null;}}},preloadFullImage:function(i){if(hs.continuePreloading&&hs.preloadTheseImages[i]&&hs.preloadTheseImages[i]!='undefined'){var img=document.createElement('img');img.onload=function(){img=null;hs.preloadFullImage(i+1);};img.src=hs.preloadTheseImages[i];}},preloadImages:function(number){if(number&&typeof number!='object')hs.numberOfImagesToPreload=number;var arr=hs.getAnchors();for(var i=0;i<arr.images.length&&i<hs.numberOfImagesToPreload;i++){hs.push(hs.preloadTheseImages,hs.getSrc(arr.images[i]));}
if(hs.outlineType)new hs.Outline(hs.outlineType,function(){hs.preloadFullImage(0)});else
hs.preloadFullImage(0);if(hs.restoreCursor)var cur=hs.createElement('img',{src:hs.graphicsDir+hs.restoreCursor});},init:function(){if(!hs.container){hs.container=hs.createElement('div',{className:'highslide-container'},{position:'absolute',left:0,top:0,width:'100%',zIndex:hs.zIndexCounter,direction:'ltr'},document.body,true);hs.loading=hs.createElement('a',{className:'highslide-loading',title:hs.lang.loadingTitle,innerHTML:hs.lang.loadingText,href:'javascript:;'},{position:'absolute',top:'-9999px',opacity:hs.loadingOpacity,zIndex:1},hs.container);hs.garbageBin=hs.createElement('div',null,{display:'none'},hs.container);Math.linearTween=function(t,b,c,d){return c*t/d+b;};Math.easeInQuad=function(t,b,c,d){return c*(t/=d)*t+b;};for(var x in hs.langDefaults){if(typeof hs[x]!='undefined')hs.lang[x]=hs[x];else if(typeof hs.lang[x]=='undefined'&&typeof hs.langDefaults[x]!='undefined')
hs.lang[x]=hs.langDefaults[x];}
hs.hideSelects=(hs.ie&&hs.ieVersion()<7);hs.hideIframes=((window.opera&&navigator.appVersion<9)||navigator.vendor=='KDE'||(hs.ie&&hs.ieVersion()<5.5));}},domReady:function(){hs.isDomReady=true;if(hs.onDomReady)hs.onDomReady();},updateAnchors:function(){var el,els,all=[],images=[],groups={},re;for(var i=0;i<hs.openerTagNames.length;i++){els=document.getElementsByTagName(hs.openerTagNames[i]);for(var j=0;j<els.length;j++){el=els[j];re=hs.isHsAnchor(el);if(re){hs.push(all,el);if(re[0]=='hs.expand')hs.push(images,el);var g=hs.getParam(el,'slideshowGroup')||'none';if(!groups[g])groups[g]=[];hs.push(groups[g],el);}}}
hs.anchors={all:all,groups:groups,images:images};return hs.anchors;},getAnchors:function(){return hs.anchors||hs.updateAnchors();},fade:function(el,o,oFinal,dur,fn,i,dir){if(typeof i=='undefined'){if(typeof dur!='number')dur=250;if(dur<25){hs.setStyles(el,{opacity:oFinal});if(fn)fn();return;}
i=hs.faders.length;dir=oFinal>o?1:-1;var step=(25/(dur-dur%25))*Math.abs(o-oFinal);}
o=parseFloat(o);var skip=(el.fade===0||el.fade===false||(el.fade==2&&hs.ie));el.style.visibility=((skip?oFinal:o)<=0)?'hidden':'visible';if(skip||o<0||(dir==1&&o>oFinal)){if(fn)fn();return;}
if(el.fading&&el.fading.i!=i){clearTimeout(hs.faders[el.fading.i]);o=el.fading.o;}
el.fading={i:i,o:o,step:(step||el.fading.step)};el.style.visibility=(o<=0)?'hidden':'visible';hs.setStyles(el,{opacity:o});hs.faders[i]=setTimeout(function(){hs.fade(el,o+el.fading.step*dir,oFinal,null,fn,i,dir);},25);},close:function(el){var exp=hs.getExpander(el);if(exp)exp.close();return false;}};hs.Outline=function(outlineType,onLoad){this.onLoad=onLoad;this.outlineType=outlineType;var v=hs.ieVersion(),tr;this.hasAlphaImageLoader=hs.ie&&v>=5.5&&v<7;if(!outlineType){if(onLoad)onLoad();return;}
hs.init();this.table=hs.createElement('table',{cellSpacing:0},{visibility:'hidden',position:'absolute',borderCollapse:'collapse',width:0},hs.container,true);var tbody=hs.createElement('tbody',null,null,this.table,1);this.td=[];for(var i=0;i<=8;i++){if(i%3==0)tr=hs.createElement('tr',null,{height:'auto'},tbody,true);this.td[i]=hs.createElement('td',null,null,tr,true);var style=i!=4?{lineHeight:0,fontSize:0}:{position:'relative'};hs.setStyles(this.td[i],style);}
this.td[4].className=outlineType+' highslide-outline';this.preloadGraphic();};hs.Outline.prototype={preloadGraphic:function(){var src=hs.graphicsDir+(hs.outlinesDir||"outlines/")+this.outlineType+".png";var appendTo=hs.safari?hs.container:null;this.graphic=hs.createElement('img',null,{position:'absolute',top:'-9999px'},appendTo,true);var pThis=this;this.graphic.onload=function(){pThis.onGraphicLoad();};this.graphic.src=src;},onGraphicLoad:function(){var o=this.offset=this.graphic.width/4,pos=[[0,0],[0,-4],[-2,0],[0,-8],0,[-2,-8],[0,-2],[0,-6],[-2,-2]],dim={height:(2*o)+'px',width:(2*o)+'px'};for(var i=0;i<=8;i++){if(pos[i]){if(this.hasAlphaImageLoader){var w=(i==1||i==7)?'100%':this.graphic.width+'px';var div=hs.createElement('div',null,{width:'100%',height:'100%',position:'relative',overflow:'hidden'},this.td[i],true);hs.createElement('div',null,{filter:"progid:DXImageTransform.Microsoft.AlphaImageLoader(sizingMethod=scale, src='"+this.graphic.src+"')",position:'absolute',width:w,height:this.graphic.height+'px',left:(pos[i][0]*o)+'px',top:(pos[i][1]*o)+'px'},div,true);}else{hs.setStyles(this.td[i],{background:'url('+this.graphic.src+') '+(pos[i][0]*o)+'px '+(pos[i][1]*o)+'px'});}
if(window.opera&&(i==3||i==5))
hs.createElement('div',null,dim,this.td[i],true);hs.setStyles(this.td[i],dim);}}
this.graphic=null;if(hs.pendingOutlines[this.outlineType])hs.pendingOutlines[this.outlineType].destroy();hs.pendingOutlines[this.outlineType]=this;if(this.onLoad)this.onLoad();},setPosition:function(exp,pos,vis){pos=pos||{x:exp.x.pos,y:exp.y.pos,w:exp.x.size+exp.x.p1+exp.x.p2,h:exp.y.size+exp.y.p1+exp.y.p2};if(vis)this.table.style.visibility=(pos.h>=4*this.offset)?'visible':'hidden';hs.setStyles(this.table,{left:(pos.x-this.offset)+'px',top:(pos.y-this.offset)+'px',width:(pos.w+2*(exp.x.cb+this.offset))+'px'});pos.w+=2*(exp.x.cb-this.offset);pos.h+=+2*(exp.y.cb-this.offset);hs.setStyles(this.td[4],{width:pos.w>=0?pos.w+'px':0,height:pos.h>=0?pos.h+'px':0});if(this.hasAlphaImageLoader)this.td[3].style.height=this.td[5].style.height=this.td[4].style.height;},destroy:function(hide){if(hide)this.table.style.visibility='hidden';else hs.discardElement(this.table);}};hs.Dimension=function(exp,dim){this.exp=exp;this.dim=dim;this.ucwh=dim=='x'?'Width':'Height';this.wh=this.ucwh.toLowerCase();this.uclt=dim=='x'?'Left':'Top';this.lt=this.uclt.toLowerCase();this.ucrb=dim=='x'?'Right':'Bottom';this.rb=this.ucrb.toLowerCase();this.p1=this.p2=0;};hs.Dimension.prototype={get:function(key){switch(key){case'loadingPos':return this.tpos+this.tb+(this.t-hs.loading['offset'+this.ucwh])/2;case'wsize':return this.size+2*this.cb+this.p1+this.p2;case'fitsize':return this.clientSize-this.marginMin-this.marginMax;case'opos':return this.pos-(this.exp.outline?this.exp.outline.offset:0);case'osize':return this.get('wsize')+(this.exp.outline?2*this.exp.outline.offset:0);case'imgPad':return this.imgSize?Math.round((this.size-this.imgSize)/2):0;}},calcBorders:function(){this.cb=(this.exp.content['offset'+this.ucwh]-this.t)/2;this.marginMax=hs['margin'+this.ucrb]+2*this.cb;},calcThumb:function(){this.t=this.exp.el[this.wh]?parseInt(this.exp.el[this.wh]):this.exp.el['offset'+this.ucwh];this.tpos=this.exp.tpos[this.dim];this.tb=(this.exp.el['offset'+this.ucwh]-this.t)/2;if(this.tpos==0){this.tpos=(hs.page[this.wh]/2)+hs.page['scroll'+this.uclt];};},calcExpanded:function(){var exp=this.exp;this.justify='auto';this.pos=this.tpos-this.cb+this.tb;this.size=Math.min(this.full,exp['max'+this.ucwh]||this.full);this.minSize=exp.allowSizeReduction?Math.min(exp['min'+this.ucwh],this.full):this.full;if(exp.useBox){this.size=exp[this.wh];this.imgSize=this.full;}
if(this.dim=='x'&&hs.padToMinWidth)this.minSize=exp.minWidth;this.marginMin=hs['margin'+this.uclt];this.scroll=hs.page['scroll'+this.uclt];this.clientSize=hs.page[this.wh];},setSize:function(i){var exp=this.exp;if(exp.isImage&&(exp.useBox||hs.padToMinWidth)){this.imgSize=i;this.size=Math.max(this.size,this.imgSize);exp.content.style[this.lt]=this.get('imgPad')+'px';}else
this.size=i;exp.content.style[this.wh]=i+'px';exp.wrapper.style[this.wh]=this.get('wsize')+'px';if(exp.outline)exp.outline.setPosition(exp);if(this.dim=='x'&&exp.overlayBox)exp.sizeOverlayBox(true);},setPos:function(i){this.pos=i;this.exp.wrapper.style[this.lt]=i+'px';if(this.exp.outline)this.exp.outline.setPosition(this.exp);}};hs.Expander=function(a,params,custom,contentType){if(document.readyState&&hs.ie&&!hs.isDomReady){hs.onDomReady=function(){new hs.Expander(a,params,custom,contentType);};return;}
this.a=a;this.custom=custom;this.contentType=contentType||'image';this.isImage=!this.isHtml;hs.continuePreloading=false;this.overlays=[];hs.init();var key=this.key=hs.expanders.length;for(var i=0;i<hs.overrides.length;i++){var name=hs.overrides[i];this[name]=params&&typeof params[name]!='undefined'?params[name]:hs[name];}
if(!this.src)this.src=a.href;var el=(params&&params.thumbnailId)?hs.$(params.thumbnailId):a;el=this.thumb=el.getElementsByTagName('img')[0]||el;this.thumbsUserSetId=el.id||a.id;for(var i=0;i<hs.expanders.length;i++){if(hs.expanders[i]&&hs.expanders[i].a==a){hs.expanders[i].focus();return false;}}
for(var i=0;i<hs.expanders.length;i++){if(hs.expanders[i]&&hs.expanders[i].thumb!=el&&!hs.expanders[i].onLoadStarted){hs.expanders[i].cancelLoading();}}
hs.expanders[this.key]=this;if(!hs.allowMultipleInstances&&!hs.upcoming){if(hs.expanders[key-1])hs.expanders[key-1].close();if(typeof hs.focusKey!='undefined'&&hs.expanders[hs.focusKey])
hs.expanders[hs.focusKey].close();}
this.el=el;this.tpos=hs.getPosition(el);hs.page=hs.getPageSize();var x=this.x=new hs.Dimension(this,'x');x.calcThumb();var y=this.y=new hs.Dimension(this,'y');y.calcThumb();this.wrapper=hs.createElement('div',{id:'highslide-wrapper-'+this.key,className:this.wrapperClassName},{visibility:'hidden',position:'absolute',zIndex:hs.zIndexCounter++},null,true);this.wrapper.onmouseover=this.wrapper.onmouseout=hs.wrapperMouseHandler;if(this.contentType=='image'&&this.outlineWhileAnimating==2)
this.outlineWhileAnimating=0;if(!this.outlineType){this[this.contentType+'Create']();}else if(hs.pendingOutlines[this.outlineType]){this.connectOutline();this[this.contentType+'Create']();}else{this.showLoading();var exp=this;new hs.Outline(this.outlineType,function(){exp.connectOutline();exp[exp.contentType+'Create']();});}
return true;};hs.Expander.prototype={connectOutline:function(){var o=this.outline=hs.pendingOutlines[this.outlineType];o.table.style.zIndex=this.wrapper.style.zIndex;hs.pendingOutlines[this.outlineType]=null;},showLoading:function(){if(this.onLoadStarted||this.loading)return;this.loading=hs.loading;var exp=this;this.loading.onclick=function(){exp.cancelLoading();};var exp=this,l=this.x.get('loadingPos')+'px',t=this.y.get('loadingPos')+'px';setTimeout(function(){if(exp.loading)hs.setStyles(exp.loading,{left:l,top:t,zIndex:hs.zIndexCounter++})},100);},imageCreate:function(){var exp=this;var img=document.createElement('img');this.content=img;img.onload=function(){if(hs.expanders[exp.key])exp.contentLoaded();};if(hs.blockRightClick)img.oncontextmenu=function(){return false;};img.className='highslide-image';hs.setStyles(img,{visibility:'hidden',display:'block',position:'absolute',maxWidth:'9999px',zIndex:3});img.title=hs.lang.restoreTitle;if(hs.safari)hs.container.appendChild(img);if(hs.ie&&hs.flushImgSize)img.src=null;img.src=this.src;this.showLoading();},contentLoaded:function(){try{if(!this.content)return;this.content.onload=null;if(this.onLoadStarted)return;else this.onLoadStarted=true;var x=this.x,y=this.y;if(this.loading){hs.setStyles(this.loading,{top:'-9999px'});this.loading=null;}
hs.setStyles(this.wrapper,{left:x.tpos+'px',top:y.tpos+'px'});x.full=this.content.width;y.full=this.content.height;hs.setStyles(this.content,{width:this.x.t+'px',height:this.y.t+'px'});this.wrapper.appendChild(this.content);hs.container.appendChild(this.wrapper);x.calcBorders();y.calcBorders();this.getOverlays();var ratio=x.full/y.full;x.calcExpanded();this.justify(x);y.calcExpanded();this.justify(y);if(this.overlayBox)this.sizeOverlayBox(0,1);if(this.allowSizeReduction){this.correctRatio(ratio);if(this.isImage&&this.x.full>(this.x.imgSize||this.x.size)){this.createFullExpand();if(this.overlays.length==1)this.sizeOverlayBox();}}
this.show();}catch(e){window.location.href=this.src;}},justify:function(p,moveOnly){var tgtArr,tgt=p.target,dim=p==this.x?'x':'y';var hasMovedMin=false;var allowReduce=p.exp.allowSizeReduction;p.pos=Math.round(p.pos-((p.get('wsize')-p.t)/2));if(p.pos<p.scroll+p.marginMin){p.pos=p.scroll+p.marginMin;hasMovedMin=true;}
if(!moveOnly&&p.size<p.minSize){p.size=p.minSize;allowReduce=false;}
if(p.pos+p.get('wsize')>p.scroll+p.clientSize-p.marginMax){if(!moveOnly&&hasMovedMin&&allowReduce){p.size=p.get('fitsize')-2*p.cb-p.p1-p.p2;}else if(p.get('wsize')<p.get('fitsize')){p.pos=p.scroll+p.clientSize-p.marginMax-p.get('wsize');}else{p.pos=p.scroll+p.marginMin;if(!moveOnly&&allowReduce)p.size=p.get('fitsize')-2*p.cb-p.p1-p.p2;}}
if(!moveOnly&&p.size<p.minSize){p.size=p.minSize;allowReduce=false;}
if(p.pos<p.marginMin){var tmpMin=p.pos;p.pos=p.marginMin;if(allowReduce&&!moveOnly)p.size=p.size-(p.pos-tmpMin);}},correctRatio:function(ratio){var x=this.x,y=this.y,changed=false,xSize=Math.min(x.full,x.size),ySize=Math.min(y.full,y.size),useBox=(this.useBox||hs.padToMinWidth);if(xSize/ySize>ratio){xSize=ySize*ratio;if(xSize<x.minSize){xSize=x.minSize;ySize=xSize/ratio;}
changed=true;}else if(xSize/ySize<ratio){ySize=xSize/ratio;changed=true;}
if(hs.padToMinWidth&&x.full<x.minSize){x.imgSize=x.full;y.size=y.imgSize=y.full;}else if(this.useBox){x.imgSize=xSize;y.imgSize=ySize;}else{x.size=xSize;y.size=ySize;}
this.fitOverlayBox(useBox?null:ratio);if(useBox&&y.size<y.imgSize){y.imgSize=y.size;x.imgSize=y.size*ratio;}
if(changed||useBox){x.pos=x.tpos-x.cb+x.tb;x.minSize=x.size;this.justify(x,true);y.pos=y.tpos-y.cb+y.tb;y.minSize=y.size;this.justify(y,true);if(this.overlayBox)this.sizeOverlayBox();}},fitOverlayBox:function(ratio){var x=this.x,y=this.y;if(this.overlayBox){while(y.size>this.minHeight&&x.size>this.minWidth&&y.get('wsize')>y.get('fitsize')){y.size-=10;if(ratio)x.size=y.size*ratio;this.sizeOverlayBox(0,1);}}},show:function(){this.doShowHide('hidden');this.changeSize(1,{xpos:this.x.tpos+this.x.tb-this.x.cb,ypos:this.y.tpos+this.y.tb-this.y.cb,xsize:this.x.t,ysize:this.y.t,xp1:0,xp2:0,yp1:0,yp2:0,ximgSize:this.x.t,ximgPad:0,yimgSize:this.y.t,yimgPad:0,o:hs.outlineStartOffset},{xpos:this.x.pos,ypos:this.y.pos,xsize:this.x.size,ysize:this.y.size,xp1:this.x.p1,yp1:this.y.p1,xp2:this.x.p2,yp2:this.y.p2,ximgSize:this.x.imgSize,ximgPad:this.x.get('imgPad'),yimgSize:this.y.imgSize,yimgPad:this.y.get('imgPad'),o:this.outline?this.outline.offset:0},hs.expandDuration);},changeSize:function(up,from,to,dur){if(this.outline&&!this.outlineWhileAnimating){if(up)this.outline.setPosition(this);else this.outline.destroy();}
if(!up&&this.overlayBox){hs.discardElement(this.overlayBox);}
if(this.fadeInOut){from.op=up?0:1;to.op=up;}
var t,exp=this,easing=Math[this.easing]||Math.easeInQuad,steps=(up?hs.expandSteps:hs.restoreSteps)||parseInt(dur/25)||1;if(!up)easing=Math[this.easingClose]||easing;for(var i=1;i<=steps;i++){t=Math.round(i*(dur/steps));(function(){var pI=i,size={};for(var x in from){size[x]=easing(t,from[x],to[x]-from[x],dur);if(isNaN(size[x]))size[x]=to[x];if(!/^op$/.test(x))size[x]=Math.round(size[x]);}
setTimeout(function(){if(up&&pI==1){exp.content.style.visibility='visible';exp.a.className+=' highslide-active-anchor';}
exp.setSize(size);},t);})();}
if(up){setTimeout(function(){if(exp.outline)exp.outline.table.style.visibility="visible";},t);setTimeout(function(){exp.afterExpand();},t+50);}
else setTimeout(function(){exp.afterClose();},t);},setSize:function(to){try{if(to.op)hs.setStyles(this.wrapper,{opacity:to.op});hs.setStyles(this.wrapper,{width:(to.xsize+to.xp1+to.xp2+
2*this.x.cb)+'px',height:(to.ysize+to.yp1+to.yp2+
2*this.y.cb)+'px',left:to.xpos+'px',top:to.ypos+'px'});hs.setStyles(this.content,{left:(to.xp1+to.ximgPad)+'px',top:(to.yp1+to.yimgPad)+'px',width:(to.ximgSize||to.xsize)+'px',height:(to.yimgSize||to.ysize)+'px'});if(this.outline&&this.outlineWhileAnimating){var o=this.outline.offset-to.o;this.outline.setPosition(this,{x:to.xpos+o,y:to.ypos+o,w:to.xsize+to.xp1+to.xp2+-2*o,h:to.ysize+to.yp1+to.yp2+-2*o},1);}
this.wrapper.style.visibility='visible';}catch(e){window.location.href=this.src;}},afterExpand:function(){this.isExpanded=true;this.focus();this.prepareNextOutline();var p=hs.page,mX=hs.mouse.x+p.scrollLeft,mY=hs.mouse.y+p.scrollTop;this.mouseIsOver=this.x.pos<mX&&mX<this.x.pos+this.x.get('wsize')&&this.y.pos<mY&&mY<this.y.pos+this.y.get('wsize');if(this.overlayBox)this.showOverlays();},prepareNextOutline:function(){var key=this.key;var outlineType=this.outlineType;new hs.Outline(outlineType,function(){try{hs.expanders[key].preloadNext();}catch(e){}});},preloadNext:function(){var next=this.getAdjacentAnchor(1);if(next&&next.onclick.toString().match(/hs\.expand/))
var img=hs.createElement('img',{src:hs.getSrc(next)});},getAdjacentAnchor:function(op){var current=this.getAnchorIndex(),as=hs.anchors.groups[this.slideshowGroup||'none'];if(!as[current+op]&&this.slideshow&&this.slideshow.repeat){if(op==1)return as[0];else if(op==-1)return as[as.length-1];}
return as[current+op]||null;},getAnchorIndex:function(){var arr=hs.anchors.groups[this.slideshowGroup||'none'];for(var i=0;i<arr.length;i++){if(arr[i]==this.a)return i;}
return null;},cancelLoading:function(){hs.expanders[this.key]=null;if(this.loading)hs.loading.style.left='-9999px';},writeCredits:function(){this.credits=hs.createElement('a',{href:hs.creditsHref,className:'highslide-credits',innerHTML:hs.lang.creditsText,title:hs.lang.creditsTitle});this.createOverlay({overlayId:this.credits,position:'top left'});},getInline:function(types,addOverlay){for(var i=0;i<types.length;i++){var type=types[i],s=null;if(!this[type+'Id']&&this.thumbsUserSetId)
this[type+'Id']=type+'-for-'+this.thumbsUserSetId;if(this[type+'Id'])this[type]=hs.getNode(this[type+'Id']);if(!this[type]&&!this[type+'Text']&&this[type+'Eval'])try{s=eval(this[type+'Eval']);}catch(e){}
if(!this[type]&&this[type+'Text']){s=this[type+'Text'];}
if(!this[type]&&!s){var next=this.a.nextSibling;while(next&&!hs.isHsAnchor(next)){if((new RegExp('highslide-'+type)).test(next.className||null)){this[type]=next.cloneNode(1);break;}
next=next.nextSibling;}}
if(!this[type]&&s)this[type]=hs.createElement('div',{className:'highslide-'+type,innerHTML:s});if(addOverlay&&this[type]){var o={position:(type=='heading')?'above':'below'};for(var x in this[type+'Overlay'])o[x]=this[type+'Overlay'][x];o.overlayId=this[type];this.createOverlay(o);}}},doShowHide:function(visibility){if(hs.hideSelects)this.showHideElements('SELECT',visibility);if(hs.hideIframes)this.showHideElements('IFRAME',visibility);if(hs.geckoMac)this.showHideElements('*',visibility);},showHideElements:function(tagName,visibility){var els=document.getElementsByTagName(tagName);var prop=tagName=='*'?'overflow':'visibility';for(var i=0;i<els.length;i++){if(prop=='visibility'||(document.defaultView.getComputedStyle(els[i],"").getPropertyValue('overflow')=='auto'||els[i].getAttribute('hidden-by')!=null)){var hiddenBy=els[i].getAttribute('hidden-by');if(visibility=='visible'&&hiddenBy){hiddenBy=hiddenBy.replace('['+this.key+']','');els[i].setAttribute('hidden-by',hiddenBy);if(!hiddenBy)els[i].style[prop]=els[i].origProp;}else if(visibility=='hidden'){var elPos=hs.getPosition(els[i]);elPos.w=els[i].offsetWidth;elPos.h=els[i].offsetHeight;var clearsX=(elPos.x+elPos.w<this.x.get('opos')||elPos.x>this.x.get('opos')+this.x.get('osize'));var clearsY=(elPos.y+elPos.h<this.y.get('opos')||elPos.y>this.y.get('opos')+this.y.get('osize'));var wrapperKey=hs.getWrapperKey(els[i]);if(!clearsX&&!clearsY&&wrapperKey!=this.key){if(!hiddenBy){els[i].setAttribute('hidden-by','['+this.key+']');els[i].origProp=els[i].style[prop];els[i].style[prop]='hidden';}else if(hiddenBy.indexOf('['+this.key+']')==-1){els[i].setAttribute('hidden-by',hiddenBy+'['+this.key+']');}}else if((hiddenBy=='['+this.key+']'||hs.focusKey==wrapperKey)&&wrapperKey!=this.key){els[i].setAttribute('hidden-by','');els[i].style[prop]=els[i].origProp||'';}else if(hiddenBy&&hiddenBy.indexOf('['+this.key+']')>-1){els[i].setAttribute('hidden-by',hiddenBy.replace('['+this.key+']',''));}}}}},focus:function(){this.wrapper.style.zIndex=hs.zIndexCounter++;for(var i=0;i<hs.expanders.length;i++){if(hs.expanders[i]&&i==hs.focusKey){var blurExp=hs.expanders[i];blurExp.content.className+=' highslide-'+blurExp.contentType+'-blur';blurExp.content.style.cursor=hs.ie?'hand':'pointer';blurExp.content.title=hs.lang.focusTitle;}}
if(this.outline)this.outline.table.style.zIndex=this.wrapper.style.zIndex;this.content.className='highslide-'+this.contentType;this.content.title=hs.lang.restoreTitle;if(hs.restoreCursor){hs.styleRestoreCursor=window.opera?'pointer':'url('+hs.graphicsDir+hs.restoreCursor+'), pointer';if(hs.ie&&hs.ieVersion()<6)hs.styleRestoreCursor='hand';this.content.style.cursor=hs.styleRestoreCursor;}
hs.focusKey=this.key;hs.addEventListener(document,window.opera?'keypress':'keydown',hs.keyHandler);},moveTo:function(x,y){this.x.setPos(x);this.y.setPos(y);},resize:function(e){var w,h,r=e.width/e.height;w=Math.max(e.width+e.dX,Math.min(this.minWidth,this.x.full));if(this.isImage&&Math.abs(w-this.x.full)<12)w=this.x.full;h=w/r;if(h<Math.min(this.minHeight,this.y.full)){h=Math.min(this.minHeight,this.y.full);if(this.isImage)w=h*r;}
this.resizeTo(w,h);},resizeTo:function(w,h){this.y.setSize(h);this.x.setSize(w);},close:function(){if(this.isClosing||!this.isExpanded)return;this.isClosing=true;hs.removeEventListener(document,window.opera?'keypress':'keydown',hs.keyHandler);try{this.content.style.cursor='default';this.changeSize(0,{xpos:this.x.pos,ypos:this.y.pos,xsize:this.x.size,ysize:this.y.size,xp1:this.x.p1,yp1:this.y.p1,xp2:this.x.p2,yp2:this.y.p2,ximgSize:this.x.imgSize,ximgPad:this.x.get('imgPad'),yimgSize:this.y.imgSize,yimgPad:this.y.get('imgPad'),o:this.outline?this.outline.offset:0},{xpos:this.x.tpos-this.x.cb+this.x.tb,ypos:this.y.tpos-this.y.cb+this.y.tb,xsize:this.x.t,ysize:this.y.t,xp1:0,yp1:0,xp2:0,yp2:0,ximgSize:this.x.imgSize?this.x.t:null,ximgPad:0,yimgSize:this.y.imgSize?this.y.t:null,yimgPad:0,o:hs.outlineStartOffset},hs.restoreDuration);}catch(e){this.afterClose();}},createOverlay:function(o){var el=o.overlayId;if(typeof el=='string')el=hs.getNode(el);if(!el||typeof el=='string')return;el.style.display='block';this.genOverlayBox();var width=o.width&&/^[0-9]+(px|%)$/.test(o.width)?o.width:'auto';if(/^(left|right)panel$/.test(o.position)&&!/^[0-9]+px$/.test(o.width))width='200px';var overlay=hs.createElement('div',{id:'hsId'+hs.idCounter++,hsId:o.hsId},{position:'absolute',visibility:'hidden',width:width,direction:hs.lang.cssDirection||''},this.overlayBox,true);overlay.appendChild(el);hs.setAttribs(overlay,{hideOnMouseOut:o.hideOnMouseOut,opacity:o.opacity||1,hsPos:o.position,fade:o.fade});if(this.gotOverlays){this.positionOverlay(overlay);if(!overlay.hideOnMouseOut||this.mouseIsOver)hs.fade(overlay,0,overlay.opacity);}
hs.push(this.overlays,hs.idCounter-1);},positionOverlay:function(overlay){var p=overlay.hsPos||'middle center';if(/left$/.test(p))overlay.style.left=0;if(/center$/.test(p))hs.setStyles(overlay,{left:'50%',marginLeft:'-'+Math.round(overlay.offsetWidth/2)+'px'});if(/right$/.test(p))overlay.style.right=0;if(/^leftpanel$/.test(p)){hs.setStyles(overlay,{right:'100%',marginRight:this.x.cb+'px',top:-this.y.cb+'px',bottom:-this.y.cb+'px',overflow:'auto'});this.x.p1=overlay.offsetWidth;}else if(/^rightpanel$/.test(p)){hs.setStyles(overlay,{left:'100%',marginLeft:this.x.cb+'px',top:-this.y.cb+'px',bottom:-this.y.cb+'px',overflow:'auto'});this.x.p2=overlay.offsetWidth;}
if(/^top/.test(p))overlay.style.top=0;if(/^middle/.test(p))hs.setStyles(overlay,{top:'50%',marginTop:'-'+Math.round(overlay.offsetHeight/2)+'px'});if(/^bottom/.test(p))overlay.style.bottom=0;if(/^above$/.test(p)){hs.setStyles(overlay,{left:(-this.x.p1-this.x.cb)+'px',right:(-this.x.p2-this.x.cb)+'px',bottom:'100%',marginBottom:this.y.cb+'px',width:'auto'});this.y.p1=overlay.offsetHeight;}else if(/^below$/.test(p)){hs.setStyles(overlay,{position:'relative',left:(-this.x.p1-this.x.cb)+'px',right:(-this.x.p2-this.x.cb)+'px',top:'100%',marginTop:this.y.cb+'px',width:'auto'});this.y.p2=overlay.offsetHeight;overlay.style.position='absolute';}},getOverlays:function(){this.getInline(['heading','caption'],true);if(this.heading&&this.dragByHeading)this.heading.className+=' highslide-move';if(hs.showCredits)this.writeCredits();for(var i=0;i<hs.overlays.length;i++){var o=hs.overlays[i],tId=o.thumbnailId,sg=o.slideshowGroup;if((!tId&&!sg)||(tId&&tId==this.thumbsUserSetId)||(sg&&sg===this.slideshowGroup)){this.createOverlay(o);}}
var os=[];for(var i=0;i<this.overlays.length;i++){var o=hs.$('hsId'+this.overlays[i]);if(/panel$/.test(o.hsPos))this.positionOverlay(o);else hs.push(os,o);}
for(var i=0;i<os.length;i++)this.positionOverlay(os[i]);this.gotOverlays=true;},genOverlayBox:function(){if(!this.overlayBox)this.overlayBox=hs.createElement('div',{className:this.wrapperClassName},{position:'absolute',width:this.x.size?this.x.size+'px':this.x.full+'px',height:0,visibility:'hidden',overflow:'hidden',zIndex:hs.ie?4:null},hs.container,true);},sizeOverlayBox:function(doWrapper,doPanels){hs.setStyles(this.overlayBox,{width:this.x.size+'px',height:this.y.size+'px'});if(doWrapper||doPanels){for(var i=0;i<this.overlays.length;i++){var o=hs.$('hsId'+this.overlays[i]);var ie6=(hs.ie&&(hs.ieVersion()<=6||document.compatMode=='BackCompat'));if(o&&/^(above|below)$/.test(o.hsPos)){if(ie6){o.style.width=(this.overlayBox.offsetWidth+2*this.x.cb
+this.x.p1+this.x.p2)+'px';}
this.y[o.hsPos=='above'?'p1':'p2']=o.offsetHeight;}
if(o&&ie6&&/^(left|right)panel$/.test(o.hsPos)){o.style.height=(this.overlayBox.offsetHeight+2*this.y.cb
+this.y.p1+this.y.p2)+'px';}}}
if(doWrapper){hs.setStyles(this.content,{top:this.y.p1+'px'});hs.setStyles(this.overlayBox,{top:(this.y.p1+this.y.cb)+'px'});}},showOverlays:function(){var b=this.overlayBox;b.className='';hs.setStyles(b,{top:(this.y.p1+this.y.cb)+'px',left:(this.x.p1+this.x.cb)+'px',overflow:'visible'});if(hs.safari)b.style.visibility='visible';this.wrapper.appendChild(b);for(var i=0;i<this.overlays.length;i++){var o=hs.$('hsId'+this.overlays[i]);o.style.zIndex=4;if(!o.hideOnMouseOut||this.mouseIsOver)hs.fade(o,0,o.opacity);}},createFullExpand:function(){this.fullExpandLabel=hs.createElement('a',{href:'javascript:hs.expanders['+this.key+'].doFullExpand();',title:hs.lang.fullExpandTitle,className:'highslide-full-expand'});this.createOverlay({overlayId:this.fullExpandLabel,position:hs.fullExpandPosition,hideOnMouseOut:true,opacity:hs.fullExpandOpacity});},doFullExpand:function(){try{if(this.fullExpandLabel)hs.discardElement(this.fullExpandLabel);this.focus();var xSize=this.x.size;this.resizeTo(this.x.full,this.y.full);var xpos=this.x.pos-(this.x.size-xSize)/2;if(xpos<hs.marginLeft)xpos=hs.marginLeft;this.moveTo(xpos,this.y.pos);this.doShowHide('hidden');}catch(e){window.location.href=this.content.src;}},afterClose:function(){this.a.className=this.a.className.replace('highslide-active-anchor','');this.doShowHide('visible');if(this.outline&&this.outlineWhileAnimating)this.outline.destroy();hs.discardElement(this.wrapper);hs.expanders[this.key]=null;hs.reOrder();}};if(document.readyState&&hs.ie){(function(){try{document.documentElement.doScroll('left');}catch(e){setTimeout(arguments.callee,50);return;}
hs.domReady();})();}
hs.langDefaults=hs.lang;var HsExpander=hs.Expander;hs.addEventListener(window,'load',function(){if(hs.expandCursor){var sel='.highslide img',dec='cursor: url('+hs.graphicsDir+hs.expandCursor+'), pointer !important;';var style=hs.createElement('style',{type:'text/css'},null,document.getElementsByTagName('HEAD')[0]);if(!hs.ie){style.appendChild(document.createTextNode(sel+" {"+dec+"}"));}else{var last=document.styleSheets[document.styleSheets.length-1];if(typeof(last.addRule)=="object")last.addRule(sel,dec);}}});hs.addEventListener(document,'mousemove',function(e){hs.mouse={x:e.clientX,y:e.clientY};});hs.addEventListener(document,'mousedown',hs.mouseClickHandler);hs.addEventListener(document,'mouseup',hs.mouseClickHandler);hs.addEventListener(window,'load',hs.preloadImages);
jQuery(document).ready(function()
{if(jQuery.query.get('add-trip'))blogs_trip_edit(0);});function embassy_search()
{var country_of=($F('country_of')>0)?$F('country_of'):'';var country_in=($F('country_in')>0)?$F('country_in'):'';var search=($F('embassy_search'))?urlencode($F('embassy_search')):'';gotoURL(PATH+"embassies-search/?p=1&country_of="+country_of+"&country_in="+country_in+"&search="+search);}
function airline_search()
{var low_cost_param=($('airline_low_cost').checked)?"1":"0";gotoURL(PATH+"airlines-search/?p=1&country_of="+$F('airline_country_of')+"&low_cost="+low_cost_param+"&airline_name="+$F('airline_search_name'));}
function airline_phone_filter()
{$('div_telephones_'+$F('airline_current_country')).hide();$('airline_current_country').value=$F('airline_id_world_country');$('div_telephones_'+$F('airline_current_country')).show();}
function airport_search()
{var is_important=($('is_important').checked)?"1":"0";gotoURL(PATH+"airports-search/?p=1&country_in="+$F('airport_country_in')+"&name="+urlencode($F('airport_search_name'))+"&iata="+urlencode($F('airport_search_iata'))+"&icao="+urlencode($F('airport_search_icao'))+"&is_important="+is_important);}
function ihtb_country_embassies_filter(id_world_country_in)
{var objParam={id_world_country_of:jQuery("#country_in").val(),id_world_country_in:id_world_country_in}
jQuery('#div_country_embassies_content').load(PATH+'modules/embassy/country_embassies.php',objParam);}
function search_embassy_list(p,search)
{new Ajax.Updater('embassy_list',PATH+"modules/embassy/ihtb_list.php?p="+p+"&search="+urlencode(search));}
function search_airline_list(p,search)
{new Ajax.Updater('airline_list',PATH+"modules/airline/ihtb_list.php?p="+p+"&search="+urlencode(search));}
function search_airport_list(p,search)
{new Ajax.Updater('airport_list',PATH+"modules/airport/ihtb_list.php?p="+p+"&search="+urlencode(search));}
function travel_tools_home()
{var id_world_country=$F('travel_tools_country');if(id_world_country>0){var world_name=$('travel_tools_country').options[$('travel_tools_country').selectedIndex]["text"];world_name=world_name.split(" ").join("-");var url_module="";switch($F('travel_tools_module')){case'event':url_module=PATH+"event-in/"+id_world_country+"_"+world_name+"/";break;case'embassy':url_module=PATH+"embassy-in/"+id_world_country+"_"+world_name+"/1/";break;case'airline':url_module=PATH+"airlines/?p=1&country_of="+id_world_country;break;case'airport':url_module=PATH+"airports-in/"+id_world_country+"_"+world_name+"/1/";break;}
window.location.href=url_module;}else{alert(MSG_MISSING_COUNTRY);}}
function arrowSwitch(element)
{if($(element).hasClassName('arrow_down')){$(element).toggleClassName('arrow_down');$(element).addClassName('arrow');}else{$(element).toggleClassName('arrow');$(element).addClassName('arrow_down');}}
function module_home_active(id_module_f,input)
{document.body.style.cursor="wait";var AJAX=new sack(PATH+"ajax/module_f_home_active/");AJAX.setVar('id_module_f',id_module_f);AJAX.setVar('active',(input.checked)?1:0);AJAX.setVar('PHPSESSID',PHPSESSID);AJAX.runAJAX();AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]!=1)alert("ERROR");document.body.style.cursor="";}}
function send_suggestion(sTableRef,iRefId,sField)
{var obj=new Object();obj.onComplete=function(){$('a_send_message').onclick=function(){send_suggestion_submit(sTableRef,iRefId,sField);}
$('sm_subject').focus();}
popUp(PATH+"html/tpl/send_suggestion_box.html",obj);}
function send_suggestion_submit(sTableRef,iRefId,sField)
{if(!document.sending){if(!$F('sm_message')){$('div_popup_box_msg').update(MSG_MISSING_MESSAGE);$('sm_message').focus();}else{var AJAX=new sack(PATH+"ajax/send_suggestion/");AJAX.setVar("table_ref",sTableRef);AJAX.setVar("id_ref",iRefId);AJAX.setVar("field",sField);AJAX.setVar("subject",urlencode($F('sm_subject')));AJAX.setVar("suggestion",urlencode($F('sm_message')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_popup_box_msg').update(MSG_SUCCESSFUL);setTimeout(function(){popUpBG(false);popUpRemove();},2000);}
document.sending=false;}
AJAX.runAJAX();document.sending=true;$('div_popup_box_msg').update(MSG_SENDING);}}else{$('div_popup_box_msg').update(MSG_WAIT);}}
function send_message(id_user1,id_user2)
{var obj=new Object();obj.onComplete=function(){$('a_send_message').onclick=function(){send_message_submit(id_user1,id_user2);}
$('sm_subject').focus();}
popUp(PATH+"html/tpl/send_message_box.html",obj);}
function send_message_submit(id_user1,id_user2)
{if(!document.sending){if(!$F('sm_message')){$('div_popup_box_msg').update(MSG_MISSING_MESSAGE);$('sm_message').focus();}else{var AJAX=new sack(PATH+"ajax/send_message/");AJAX.setVar("id_user1",id_user1);AJAX.setVar("id_user2",id_user2);AJAX.setVar("subject",text_encode($F('sm_subject')));AJAX.setVar("message",text_encode($F('sm_message')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_popup_box_msg').update(MSG_SUCCESSFUL);setTimeout(function(){popUpBG(false);popUpRemove();},2000);}
document.sending=false;}
AJAX.runAJAX();document.sending=true;$('div_popup_box_msg').update(MSG_SENDING);}}else{$('div_popup_box_msg').update(MSG_WAIT);}}
function add_to_my_blog(table,id)
{var AJAX=new sack(PATH+"ajax/add_to_my_blog/");AJAX.setVar("table",table);AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$("add_my_blog_"+table+"_"+id).update(MSG_ADDTMB_SUCCESS);popUp(PATH+"user/add_to_my_blog_success/?title="+v_data[1]+"&url="+v_data[2]);}else
if(v_data[0]==2){$("add_my_blog_"+table+"_"+id).update(MSG_ADDTMB_ALREADY);}else{alert(MSG_SERVER_ERROR)
$("add_my_blog_"+table+"_"+id).update();}}
AJAX.runAJAX();}
function search_input(e,str){if(e.keyCode==13)search_submit(str,'');}
function search_submit(str,type)
{if(str){str=urlencode(str);if(type){window.location.href=PATH+"search-"+type+"/"+str+"/";}else{window.location.href=PATH+"search/"+str+"/";}}}
function postLink(site,url)
{var book_url=site+((url)?url:window.location.href);window.open(book_url,"_blank");}
function feedback_show()
{document.location.href=PATH+'contact/';}
function feedback_submit()
{var div_msg=$('div_msg_feedback');if(!document.sending){if($('feedback_like').getValue()||$('feedback_not_like').getValue()||$RF('feedback_1')||$RF('feedback_2')||$RF('feedback_3')||$RF('feedback_4')||$RF('feedback_5')){var AJAX=new sack(PATH+"ajax/feedback_submit/");AJAX.setVar("item_1",($RF('feedback_1'))?$RF('feedback_1'):"");AJAX.setVar("item_2",($RF('feedback_2'))?$RF('feedback_2'):"")
AJAX.setVar("item_3",($RF('feedback_3'))?$RF('feedback_3'):"")
AJAX.setVar("item_4",($RF('feedback_4'))?$RF('feedback_4'):"")
AJAX.setVar("item_5",($RF('feedback_5'))?$RF('feedback_5'):"")
AJAX.setVar("like",$('feedback_like').getValue());AJAX.setVar("not_like",$('feedback_not_like').getValue());AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){div_msg.update(MSG_SUCCESSFUL);setTimeout(function(){popUpBG(false);popUpRemove();},2000);}else{div_msg.update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();document.sending=true;div_msg.update(MSG_SENDING);}else{div_msg.update(MSG_MISSING_DATA);}}else{div_msg.update(MSG_WAIT);}}
function ihtb_ask_location()
{popUp(PATH+"modules/location/window_location.php?mode=ask");}
function ihtb_ask_location_yes()
{ihtb_change_location_submit(false);}
function ihtb_ask_location_no()
{popUpRemove();popUpBG(false);ihtb_change_location();}
function ihtb_change_location()
{popUp(PATH+"modules/location/window_location.php?mode=change");}
function ihtb_change_location_submit(from_select)
{var div_msg=$('div_change_location_msg');if(!document.sending){var world_country_name="";if(from_select){world_country_name=$('id_world_country_change').options[$('id_world_country_change').selectedIndex].text;}else{world_country_name=$F('world_country_name');}
var AJAX=new sack(PATH+"modules/location/window_location_post.php");AJAX.setVar("world_country_name",world_country_name);AJAX.setVar("id_world_country",$F('id_world_country_change'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){div_msg.update(MSG_SUCCESSFUL);if(from_select&&user_login_redirect_url==""){setTimeout(function(){if(jQuery('#header_location_edit').size()){$('header_location_country').update("In "+world_country_name);}
popUpBG(false);popUpRemove();},2000);}else{user_login_redirect(user_login_redirect_url);}}else{div_msg.update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();document.sending=true;div_msg.update(MSG_SENDING);}else{div_msg.update(MSG_WAIT);}}
var ihtb_header_submenu_current='';function ihtb_header_menu_over(menu_item)
{if(ihtb_header_submenu_current){var submenu_current=jQuery('#submenu_'+ihtb_header_submenu_current);submenu_current.hide();clearInterval(submenu_current.attr('idCloseVal'));}
jQuery('#submenu_'+menu_item).show();ihtb_header_submenu_current=menu_item;}
function ihtb_header_menu_out(menu_item)
{var submenu_out=jQuery('#submenu_'+menu_item);var idCloseVal=setInterval(function(){clearInterval(submenu_out.attr('idCloseVal'));submenu_out.hide();ihtb_header_submenu_current='';},300);submenu_out.attr('idCloseVal',idCloseVal);}
function ihtb_country_guide_tab(id_world_zone)
{if(!jQuery.isReady||document.sending)return;document.sending=true;jQuery.each(jQuery('.country_guides_td'),function(){jQuery(this).removeClass('on');});jQuery.ajax({type:'POST',url:PATH+'_include/ajax/country_guides_tab.php',data:{id_world_zone:id_world_zone},success:function(response)
{jQuery('#country_guides_tab_content').html(response);jQuery('#country_guides_tab_'+id_world_zone).addClass('on');document.sending=false;}});}
function country_guides_tab_page(iPageNumb,iZoneId){var objData={p:iPageNumb,id_world_zone:iZoneId}
jQuery.ajax({type:'POST',async:false,url:PATH+'_include/ajax/country_guides_tab.php',data:objData,success:function(response)
{jQuery('#tdList').html(response);}});}
function qa_comment_spam(id_field,field,param_deprectated)
{var AJAX=new sack(PATH+"ajax/qacomment_spam/");AJAX.setVar('id_field',id_field);AJAX.setVar('field',field);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){$('div_comment_spam_'+id_field).hide();$('div_comment_nospam_'+id_field).show();}}
AJAX.runAJAX();}
function ihtb_info_qa_submit(field,id_field,id_question)
{if(!jQuery.isReady||document.sending)return;document.sending=true;var content=(id_question==0)?jQuery('#qa_enter_question').val():jQuery('#content_question_'+id_question).val();if(!content){return;}
var objData={field:field,id_field:id_field,id_question:id_question,content:urlencode(content)}
jQuery.ajax({type:'POST',url:PATH+'_include/ajax/info_qa_post.php',data:objData,success:function(response)
{jQuery('#div_info_qa_content').html(response);document.sending=false;}});}
function ihtb_info_tips_tricks_detail(module,id_module,id_category)
{popUp(PATH+"app/info_tips_tricks_detail.php?module="+module+"&id_module="+id_module+"&id_category="+id_category);}
function ihtb_travel_type_search()
{var travel_type_value=jQuery('#travel_type').val();var travel_type_name=jQuery('#travel_type option:selected').text();travel_type_name=url_optimize(travel_type_name);if(travel_type_value>0){window.location.href=PATH+'travel-type/'+travel_type_value+'_'+travel_type_name+'/';}else{show_js_alert(ALERT_ERROR,{message:MSG_MISSING_TRAVEL_TYPE});}}
function ihtb_city_favorite_add(id_world_city,id_user)
{jQuery.ajax({type:'GET',async:false,data:{id_world_city:id_world_city,id_user:id_user,action:'add'},url:PATH+'_include/ajax/city_favorite.php',success:function(response)
{show_js_alert(ALERT_OK,{message:MSG_CITY_ADDED});jQuery('#city_favorite_list').html(response);}});}
function ihtb_city_favorite_remove(id_world_city,id_user)
{jQuery.ajax({type:'GET',async:false,data:{id_world_city:id_world_city,id_user:id_user,action:'remove'},url:PATH+'_include/ajax/city_favorite.php',success:function(response)
{show_js_alert(ALERT_OK,{message:MSG_CITY_REMOVED});jQuery('#city_favorite_list').html(response);}});}
function ihtb_city_events_onchange()
{var id_world_city=jQuery('#id_world_city').val();var Year=jQuery('#event_year').val();var month=jQuery('#event_month').val();ihtb_city_events(id_world_city,Year,month,1);}
function ihtb_city_events(id_world_city,Y,m,p)
{jQuery.ajax({type:'GET',async:false,data:{id_world_city:id_world_city,Y:Y,m:m,p:p},url:PATH+'modules/events/city_events_ajax.php',success:function(response)
{jQuery('#events_list').html(response);}});}
function ihtb_travelers_find(search,p)
{jQuery.ajax({type:'GET',async:false,data:{q:urlencode(search),p:p},url:PATH+'_include/ajax/travelers_find_ajax.php',success:function(response)
{jQuery('#user_list').html(response);}});}
function ihtb_user_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_user_search.php',success:function(response)
{jQuery('#user_list').html(response);}});}
function ihtb_eat_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_eat_search.php',success:function(response)
{jQuery('#eat_list').html(response);}});}
function ihtb_party_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_party_search.php',success:function(response)
{jQuery('#party_list').html(response);}});}
function ihtb_sleep_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_sleep_search.php',success:function(response)
{jQuery('#sleep_list').html(response);}});}
function ihtb_event_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_event_search.php',success:function(response)
{jQuery('#event_list').html(response);}});}
function ihtb_embassy_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_embassy_search.php',success:function(response)
{jQuery('#embassy_list').html(response);}});}
function ihtb_airlines_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_airlines_search.php',success:function(response)
{jQuery('#airlines_list').html(response);}});}
function ihtb_airports_search(search,p)
{jQuery.ajax({type:'GET',async:false,data:{search:search,p:p},url:PATH+'_include/ajax/ihtb_airports_search.php',success:function(response)
{jQuery('#airports_list').html(response);}});}
function filter_num_flights(){$('airline_flights').disabled=true;$('from_to').disabled=true;var airline=$F('airline_names');var url=PATH+'app/ajax/filtrar_vuelos.php?airline='+airline;new Ajax.Request(url,{method:'post',onSuccess:function(transport){var results=transport.responseText.split("|");var cbo_vuelos=$('airline_flights');var length=cbo_vuelos.length;for(var x=length-1;x>=0;x--){cbo_vuelos.options[x]=null;}
if(results.length>=1){cbo_vuelos.options[0]=new Option('Select a Flight Number...','0');for(var i=1;i<=results.length;i++){cbo_vuelos.options[i]=new Option(results[i-1],results[i-1]);}
$('airline_flights').disabled=false;}}});}
function guardar_vuelo(){$('from_to').disabled=true;var airline=$F('airline_names');var vuelo=$F('airline_flights');var url=PATH+'app/ajax/guardar_vuelo.php?airline='+airline+'&vuelo='+vuelo;new Ajax.Request(url,{method:'post',onSuccess:function(transport){var results=transport.responseText.split("|");var cbo_vuelos=$('from_to');var length=cbo_vuelos.length;for(var x=length-1;x>=0;x--){cbo_vuelos.options[x]=null;}
if(results.length>=1){for(var i=0;i<results.length;i++){cbo_vuelos.options[i]=new Option(results[i],results[i]);}
$('from_to').disabled=false;}}});}
function goToURLFlight(){var airline=$F('airline_names');var vuelo=$F('airline_flights');var from_to=$F('from_to');var url=PATH+'app/ajax/armar_url_vuelos.php?airline='+airline+'&vuelo='+vuelo+'&fromto='+from_to;new Ajax.Request(url,{method:'post',onSuccess:function(transport){gotoURL(transport.responseText);}});}
function goToURLUSA(){var url=PATH+'app/ajax/armar_url_usa.php';new Ajax.Request(url,{method:'post',onSuccess:function(transport){gotoURL(transport.responseText);}});}
jQuery(document).ready(function(){if(jQuery.query.get('ask_location'))ihtb_ask_location();});function user_login_check(frm_login)
{if(!isEmail($F('login_email'))){$('login_msg').update(MSG_INVALID_EMAIL);$('login_email').focus();return false;}else
if(!$F('login_password')){$('login_msg').update(MSG_MISSING_PASSWORD);$('login_password').focus();return false;}else{return true;}}
var user_login_redirect_url="";function user_login()
{if(!document.sending){document.sending=true;document.body.style.cursor='wait';$('div_msg').update(MSG_SENDING);var AJAX=new sack(PATH+"ajax/user_login/");AJAX.setVar('email',$F('login_email'));AJAX.setVar('password',$F('login_password'));AJAX.setVar('remember',($F('login_remember'))?"1":"0");AJAX.setVar('PHPSESSID',PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){if(v_data[4]==1){user_login_redirect_url=v_data[2];ihtb_ask_location();}else{user_login_redirect(v_data[2]);}}else{$('div_msg').update(MSG_USER_PASS_INCORRECT);}
document.sending=false;document.body.style.cursor='';}
AJAX.runAJAX();}else{$('div_msg').update(MSG_WAIT);}}
function user_login_redirect(url)
{if(BLOGPATH){window.location.reload(false);}else{window.location.href=url;}}
function forgot_password()
{var obj=new Object();obj.onComplete=function()
{setAutoText('forgot_email');}
popUp(PATH+"user/forgot_password/",obj);}
function forgot_password_submit()
{if($F('forgot_email')==""||$F('forgot_email')==$('forgot_email').ini_text){$('forgot_div_msg').update(MSG_INVALID_EMAIL);$('forgot_email').focus();}else
if(!document.sending){var AJAX=new sack(PATH+"ajax/user_password_request/");AJAX.setVar('email',$F('forgot_email'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");$('forgot_div_msg').update(eval(v_data[2]));if(v_data[1]==1){$('div_btn_forgot_send').hide();$('div_btn_forgot_close').show();}
document.sending=false;}
AJAX.runAJAX();document.sending=true;$('forgot_div_msg').update(MSG_SENDING);}else $('forgot_div_msg').update(MSG_WAIT);}
function change_password()
{if($F('password')==""){$('div_change_password').update(MSG_MISSING_PASSWORD);$('password').focus();}else
if($F('password2')==""){$('div_change_password').update(MSG_MISSING_PASSWORD);$('password2').focus();}else
if($F('password')!=$F('password2')){$('div_change_password').update(MSG_PASSWORD_DONT_MATCH);$('password2').focus();}else
if(!document.sending){var AJAX=new sack(PATH+"ajax/user_password_request_change/");AJAX.setVar('password',$F('password'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){setTimeout(function(){window.location.href=urldecode(v_data[3]);},2000);}
$('div_change_password').update(eval(v_data[2]));document.sending=false;}
AJAX.runAJAX();document.sending=true;$('div_change_password').update(MSG_SENDING);}else $('div_change_password').update(MSG_WAIT);}
function user_change_password()
{if($F('password_1')==""){$('div_password_change_msg').update(MSG_MISSING_PASSWORD);$('password_1').focus();}else
if($F('password_new_1')==""){$('div_password_change_msg').update(MSG_MISSING_PASSWORD);$('password_new_1').focus();}else
if($F('password_new_2')==""){$('div_password_change_msg').update(MSG_MISSING_PASSWORD);$('password_new_2').focus();}else
if($F('password_new_1')!=$F('password_new_2')){$('div_password_change_msg').update(MSG_PASSWORD_DONT_MATCH);$('password_new_2').focus();}else
if(document.sending){$('div_password_change_msg').update(MSG_WAIT);}else{var AJAX=new sack(PATH+"ajax/user_password_change/");AJAX.setVar("password",$F('password_1'));AJAX.setVar("password_new",$F('password_new_1'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){$('password_1').value="";$('password_new_1').value="";$('password_new_2').value="";$('div_password_change_msg').update(MSG_USER_PASS_CHANGED);}else{$('div_password_change_msg').update(MSG_PASS_INCORRECT);$('password_1').focus();}
document.sending=false;}
AJAX.runAJAX();document.sending=true;$('div_password_change_msg').update(MSG_SENDING);}}
function login_show()
{popUp(PATH+"user/login_popup/");}
function login_hide()
{popUpRemove();popUpBG(false);}
var MSG_SENDING="Sending ...";var MSG_DELETING="Deleting ...";var MSG_DELETED="Data deleted!";var MSG_SERVER_ERROR="Server error, try again later";var MSG_WAIT="Wait please";var MSG_DATA_SAVED="Data saved!";var MSG_SUCCESSFUL="Successful";var MSG_ERROR="ERROR";var MSG_INVALID_DATE="Invalid date";var MSG_INVALID_EMAIL="Invalid email";var MSG_MISSING_MSG="Write something";var MSG_ARE_YOU_SURE="Are you sure you want to do this?";var MSG_PROFANITY="No profanity allowed"
var MSG_BLOG_NAME_EXISTS="Username already used! Try another one!";var MSG_BLOG_MISSING_NAME="Complete the username";var MSG_BLOG_BAD_NAME="The username must start with a letter, also only letters, numbers and '_' are allowed,";var MSG_EMAIL_ALREADY_REGISTERED="Email already registered";var MSG_ERROR_CAPTCHA="The verification code isn't correct";var MSG_PASSWORD_DONT_MATCH="The passwords don't match";var MSG_STEP1_SUCCESS="Step 1 successful";var MSG_USER_PASS_INCORRECT="User and/or password incorrect";var MSG_USER_PASS_CHANGED="Your password was sucessfully changed";var MSG_PASS_INCORRECT="Password incorrect";var MSG_EMAIL_NO_REGISTERED="Email not registered";var MSG_REGISTRATION_OK="Registration successful! Please check your mail for instructions";var MSG_EMAIL_FORGOT_SENDED="An email with instructions has been sent";var MSG_USER_DELETED="You account and all your data has been deleted!";var MSG_MISSING_DATA="Please complete";var MSG_MISSING_OPTION="You must select an option";var MSG_MISSING_AGREE_TERMS="You must agree with the terms and conditions";var MSG_MISSING_CAPTCHA="Complete the verification code";var MSG_MISSING_CODE="Complete the code";var MSG_MISSING_COUNTRY="Complete the country";var MSG_MISSING_CITY="Complete the city";var MSG_MISSING_DESCRIPTION="Complete the description";var MSG_MISSING_EMBED="Complete with the youtube url or any other embed";var MSG_MISSING_FILE="You must select a file to upload";var MSG_MISSING_FIRST_NAME="Complete the first name";var MSG_MISSING_GENDER="Complete the gender";var MSG_MISSING_LAST_NAME="Complete the last name";var MSG_MISSING_MESSAGE="Complete the message";var MSG_MISSING_NAME="Complete the name";var MSG_MISSING_PASSWORD="Complete the password";var MSG_MISSING_PROVIDER="Complete the provider";var MSG_MISSING_TITLE="Complete the title";var MSG_MISSING_TEXT="Complete the text";var MSG_MISSING_URL="Complete the URL";var MSG_MISSING_VOTE="Complete the vote";var MSG_MISSING_TRAVEL_TYPE="Please select a travel type";var MSG_EMBASSIES_MISSING_COUNTRIES="Select both countries";var MSG_CONTACT_SUCESSFUL="Mail successfully sent";var MSG_URL_MISSING="Complete the URL";var MSG_MISSING_PERSON_CHECKED="You must check at least 1 person";var MSG_REQUESTS_SENDED="Your request has been sent";var MSG_PHOTOS_UPLOAD_PHOTO="Upload a photo";var MSG_PHOTOS_SELECT_CITY="Select a city";var MSG_PHOTOS_TITLE="Select a title";var MSG_ENTER_PHOTO_DESCRIPTION="Enter photo description";var MSG_PHOTOS_PROCESSING_WAIT="Processing files please wait";var MSG_ADDTMB_SUCCESS="Registry added";var MSG_ADDTMB_ALREADY="You already had it";var MSG_SELECT_IHAVETO="Select a option";var MSG_FILE_UPLOADING="There is a file uploading";var MSG_CITY_ADDED="The city was added";var MSG_CITY_REMOVED="The city was removed";var MSG_MISSING_LOCATION_CITY="You must select a city first";var MSG_CITY_ALREADY_ADDED="City already added!";var MSG_START_FROM_TRIP="You must select a trip before adding a gallery";
var idIntValTravelHeight=0;var myTravelHomeSwf;function setTravelHeight(num)
{if(!myTravelHomeSwf)myTravelHomeSwf=travelHomeSwfGet();myTravelHomeSwf.height=num;}
function moveTravelHeight()
{myTravelHomeSwf.height-=(myTravelHomeSwf.height-myTravelHomeSwf.height_end)/2;if(Math.round(Math.abs(myTravelHomeSwf.height-myTravelHomeSwf.height_end))<=1){myTravelHomeSwf.height=myTravelHomeSwf.height_end;clearInterval(idIntValTravelHeight);idIntValTravelHeight=0;}}
function travelHomeSwfGet()
{var ret;if(document.all){ret=document.getElementById("travel_home_swf");}else{ret=window.document.travel_home_swf;}
return ret;}
function moveDivLeftRight(div,pixels)
{var my_div=$(div);var left_final=Number(my_div.getStyle('left').split("px")[0])+pixels;if(my_div["idIntVal"]>0)return;if(!my_div["total_width"])my_div["total_width"]=Number($(div+"_container").scrollWidth);my_div["idIntVal"]=setInterval(function(){var left_o=Number(my_div.getStyle('left').split("px")[0]);var left_f=left_o-Math.round((left_o-left_final)/4);if(Math.abs(left_f-left_final)<=2){left_f=left_final;if(left_f<0){$(div+"_previous").show();$(div+"_previous_off").hide();}else{$(div+"_previous").hide();$(div+"_previous_off").show();}
if((Math.abs(left_f)+Math.abs(pixels))<my_div["total_width"]){$(div+"_next").show();$(div+"_next_off").hide();}else{$(div+"_next").hide();$(div+"_next_off").show();}
clearInterval(my_div["idIntVal"]);my_div["idIntVal"]=0;}
my_div.setStyle({left:left_f+"px"});},25);}
function sign_up_show()
{popUp(PATH+"user/sign_up/");}
function reg_submit()
{if(!jQuery.isReady||document.sending)return;var reg_birth_check=jQuery('#reg_birth_d').val()+"/"+jQuery('#reg_birth_m').val()+"/"+jQuery('#reg_birth_y').val();var reg_birth_post=jQuery('#reg_birth_y').val()+"-"+jQuery('#reg_birth_m').val()+"-"+jQuery('#reg_birth_d').val();var username_expr=/^[A-Za-z][A-Za-z0-9_\s]*$/;hide_div_alert('div_error_msg');if(inputIsEmpty('reg_first_name')){show_div_alert('div_error_msg',MSG_MISSING_FIRST_NAME);jQuery('#reg_first_name').focus();}else
if(inputIsEmpty('reg_last_name')){show_div_alert('div_error_msg',MSG_MISSING_LAST_NAME);jQuery('#reg_last_name').focus();}else
if(!is_date(reg_birth_check)){show_div_alert('div_error_msg',MSG_INVALID_DATE);}else
if(!is_email(jQuery('#reg_email').val())){show_div_alert('div_error_msg',MSG_INVALID_EMAIL);jQuery('#reg_email').focus();}else
if(inputIsEmpty('reg_username')){show_div_alert('div_error_msg',MSG_BLOG_MISSING_NAME);jQuery('#reg_username').focus();}else
if(!username_expr.test(jQuery('#reg_username').val())){show_div_alert('div_error_msg',MSG_BLOG_BAD_NAME);jQuery('#reg_username').focus();}else
if(inputIsEmpty('reg_password')){show_div_alert('div_error_msg',MSG_MISSING_PASSWORD);jQuery('#reg_password').focus();}else
if(inputIsEmpty('reg_password2')){show_div_alert('div_error_msg',MSG_MISSING_PASSWORD);jQuery('#reg_password2').focus();}else
if(jQuery('#reg_password').val()!=jQuery('#reg_password2').val()){show_div_alert('div_error_msg',MSG_PASSWORD_DONT_MATCH);jQuery('#reg_password2').focus();}else
if(inputIsEmpty('reg_captcha')){show_div_alert('div_error_msg',MSG_MISSING_CAPTCHA);jQuery('#reg_captcha').focus();}else
if(!jQuery('#reg_control').attr('checked')){show_div_alert('div_error_msg',MSG_MISSING_AGREE_TERMS);}else{document.sending=true;show_div_alert('div_error_msg',MSG_SENDING);var objData={first_name:urlencode(jQuery('#reg_first_name').val()),last_name:urlencode(jQuery('#reg_last_name').val()),email:jQuery('#reg_email').val(),password:jQuery('#reg_password').val(),birth:reg_birth_post,gender:(jQuery('#reg_gender').attr('checked'))?'f':'m',country:jQuery('#reg_country').val(),username:urlencode(jQuery('#reg_username').val()),captcha:jQuery('#reg_captcha').val()}
jQuery.ajax({type:'POST',url:PATH+'_include/ajax/sign_up_post.php',data:objData,success:function(response)
{var v_result=response.split('|');if(v_result[0]==1){jQuery('#div_error_msg').hide();show_div_alert('div_ok_msg',MSG_REGISTRATION_OK);setTimeout(function(){popUpHide();},3000);}else{show_div_alert('div_error_msg',eval(v_result[1]));}
document.sending=false;}});}}
function forget_password_submit()
{if(!jQuery.isReady||document.sending)return;jQuery('#forget_captcha').removeClass('form_input_error');jQuery('#forget_email').removeClass('form_input_error');if(inputIsEmpty('forget_captcha')){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_CAPTCHA});jQuery('#forget_captcha').focus();jQuery('#forget_captcha').addClass('form_input_error');}else
if(!is_email(jQuery('#forget_email').val())){show_js_alert(ALERT_ERROR,{message:MSG_INVALID_EMAIL});jQuery('#forget_email').focus();jQuery('#forget_email').addClass('form_input_error');}else{document.sending=true;var objData={captcha:jQuery('#forget_captcha').val(),email:jQuery('#forget_email').val()}
jQuery.ajax({type:'POST',url:PATH+'_include/ajax/password_request.php',data:objData,success:function(response)
{var v_result=response.split('|');if(v_result[0]==1){show_js_alert(ALERT_OK,{message:MSG_EMAIL_FORGOT_SENDED});}else
if(v_result[0]==-1){show_js_alert(ALERT_ERROR,{message:MSG_ERROR_CAPTCHA});jQuery('#forget_captcha').focus();jQuery('#forget_captcha').addClass('form_input_error');}else
if(v_result[0]==-2){show_js_alert(ALERT_ERROR,{message:MSG_EMAIL_NO_REGISTERED});jQuery('#forget_email').focus();jQuery('#forget_email').addClass('form_input_error');}else{show_js_alert(ALERT_ERROR,{message:eval(v_result[1])});}
document.sending=false;}});}}
function personal_data_check(force_sending)
{if(!$F('first_name')){$('div_personal_data_msg').update(MSG_MISSING_FIRST_NAME);$('first_name').focus();}else
if(!$F('last_name')){$('div_personal_data_msg').update(MSG_MISSING_LAST_NAME);$('last_name').focus();}else
if(!check_date_birthday_validate()){$('div_personal_data_msg').update(MSG_INVALID_DATE);}else
if(!$RF('gender')){$('div_personal_data_msg').update(MSG_MISSING_GENDER);}else{personal_data_submit(force_sending);}}
function personal_data_submit(force_sending)
{if(!document.sending||force_sending){document.sending=true;var AJAX=new sack(PATH+"ajax/user_personal_data/");AJAX.setVar('first_name',$F('first_name'));AJAX.setVar('last_name',$F('last_name'));AJAX.setVar('birthday_d',$F('birthday_d'));AJAX.setVar('birthday_m',$F('birthday_m'));AJAX.setVar('birthday_Y',$F('birthday_Y'));AJAX.setVar('gender',$RF('gender'));AJAX.setVar('country',$F('country'));AJAX.setVar('personal_message',text_encode($F('personal_message')));AJAX.setVar("occupation",text_encode($F('occupation')));AJAX.setVar("studies",text_encode($F('studies')));AJAX.setVar("PHPSESSID",PHPSESSID);$('div_personal_data_msg').update(MSG_SENDING);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");$('div_personal_data_msg').update(eval(v_data[2]));document.sending=false;}
AJAX.runAJAX();}else{$('div_personal_data_msg').update(MSG_WAIT);}}
function get_checked_contacts()
{var inputs=$$('input:[type=checkbox]');inputs.each(function(e){e.checked=check;});}
function save_user_contacts()
{if(!document.sending){document.sending=true;$('div_msg').update(MSG_SENDING);var AJAX=new sack(PATH+"ajax/contact_save/");AJAX.onCompletion=function()
{document.sending=false;$('div_msg').update(MSG_SUCCESSFUL);}
AJAX.setVar("PHPSESSID",PHPSESSID);var names=$$('input:[name=names]');var emails=$$('input:[name=emails]');for(var i=0;i<names.length;i++){if($('chkMail'+i).checked){AJAX.setVar('name_'+i,$F('name_'+i));AJAX.setVar('email_'+i,$F('email_'+i));}}
AJAX.runAJAX();}else{$('div_msg').update(MSG_WAIT);}}
function social_contacts_submit(force_sending)
{if(!document.sending||force_sending){document.sending=true;var AJAX=new sack(PATH+"ajax/user_social_contacts/");AJAX.setVar('skype',$F('skype'));AJAX.setVar('msn',$F('msn'));AJAX.setVar('yahoo',$F('yahoo'));AJAX.setVar('facebook',$F('facebook'));AJAX.setVar('myspace',$F('myspace'));AJAX.setVar("force_sending",(force_sending)?"1":0);AJAX.setVar("PHPSESSID",PHPSESSID);$('div_social_contacts_msg').update(MSG_SENDING);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED,callback:function(){gotoURL(PATH+'user/my_profile/');}});document.sending=false;}
AJAX.runAJAX();}else{$('div_social_contacts_msg').update(MSG_WAIT);}}
function user_interests_submit(force_sending)
{if(!document.sending||force_sending){document.sending=true;var max_id_util_interests=$F('max_id_util_interests');var AJAX=new sack(PATH+"ajax/user_interests/");for(i=1;i<=max_id_util_interests;i++){var i_value=0;try{i_value=($('id_interest_'+i).checked)?1:0;}catch(e){}
if(i_value)AJAX.setVar('id_interest_'+i,i_value);}
AJAX.setVar("destination",text_encode($F('destination')));AJAX.setVar("force_sending",(force_sending)?"1":0);AJAX.setVar("PHPSESSID",PHPSESSID);$('div_user_interests_msg').update(MSG_SENDING);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED,callback:function(){gotoURL(PATH+'user/my_profile/');}});document.sending=false;}
AJAX.runAJAX();}else{$('div_user_interests_msg').update(MSG_WAIT);}}
function user_private_settings(force_sending)
{if(!document.sending||force_sending){document.sending=true;var AJAX=new sack(PATH+"ajax/user_privacy/");AJAX.setVar("private_profile",($F('private_profile'))?"1":0);AJAX.setVar("force_sending",(force_sending)?"1":0);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED});}else{show_js_alert(ALERT_ERROR,{message:eval(v_data[2])});}
$('div_private_msg').update('');document.sending=false;}
AJAX.runAJAX();$('div_private_msg').update(MSG_SENDING);}else{$('div_private_msg').update(MSG_WAIT);}}
function user_image_profile_uploaded(param)
{var AJAX=new sack(PATH+"user_folder/image_profile_upload.php");AJAX.setVar('tmp_name',param);AJAX.setVar("PHPSESSID",PHPSESSID);$('div_image_profile_msg').update(MSG_SENDING);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_image_profile_msg').update(eval(v_data[2]));user_image_profile_reload(v_data[1])}}
AJAX.runAJAX();}
function user_image_profile_reload(file_name)
{$Flash('flash_user_images').SetVariable("js_controller_mc.last_selected","true");$Flash('flash_user_images').TGotoFrame("js_controller_mc",1);}
function user_image_profile_select(id_image)
{$('id_user_image_profile').value=id_image;}
function user_save_image()
{if(!document.sending){if($F('user_image_remove')||$F('id_user_image_profile')){document.sending=true;var AJAX=new sack(PATH+"ajax/user_image_save/");if($F('user_image_remove')){AJAX.setVar('id_image_profile',0);}else{AJAX.setVar('id_image_profile',$F('id_user_image_profile'));}
AJAX.setVar("PHPSESSID",PHPSESSID);$('div_image_profile_msg').update(MSG_SENDING);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");$('div_image_profile_msg').update(eval(v_data[2]));if(v_data[3]){user_image_profile_update(urldecode(v_data[3]));}else{user_image_profile_remove();}
document.sending=false;}
AJAX.runAJAX();}else{$('div_image_profile_msg').update(MSG_MISSING_OPTION);}}else{$('div_image_profile_msg').update(MSG_WAIT);}}
function user_image_delete()
{$('div_image_profile_msg').update(MSG_SENDING);var AJAX=new sack(PATH+"ajax/user_image_delete/");AJAX.setVar('id_image_profile',$F('id_user_image_profile'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){user_image_profile_reload("");$('div_image_profile_msg').update(MSG_SUCCESSFUL);}else{$('div_image_profile_msg').update(MSG_ERROR);}}
AJAX.runAJAX();}
function user_image_profile_update(file_name)
{$('td_user_panel_avatar').removeClassName('default_avatar_big');$('user_panel_avatar').show();$('user_panel_avatar').src=file_name;Effect.ScrollTo('user_panel_avatar',{offset:-150});}
function user_image_profile_remove()
{$('td_user_panel_avatar').addClassName('default_avatar_big');$('user_panel_avatar').hide();$Flash('flash_user_images').SetVariable("js_controller_mc.last_selected","");$Flash('flash_user_images').TGotoFrame("js_controller_mc",1);Effect.ScrollTo('user_panel_avatar',{offset:-150});}
function user_alerts_save()
{if(!document.sending){document.sending=true;var AJAX=new sack(PATH+"ajax/user_alerts_save/");for(var i=0;i<arr_alerts_fields.length;i++){var value=0;if($F(arr_alerts_fields[i]+"_me")&&$F(arr_alerts_fields[i]+"_friends")){value=3;}else
if($F(arr_alerts_fields[i]+"_me")){value=2;}else
if($F(arr_alerts_fields[i]+"_friends")){value=1;}
AJAX.setVar(arr_alerts_fields[i],value);}
AJAX.setVar("PHPSESSID",PHPSESSID);$('div_alerts_msg').update(MSG_SENDING);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");$('div_alerts_msg').update(eval(v_data[2]));show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED});document.sending=false;}
AJAX.runAJAX();}else{$('div_alerts_msg').update(MSG_WAIT);}}
function user_profile_global_save()
{personal_data_check(true);social_contacts_submit(true);user_interests_submit(true);}
var img_palette_selected="";function img_palette(name,over)
{var img=$('img_palette_'+name);if(img_palette_selected!=name){if(over){img.className="sample_bg_border_selected";}else{img.className="sample_bg_border";}}}
function set_palette(name)
{document.body.style.cursor='wait';var AJAX=new sack(PATH+"ajax/settings_set_palette/");AJAX.setVar("palette",name);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){$('css_palette').href=PATH+'html/css/palette_'+name+'_styles.css';$('img_palette_'+name).className="sample_bg_border_selected";$('img_palette_'+img_palette_selected).className="sample_bg_border";img_palette_selected=name;}
document.body.style.cursor='';}
AJAX.runAJAX();}
function registration_delete_account()
{if(confirm(MSG_ARE_YOU_SURE)){show_js_alert(ALERT_WARNING,{message:MSG_DELETING,close:false});jQuery.ajax({type:'GET',async:false,url:PATH+'_include/ajax/user_delete.php',success:function(response)
{hide_js_alert();var v_data=response.split("|");if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_USER_DELETED,callback:function(){gotoURL(PATH);}});}else{show_js_alert(ALERT_OK,{message:MSG_SERVER_ERROR});}}});}}
var Scriptaculous={Version:'1.8.2',require:function(libraryName){document.write('<script type="text/javascript" src="'+libraryName+'"><\/script>');},REQUIRED_PROTOTYPE:'1.6.0.3',load:function(){function convertVersionString(versionString){var r=versionString.split('.');return parseInt(r[0])*100000+parseInt(r[1])*1000+parseInt(r[2]);}
if((typeof Prototype=='undefined')||(typeof Element=='undefined')||(typeof Element.Methods=='undefined')||(convertVersionString(Prototype.Version)<convertVersionString(Scriptaculous.REQUIRED_PROTOTYPE)))
throw("script.aculo.us requires the Prototype JavaScript framework >= "+
Scriptaculous.REQUIRED_PROTOTYPE);$A(document.getElementsByTagName("script")).findAll(function(s){return(s.src&&s.src.match(/scriptaculous\.js(\?.*)?$/))}).each(function(s){var path=s.src.replace(/scriptaculous\.js(\?.*)?$/,'');var includes=s.src.match(/\?.*load=([a-z,]*)/);(includes?includes[1]:'builder,effects,dragdrop,controls,slider,sound').split(',').each(function(include){Scriptaculous.require(path+include+'.js')});});}}
Scriptaculous.load();
function cchola()
{alert("cchola()");}
var Builder={NODEMAP:{AREA:'map',CAPTION:'table',COL:'table',COLGROUP:'table',LEGEND:'fieldset',OPTGROUP:'select',OPTION:'select',PARAM:'object',TBODY:'table',TD:'table',TFOOT:'table',TH:'table',THEAD:'table',TR:'table'},node:function(elementName){elementName=elementName.toUpperCase();var parentTag=this.NODEMAP[elementName]||'div';var parentElement=document.createElement(parentTag);try{parentElement.innerHTML="<"+elementName+"></"+elementName+">";}catch(e){}
var element=parentElement.firstChild||null;if(element&&(element.tagName.toUpperCase()!=elementName))
element=element.getElementsByTagName(elementName)[0];if(!element)element=document.createElement(elementName);if(!element)return;if(arguments[1])
if(this._isStringOrNumber(arguments[1])||(arguments[1]instanceof Array)||arguments[1].tagName){this._children(element,arguments[1]);}else{var attrs=this._attributes(arguments[1]);if(attrs.length){try{parentElement.innerHTML="<"+elementName+" "+
attrs+"></"+elementName+">";}catch(e){}
element=parentElement.firstChild||null;if(!element){element=document.createElement(elementName);for(attr in arguments[1])
element[attr=='class'?'className':attr]=arguments[1][attr];}
if(element.tagName.toUpperCase()!=elementName)
element=parentElement.getElementsByTagName(elementName)[0];}}
if(arguments[2])
this._children(element,arguments[2]);return $(element);},_text:function(text){return document.createTextNode(text);},ATTR_MAP:{'className':'class','htmlFor':'for'},_attributes:function(attributes){var attrs=[];for(attribute in attributes)
attrs.push((attribute in this.ATTR_MAP?this.ATTR_MAP[attribute]:attribute)+'="'+attributes[attribute].toString().escapeHTML().gsub(/"/,'&quot;')+'"');return attrs.join(" ");},_children:function(element,children){if(children.tagName){element.appendChild(children);return;}
if(typeof children=='object'){children.flatten().each(function(e){if(typeof e=='object')
element.appendChild(e);else
if(Builder._isStringOrNumber(e))
element.appendChild(Builder._text(e));});}else
if(Builder._isStringOrNumber(children))
element.appendChild(Builder._text(children));},_isStringOrNumber:function(param){return(typeof param=='string'||typeof param=='number');},build:function(html){var element=this.node('div');$(element).update(html.strip());return element.down();},dump:function(scope){if(typeof scope!='object'&&typeof scope!='function')scope=window;var tags=("A ABBR ACRONYM ADDRESS APPLET AREA B BASE BASEFONT BDO BIG BLOCKQUOTE BODY "+"BR BUTTON CAPTION CENTER CITE CODE COL COLGROUP DD DEL DFN DIR DIV DL DT EM FIELDSET "+"FONT FORM FRAME FRAMESET H1 H2 H3 H4 H5 H6 HEAD HR HTML I IFRAME IMG INPUT INS ISINDEX "+"KBD LABEL LEGEND LI LINK MAP MENU META NOFRAMES NOSCRIPT OBJECT OL OPTGROUP OPTION P "+"PARAM PRE Q S SAMP SCRIPT SELECT SMALL SPAN STRIKE STRONG STYLE SUB SUP TABLE TBODY TD "+"TEXTAREA TFOOT TH THEAD TITLE TR TT U UL VAR").split(/\s+/);tags.each(function(tag){scope[tag]=function(){return Builder.node.apply(Builder,[tag].concat($A(arguments)));};});}};
String.prototype.parseColor=function(){var color='#';if(this.slice(0,4)=='rgb('){var cols=this.slice(4,this.length-1).split(',');var i=0;do{color+=parseInt(cols[i]).toColorPart()}while(++i<3);}else{if(this.slice(0,1)=='#'){if(this.length==4)for(var i=1;i<4;i++)color+=(this.charAt(i)+this.charAt(i)).toLowerCase();if(this.length==7)color=this.toLowerCase();}}
return(color.length==7?color:(arguments[0]||this));};Element.collectTextNodes=function(element){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:(node.hasChildNodes()?Element.collectTextNodes(node):''));}).flatten().join('');};Element.collectTextNodesIgnoreClass=function(element,className){return $A($(element).childNodes).collect(function(node){return(node.nodeType==3?node.nodeValue:((node.hasChildNodes()&&!Element.hasClassName(node,className))?Element.collectTextNodesIgnoreClass(node,className):''));}).flatten().join('');};Element.setContentZoom=function(element,percent){element=$(element);element.setStyle({fontSize:(percent/100)+'em'});if(Prototype.Browser.WebKit)window.scrollBy(0,0);return element;};Element.getInlineOpacity=function(element){return $(element).style.opacity||'';};Element.forceRerendering=function(element){try{element=$(element);var n=document.createTextNode(' ');element.appendChild(n);element.removeChild(n);}catch(e){}};var Effect={_elementDoesNotExistError:{name:'ElementDoesNotExistError',message:'The specified DOM element does not exist, but is required for this effect to operate'},Transitions:{linear:Prototype.K,sinoidal:function(pos){return(-Math.cos(pos*Math.PI)/2)+.5;},reverse:function(pos){return 1-pos;},flicker:function(pos){var pos=((-Math.cos(pos*Math.PI)/4)+.75)+Math.random()/4;return pos>1?1:pos;},wobble:function(pos){return(-Math.cos(pos*Math.PI*(9*pos))/2)+.5;},pulse:function(pos,pulses){return(-Math.cos((pos*((pulses||5)-.5)*2)*Math.PI)/2)+.5;},spring:function(pos){return 1-(Math.cos(pos*4.5*Math.PI)*Math.exp(-pos*6));},none:function(pos){return 0;},full:function(pos){return 1;}},DefaultOptions:{duration:1.0,fps:100,sync:false,from:0.0,to:1.0,delay:0.0,queue:'parallel'},tagifyText:function(element){var tagifyStyle='position:relative';if(Prototype.Browser.IE)tagifyStyle+=';zoom:1';element=$(element);$A(element.childNodes).each(function(child){if(child.nodeType==3){child.nodeValue.toArray().each(function(character){element.insertBefore(new Element('span',{style:tagifyStyle}).update(character==' '?String.fromCharCode(160):character),child);});Element.remove(child);}});},multiple:function(element,effect){var elements;if(((typeof element=='object')||Object.isFunction(element))&&(element.length))
elements=element;else
elements=$(element).childNodes;var options=Object.extend({speed:0.1,delay:0.0},arguments[2]||{});var masterDelay=options.delay;$A(elements).each(function(element,index){new effect(element,Object.extend(options,{delay:index*options.speed+masterDelay}));});},PAIRS:{'slide':['SlideDown','SlideUp'],'blind':['BlindDown','BlindUp'],'appear':['Appear','Fade']},toggle:function(element,effect){element=$(element);effect=(effect||'appear').toLowerCase();var options=Object.extend({queue:{position:'end',scope:(element.id||'global'),limit:1}},arguments[2]||{});Effect[element.visible()?Effect.PAIRS[effect][1]:Effect.PAIRS[effect][0]](element,options);}};Effect.DefaultOptions.transition=Effect.Transitions.sinoidal;Effect.ScopedQueue=Class.create(Enumerable,{initialize:function(){this.effects=[];this.interval=null;},_each:function(iterator){this.effects._each(iterator);},add:function(effect){var timestamp=new Date().getTime();var position=Object.isString(effect.options.queue)?effect.options.queue:effect.options.queue.position;switch(position){case'front':this.effects.findAll(function(e){return e.state=='idle'}).each(function(e){e.startOn+=effect.finishOn;e.finishOn+=effect.finishOn;});break;case'with-last':timestamp=this.effects.pluck('startOn').max()||timestamp;break;case'end':timestamp=this.effects.pluck('finishOn').max()||timestamp;break;}
effect.startOn+=timestamp;effect.finishOn+=timestamp;if(!effect.options.queue.limit||(this.effects.length<effect.options.queue.limit))
this.effects.push(effect);if(!this.interval)
this.interval=setInterval(this.loop.bind(this),15);},remove:function(effect){this.effects=this.effects.reject(function(e){return e==effect});if(this.effects.length==0){clearInterval(this.interval);this.interval=null;}},loop:function(){var timePos=new Date().getTime();for(var i=0,len=this.effects.length;i<len;i++)
this.effects[i]&&this.effects[i].loop(timePos);}});Effect.Queues={instances:$H(),get:function(queueName){if(!Object.isString(queueName))return queueName;return this.instances.get(queueName)||this.instances.set(queueName,new Effect.ScopedQueue());}};Effect.Queue=Effect.Queues.get('global');Effect.Base=Class.create({position:null,start:function(options){function codeForEvent(options,eventName){return((options[eventName+'Internal']?'this.options.'+eventName+'Internal(this);':'')+
(options[eventName]?'this.options.'+eventName+'(this);':''));}
if(options&&options.transition===false)options.transition=Effect.Transitions.linear;this.options=Object.extend(Object.extend({},Effect.DefaultOptions),options||{});this.currentFrame=0;this.state='idle';this.startOn=this.options.delay*1000;this.finishOn=this.startOn+(this.options.duration*1000);this.fromToDelta=this.options.to-this.options.from;this.totalTime=this.finishOn-this.startOn;this.totalFrames=this.options.fps*this.options.duration;this.render=(function(){function dispatch(effect,eventName){if(effect.options[eventName+'Internal'])
effect.options[eventName+'Internal'](effect);if(effect.options[eventName])
effect.options[eventName](effect);}
return function(pos){if(this.state==="idle"){this.state="running";dispatch(this,'beforeSetup');if(this.setup)this.setup();dispatch(this,'afterSetup');}
if(this.state==="running"){pos=(this.options.transition(pos)*this.fromToDelta)+this.options.from;this.position=pos;dispatch(this,'beforeUpdate');if(this.update)this.update(pos);dispatch(this,'afterUpdate');}};})();this.event('beforeStart');if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).add(this);},loop:function(timePos){if(timePos>=this.startOn){if(timePos>=this.finishOn){this.render(1.0);this.cancel();this.event('beforeFinish');if(this.finish)this.finish();this.event('afterFinish');return;}
var pos=(timePos-this.startOn)/this.totalTime,frame=(pos*this.totalFrames).round();if(frame>this.currentFrame){this.render(pos);this.currentFrame=frame;}}},cancel:function(){if(!this.options.sync)
Effect.Queues.get(Object.isString(this.options.queue)?'global':this.options.queue.scope).remove(this);this.state='finished';},event:function(eventName){if(this.options[eventName+'Internal'])this.options[eventName+'Internal'](this);if(this.options[eventName])this.options[eventName](this);},inspect:function(){var data=$H();for(property in this)
if(!Object.isFunction(this[property]))data.set(property,this[property]);return'#<Effect:'+data.inspect()+',options:'+$H(this.options).inspect()+'>';}});Effect.Parallel=Class.create(Effect.Base,{initialize:function(effects){this.effects=effects||[];this.start(arguments[1]);},update:function(position){this.effects.invoke('render',position);},finish:function(position){this.effects.each(function(effect){effect.render(1.0);effect.cancel();effect.event('beforeFinish');if(effect.finish)effect.finish(position);effect.event('afterFinish');});}});Effect.Tween=Class.create(Effect.Base,{initialize:function(object,from,to){object=Object.isString(object)?$(object):object;var args=$A(arguments),method=args.last(),options=args.length==5?args[3]:null;this.method=Object.isFunction(method)?method.bind(object):Object.isFunction(object[method])?object[method].bind(object):function(value){object[method]=value};this.start(Object.extend({from:from,to:to},options||{}));},update:function(position){this.method(position);}});Effect.Event=Class.create(Effect.Base,{initialize:function(){this.start(Object.extend({duration:0},arguments[0]||{}));},update:Prototype.emptyFunction});Effect.Opacity=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});var options=Object.extend({from:this.element.getOpacity()||0.0,to:1.0},arguments[1]||{});this.start(options);},update:function(position){this.element.setOpacity(position);}});Effect.Move=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({x:0,y:0,mode:'relative'},arguments[1]||{});this.start(options);},setup:function(){this.element.makePositioned();this.originalLeft=parseFloat(this.element.getStyle('left')||'0');this.originalTop=parseFloat(this.element.getStyle('top')||'0');if(this.options.mode=='absolute'){this.options.x=this.options.x-this.originalLeft;this.options.y=this.options.y-this.originalTop;}},update:function(position){this.element.setStyle({left:(this.options.x*position+this.originalLeft).round()+'px',top:(this.options.y*position+this.originalTop).round()+'px'});}});Effect.MoveBy=function(element,toTop,toLeft){return new Effect.Move(element,Object.extend({x:toLeft,y:toTop},arguments[3]||{}));};Effect.Scale=Class.create(Effect.Base,{initialize:function(element,percent){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({scaleX:true,scaleY:true,scaleContent:true,scaleFromCenter:false,scaleMode:'box',scaleFrom:100.0,scaleTo:percent},arguments[2]||{});this.start(options);},setup:function(){this.restoreAfterFinish=this.options.restoreAfterFinish||false;this.elementPositioning=this.element.getStyle('position');this.originalStyle={};['top','left','width','height','fontSize'].each(function(k){this.originalStyle[k]=this.element.style[k];}.bind(this));this.originalTop=this.element.offsetTop;this.originalLeft=this.element.offsetLeft;var fontSize=this.element.getStyle('font-size')||'100%';['em','px','%','pt'].each(function(fontSizeType){if(fontSize.indexOf(fontSizeType)>0){this.fontSize=parseFloat(fontSize);this.fontSizeType=fontSizeType;}}.bind(this));this.factor=(this.options.scaleTo-this.options.scaleFrom)/100;this.dims=null;if(this.options.scaleMode=='box')
this.dims=[this.element.offsetHeight,this.element.offsetWidth];if(/^content/.test(this.options.scaleMode))
this.dims=[this.element.scrollHeight,this.element.scrollWidth];if(!this.dims)
this.dims=[this.options.scaleMode.originalHeight,this.options.scaleMode.originalWidth];},update:function(position){var currentScale=(this.options.scaleFrom/100.0)+(this.factor*position);if(this.options.scaleContent&&this.fontSize)
this.element.setStyle({fontSize:this.fontSize*currentScale+this.fontSizeType});this.setDimensions(this.dims[0]*currentScale,this.dims[1]*currentScale);},finish:function(position){if(this.restoreAfterFinish)this.element.setStyle(this.originalStyle);},setDimensions:function(height,width){var d={};if(this.options.scaleX)d.width=width.round()+'px';if(this.options.scaleY)d.height=height.round()+'px';if(this.options.scaleFromCenter){var topd=(height-this.dims[0])/2;var leftd=(width-this.dims[1])/2;if(this.elementPositioning=='absolute'){if(this.options.scaleY)d.top=this.originalTop-topd+'px';if(this.options.scaleX)d.left=this.originalLeft-leftd+'px';}else{if(this.options.scaleY)d.top=-topd+'px';if(this.options.scaleX)d.left=-leftd+'px';}}
this.element.setStyle(d);}});Effect.Highlight=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({startcolor:'#ffff99'},arguments[1]||{});this.start(options);},setup:function(){if(this.element.getStyle('display')=='none'){this.cancel();return;}
this.oldStyle={};if(!this.options.keepBackgroundImage){this.oldStyle.backgroundImage=this.element.getStyle('background-image');this.element.setStyle({backgroundImage:'none'});}
if(!this.options.endcolor)
this.options.endcolor=this.element.getStyle('background-color').parseColor('#ffffff');if(!this.options.restorecolor)
this.options.restorecolor=this.element.getStyle('background-color');this._base=$R(0,2).map(function(i){return parseInt(this.options.startcolor.slice(i*2+1,i*2+3),16)}.bind(this));this._delta=$R(0,2).map(function(i){return parseInt(this.options.endcolor.slice(i*2+1,i*2+3),16)-this._base[i]}.bind(this));},update:function(position){this.element.setStyle({backgroundColor:$R(0,2).inject('#',function(m,v,i){return m+((this._base[i]+(this._delta[i]*position)).round().toColorPart());}.bind(this))});},finish:function(){this.element.setStyle(Object.extend(this.oldStyle,{backgroundColor:this.options.restorecolor}));}});Effect.ScrollTo=function(element){var options=arguments[1]||{},scrollOffsets=document.viewport.getScrollOffsets(),elementOffsets=$(element).cumulativeOffset();if(options.offset)elementOffsets[1]+=options.offset;return new Effect.Tween(null,scrollOffsets.top,elementOffsets[1],options,function(p){scrollTo(scrollOffsets.left,p.round());});};Effect.Fade=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();var options=Object.extend({from:element.getOpacity()||1.0,to:0.0,afterFinishInternal:function(effect){if(effect.options.to!=0)return;effect.element.hide().setStyle({opacity:oldOpacity});}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Appear=function(element){element=$(element);var options=Object.extend({from:(element.getStyle('display')=='none'?0.0:element.getOpacity()||0.0),to:1.0,afterFinishInternal:function(effect){effect.element.forceRerendering();},beforeSetup:function(effect){effect.element.setOpacity(effect.options.from).show();}},arguments[1]||{});return new Effect.Opacity(element,options);};Effect.Puff=function(element){element=$(element);var oldStyle={opacity:element.getInlineOpacity(),position:element.getStyle('position'),top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};return new Effect.Parallel([new Effect.Scale(element,200,{sync:true,scaleFromCenter:true,scaleContent:true,restoreAfterFinish:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:1.0,beforeSetupInternal:function(effect){Position.absolutize(effect.effects[0].element);},afterFinishInternal:function(effect){effect.effects[0].element.hide().setStyle(oldStyle);}},arguments[1]||{}));};Effect.BlindUp=function(element){element=$(element);element.makeClipping();return new Effect.Scale(element,0,Object.extend({scaleContent:false,scaleX:false,restoreAfterFinish:true,afterFinishInternal:function(effect){effect.element.hide().undoClipping();}},arguments[1]||{}));};Effect.BlindDown=function(element){element=$(element);var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:0,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makeClipping().setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.element.undoClipping();}},arguments[1]||{}));};Effect.SwitchOff=function(element){element=$(element);var oldOpacity=element.getInlineOpacity();return new Effect.Appear(element,Object.extend({duration:0.4,from:0,transition:Effect.Transitions.flicker,afterFinishInternal:function(effect){new Effect.Scale(effect.element,1,{duration:0.3,scaleFromCenter:true,scaleX:false,scaleContent:false,restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned().setStyle({opacity:oldOpacity});}});}},arguments[1]||{}));};Effect.DropOut=function(element){element=$(element);var oldStyle={top:element.getStyle('top'),left:element.getStyle('left'),opacity:element.getInlineOpacity()};return new Effect.Parallel([new Effect.Move(element,{x:0,y:100,sync:true}),new Effect.Opacity(element,{sync:true,to:0.0})],Object.extend({duration:0.5,beforeSetup:function(effect){effect.effects[0].element.makePositioned();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoPositioned().setStyle(oldStyle);}},arguments[1]||{}));};Effect.Shake=function(element){element=$(element);var options=Object.extend({distance:20,duration:0.5},arguments[1]||{});var distance=parseFloat(options.distance);var split=parseFloat(options.duration)/10.0;var oldStyle={top:element.getStyle('top'),left:element.getStyle('left')};return new Effect.Move(element,{x:distance,y:0,duration:split,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:distance*2,y:0,duration:split*2,afterFinishInternal:function(effect){new Effect.Move(effect.element,{x:-distance,y:0,duration:split,afterFinishInternal:function(effect){effect.element.undoPositioned().setStyle(oldStyle);}});}});}});}});}});}});};Effect.SlideDown=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,100,Object.extend({scaleContent:false,scaleX:false,scaleFrom:window.opera?0:1,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().setStyle({height:'0px'}).show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.SlideUp=function(element){element=$(element).cleanWhitespace();var oldInnerBottom=element.down().getStyle('bottom');var elementDimensions=element.getDimensions();return new Effect.Scale(element,window.opera?0:1,Object.extend({scaleContent:false,scaleX:false,scaleMode:'box',scaleFrom:100,scaleMode:{originalHeight:elementDimensions.height,originalWidth:elementDimensions.width},restoreAfterFinish:true,afterSetup:function(effect){effect.element.makePositioned();effect.element.down().makePositioned();if(window.opera)effect.element.setStyle({top:''});effect.element.makeClipping().show();},afterUpdateInternal:function(effect){effect.element.down().setStyle({bottom:(effect.dims[0]-effect.element.clientHeight)+'px'});},afterFinishInternal:function(effect){effect.element.hide().undoClipping().undoPositioned();effect.element.down().undoPositioned().setStyle({bottom:oldInnerBottom});}},arguments[1]||{}));};Effect.Squish=function(element){return new Effect.Scale(element,window.opera?1:0,{restoreAfterFinish:true,beforeSetup:function(effect){effect.element.makeClipping();},afterFinishInternal:function(effect){effect.element.hide().undoClipping();}});};Effect.Grow=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.full},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var initialMoveX,initialMoveY;var moveX,moveY;switch(options.direction){case'top-left':initialMoveX=initialMoveY=moveX=moveY=0;break;case'top-right':initialMoveX=dims.width;initialMoveY=moveY=0;moveX=-dims.width;break;case'bottom-left':initialMoveX=moveX=0;initialMoveY=dims.height;moveY=-dims.height;break;case'bottom-right':initialMoveX=dims.width;initialMoveY=dims.height;moveX=-dims.width;moveY=-dims.height;break;case'center':initialMoveX=dims.width/2;initialMoveY=dims.height/2;moveX=-dims.width/2;moveY=-dims.height/2;break;}
return new Effect.Move(element,{x:initialMoveX,y:initialMoveY,duration:0.01,beforeSetup:function(effect){effect.element.hide().makeClipping().makePositioned();},afterFinishInternal:function(effect){new Effect.Parallel([new Effect.Opacity(effect.element,{sync:true,to:1.0,from:0.0,transition:options.opacityTransition}),new Effect.Move(effect.element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition}),new Effect.Scale(effect.element,100,{scaleMode:{originalHeight:dims.height,originalWidth:dims.width},sync:true,scaleFrom:window.opera?1:0,transition:options.scaleTransition,restoreAfterFinish:true})],Object.extend({beforeSetup:function(effect){effect.effects[0].element.setStyle({height:'0px'}).show();},afterFinishInternal:function(effect){effect.effects[0].element.undoClipping().undoPositioned().setStyle(oldStyle);}},options));}});};Effect.Shrink=function(element){element=$(element);var options=Object.extend({direction:'center',moveTransition:Effect.Transitions.sinoidal,scaleTransition:Effect.Transitions.sinoidal,opacityTransition:Effect.Transitions.none},arguments[1]||{});var oldStyle={top:element.style.top,left:element.style.left,height:element.style.height,width:element.style.width,opacity:element.getInlineOpacity()};var dims=element.getDimensions();var moveX,moveY;switch(options.direction){case'top-left':moveX=moveY=0;break;case'top-right':moveX=dims.width;moveY=0;break;case'bottom-left':moveX=0;moveY=dims.height;break;case'bottom-right':moveX=dims.width;moveY=dims.height;break;case'center':moveX=dims.width/2;moveY=dims.height/2;break;}
return new Effect.Parallel([new Effect.Opacity(element,{sync:true,to:0.0,from:1.0,transition:options.opacityTransition}),new Effect.Scale(element,window.opera?1:0,{sync:true,transition:options.scaleTransition,restoreAfterFinish:true}),new Effect.Move(element,{x:moveX,y:moveY,sync:true,transition:options.moveTransition})],Object.extend({beforeStartInternal:function(effect){effect.effects[0].element.makePositioned().makeClipping();},afterFinishInternal:function(effect){effect.effects[0].element.hide().undoClipping().undoPositioned().setStyle(oldStyle);}},options));};Effect.Pulsate=function(element){element=$(element);var options=arguments[1]||{},oldOpacity=element.getInlineOpacity(),transition=options.transition||Effect.Transitions.linear,reverser=function(pos){return 1-transition((-Math.cos((pos*(options.pulses||5)*2)*Math.PI)/2)+.5);};return new Effect.Opacity(element,Object.extend(Object.extend({duration:2.0,from:0,afterFinishInternal:function(effect){effect.element.setStyle({opacity:oldOpacity});}},options),{transition:reverser}));};Effect.Fold=function(element){element=$(element);var oldStyle={top:element.style.top,left:element.style.left,width:element.style.width,height:element.style.height};element.makeClipping();return new Effect.Scale(element,5,Object.extend({scaleContent:false,scaleX:false,afterFinishInternal:function(effect){new Effect.Scale(element,1,{scaleContent:false,scaleY:false,afterFinishInternal:function(effect){effect.element.hide().undoClipping().setStyle(oldStyle);}});}},arguments[1]||{}));};Effect.Morph=Class.create(Effect.Base,{initialize:function(element){this.element=$(element);if(!this.element)throw(Effect._elementDoesNotExistError);var options=Object.extend({style:{}},arguments[1]||{});if(!Object.isString(options.style))this.style=$H(options.style);else{if(options.style.include(':'))
this.style=options.style.parseStyle();else{this.element.addClassName(options.style);this.style=$H(this.element.getStyles());this.element.removeClassName(options.style);var css=this.element.getStyles();this.style=this.style.reject(function(style){return style.value==css[style.key];});options.afterFinishInternal=function(effect){effect.element.addClassName(effect.options.style);effect.transforms.each(function(transform){effect.element.style[transform.style]='';});};}}
this.start(options);},setup:function(){function parseColor(color){if(!color||['rgba(0, 0, 0, 0)','transparent'].include(color))color='#ffffff';color=color.parseColor();return $R(0,2).map(function(i){return parseInt(color.slice(i*2+1,i*2+3),16);});}
this.transforms=this.style.map(function(pair){var property=pair[0],value=pair[1],unit=null;if(value.parseColor('#zzzzzz')!='#zzzzzz'){value=value.parseColor();unit='color';}else if(property=='opacity'){value=parseFloat(value);if(Prototype.Browser.IE&&(!this.element.currentStyle.hasLayout))
this.element.setStyle({zoom:1});}else if(Element.CSS_LENGTH.test(value)){var components=value.match(/^([\+\-]?[0-9\.]+)(.*)$/);value=parseFloat(components[1]);unit=(components.length==3)?components[2]:null;}
var originalValue=this.element.getStyle(property);return{style:property.camelize(),originalValue:unit=='color'?parseColor(originalValue):parseFloat(originalValue||0),targetValue:unit=='color'?parseColor(value):value,unit:unit};}.bind(this)).reject(function(transform){return((transform.originalValue==transform.targetValue)||(transform.unit!='color'&&(isNaN(transform.originalValue)||isNaN(transform.targetValue))));});},update:function(position){var style={},transform,i=this.transforms.length;while(i--)
style[(transform=this.transforms[i]).style]=transform.unit=='color'?'#'+
(Math.round(transform.originalValue[0]+
(transform.targetValue[0]-transform.originalValue[0])*position)).toColorPart()+
(Math.round(transform.originalValue[1]+
(transform.targetValue[1]-transform.originalValue[1])*position)).toColorPart()+
(Math.round(transform.originalValue[2]+
(transform.targetValue[2]-transform.originalValue[2])*position)).toColorPart():(transform.originalValue+
(transform.targetValue-transform.originalValue)*position).toFixed(3)+
(transform.unit===null?'':transform.unit);this.element.setStyle(style,true);}});Effect.Transform=Class.create({initialize:function(tracks){this.tracks=[];this.options=arguments[1]||{};this.addTracks(tracks);},addTracks:function(tracks){tracks.each(function(track){track=$H(track);var data=track.values().first();this.tracks.push($H({ids:track.keys().first(),effect:Effect.Morph,options:{style:data}}));}.bind(this));return this;},play:function(){return new Effect.Parallel(this.tracks.map(function(track){var ids=track.get('ids'),effect=track.get('effect'),options=track.get('options');var elements=[$(ids)||$$(ids)].flatten();return elements.map(function(e){return new effect(e,Object.extend({sync:true},options))});}).flatten(),this.options);}});Element.CSS_PROPERTIES=$w('backgroundColor backgroundPosition borderBottomColor borderBottomStyle '+'borderBottomWidth borderLeftColor borderLeftStyle borderLeftWidth '+'borderRightColor borderRightStyle borderRightWidth borderSpacing '+'borderTopColor borderTopStyle borderTopWidth bottom clip color '+'fontSize fontWeight height left letterSpacing lineHeight '+'marginBottom marginLeft marginRight marginTop markerOffset maxHeight '+'maxWidth minHeight minWidth opacity outlineColor outlineOffset '+'outlineWidth paddingBottom paddingLeft paddingRight paddingTop '+'right textIndent top width wordSpacing zIndex');Element.CSS_LENGTH=/^(([\+\-]?[0-9\.]+)(em|ex|px|in|cm|mm|pt|pc|\%))|0$/;String.__parseStyleElement=document.createElement('div');String.prototype.parseStyle=function(){var style,styleRules=$H();if(Prototype.Browser.WebKit)
style=new Element('div',{style:this}).style;else{String.__parseStyleElement.innerHTML='<div style="'+this+'"></div>';style=String.__parseStyleElement.childNodes[0].style;}
Element.CSS_PROPERTIES.each(function(property){if(style[property])styleRules.set(property,style[property]);});if(Prototype.Browser.IE&&this.include('opacity'))
styleRules.set('opacity',this.match(/opacity:\s*((?:0|1)?(?:\.\d*)?)/)[1]);return styleRules;};if(document.defaultView&&document.defaultView.getComputedStyle){Element.getStyles=function(element){var css=document.defaultView.getComputedStyle($(element),null);return Element.CSS_PROPERTIES.inject({},function(styles,property){styles[property]=css[property];return styles;});};}else{Element.getStyles=function(element){element=$(element);var css=element.currentStyle,styles;styles=Element.CSS_PROPERTIES.inject({},function(results,property){results[property]=css[property];return results;});if(!styles.opacity)styles.opacity=element.getOpacity();return styles;};}
Effect.Methods={morph:function(element,style){element=$(element);new Effect.Morph(element,Object.extend({style:style},arguments[2]||{}));return element;},visualEffect:function(element,effect,options){element=$(element);var s=effect.dasherize().camelize(),klass=s.charAt(0).toUpperCase()+s.substring(1);new Effect[klass](element,options);return element;},highlight:function(element,options){element=$(element);new Effect.Highlight(element,options);return element;}};$w('fade appear grow shrink fold blindUp blindDown slideUp slideDown '+'pulsate shake puff squish switchOff dropOut').each(function(effect){Effect.Methods[effect]=function(element,options){element=$(element);Effect[effect.charAt(0).toUpperCase()+effect.substring(1)](element,options);return element;};});$w('getInlineOpacity forceRerendering setContentZoom collectTextNodes collectTextNodesIgnoreClass getStyles').each(function(f){Effect.Methods[f]=Element[f];});Element.addMethods(Effect.Methods);
if(typeof Effect=='undefined')
throw("controls.js requires including script.aculo.us' effects.js library");var Autocompleter={};Autocompleter.Base=Class.create({baseInitialize:function(element,update,options){element=$(element);this.element=element;this.update=$(update);this.hasFocus=false;this.changed=false;this.active=false;this.index=0;this.entryCount=0;this.oldElementValue=this.element.value;if(this.setOptions)
this.setOptions(options);else
this.options=options||{};this.options.paramName=this.options.paramName||this.element.name;this.options.tokens=this.options.tokens||[];this.options.frequency=this.options.frequency||0.4;this.options.minChars=this.options.minChars||1;this.options.onShow=this.options.onShow||function(element,update){if(!update.style.position||update.style.position=='absolute'){update.style.position='absolute';Position.clone(element,update,{setHeight:false,offsetTop:element.offsetHeight});}
Effect.Appear(update,{duration:0.15});};this.options.onHide=this.options.onHide||function(element,update){new Effect.Fade(update,{duration:0.15})};if(typeof(this.options.tokens)=='string')
this.options.tokens=new Array(this.options.tokens);if(!this.options.tokens.include('\n'))
this.options.tokens.push('\n');this.observer=null;this.element.setAttribute('autocomplete','off');Element.hide(this.update);Event.observe(this.element,'blur',this.onBlur.bindAsEventListener(this));Event.observe(this.element,'keydown',this.onKeyPress.bindAsEventListener(this));},show:function(){if(Element.getStyle(this.update,'display')=='none')this.options.onShow(this.element,this.update);if(!this.iefix&&(Prototype.Browser.IE)&&(Element.getStyle(this.update,'position')=='absolute')){new Insertion.After(this.update,'<iframe id="'+this.update.id+'_iefix" '+'style="display:none;position:absolute;filter:progid:DXImageTransform.Microsoft.Alpha(opacity=0);" '+'src="javascript:false;" frameborder="0" scrolling="no"></iframe>');this.iefix=$(this.update.id+'_iefix');}
if(this.iefix)setTimeout(this.fixIEOverlapping.bind(this),50);},fixIEOverlapping:function(){Position.clone(this.update,this.iefix,{setTop:(!this.update.style.height)});this.iefix.style.zIndex=1;this.update.style.zIndex=2;Element.show(this.iefix);},hide:function(){this.stopIndicator();if(Element.getStyle(this.update,'display')!='none')this.options.onHide(this.element,this.update);if(this.iefix)Element.hide(this.iefix);},startIndicator:function(){if(this.options.indicator)Element.show(this.options.indicator);},stopIndicator:function(){if(this.options.indicator)Element.hide(this.options.indicator);},onKeyPress:function(event){if(this.active)
switch(event.keyCode){case Event.KEY_TAB:case Event.KEY_RETURN:this.selectEntry();Event.stop(event);case Event.KEY_ESC:this.hide();this.active=false;Event.stop(event);return;case Event.KEY_LEFT:case Event.KEY_RIGHT:return;case Event.KEY_UP:this.markPrevious();this.render();Event.stop(event);return;case Event.KEY_DOWN:this.markNext();this.render();Event.stop(event);return;}
else
if(event.keyCode==Event.KEY_TAB||event.keyCode==Event.KEY_RETURN||(Prototype.Browser.WebKit>0&&event.keyCode==0))return;this.changed=true;this.hasFocus=true;if(this.observer)clearTimeout(this.observer);this.observer=setTimeout(this.onObserverEvent.bind(this),this.options.frequency*1000);},activate:function(){this.changed=false;this.hasFocus=true;this.getUpdatedChoices();},onHover:function(event){var element=Event.findElement(event,'LI');if(this.index!=element.autocompleteIndex)
{this.index=element.autocompleteIndex;this.render();}
Event.stop(event);},onClick:function(event){var element=Event.findElement(event,'LI');this.index=element.autocompleteIndex;this.selectEntry();this.hide();},onBlur:function(event){setTimeout(this.hide.bind(this),250);this.hasFocus=false;this.active=false;},render:function(){if(this.entryCount>0){for(var i=0;i<this.entryCount;i++)
this.index==i?Element.addClassName(this.getEntry(i),"selected"):Element.removeClassName(this.getEntry(i),"selected");if(this.hasFocus){this.show();this.active=true;}}else{this.active=false;this.hide();}},markPrevious:function(){if(this.index>0)this.index--;else this.index=this.entryCount-1;this.getEntry(this.index).scrollIntoView(true);},markNext:function(){if(this.index<this.entryCount-1)this.index++;else this.index=0;this.getEntry(this.index).scrollIntoView(false);},getEntry:function(index){return this.update.firstChild.childNodes[index];},getCurrentEntry:function(){return this.getEntry(this.index);},selectEntry:function(){this.active=false;this.updateElement(this.getCurrentEntry());},updateElement:function(selectedElement){if(this.options.updateElement){this.options.updateElement(selectedElement);return;}
var value='';if(this.options.select){var nodes=$(selectedElement).select('.'+this.options.select)||[];if(nodes.length>0)value=Element.collectTextNodes(nodes[0],this.options.select);}else
value=Element.collectTextNodesIgnoreClass(selectedElement,'informal');var bounds=this.getTokenBounds();if(bounds[0]!=-1){var newValue=this.element.value.substr(0,bounds[0]);var whitespace=this.element.value.substr(bounds[0]).match(/^\s+/);if(whitespace)
newValue+=whitespace[0];this.element.value=newValue+value+this.element.value.substr(bounds[1]);}else{this.element.value=value;}
this.oldElementValue=this.element.value;this.element.focus();if(this.options.afterUpdateElement)
this.options.afterUpdateElement(this.element,selectedElement);},updateChoices:function(choices){if(!this.changed&&this.hasFocus){this.update.innerHTML=choices;Element.cleanWhitespace(this.update);Element.cleanWhitespace(this.update.down());if(this.update.firstChild&&this.update.down().childNodes){this.entryCount=this.update.down().childNodes.length;for(var i=0;i<this.entryCount;i++){var entry=this.getEntry(i);entry.autocompleteIndex=i;this.addObservers(entry);}}else{this.entryCount=0;}
this.stopIndicator();this.index=0;if(this.entryCount==1&&this.options.autoSelect){this.selectEntry();this.hide();}else{this.render();}}},addObservers:function(element){Event.observe(element,"mouseover",this.onHover.bindAsEventListener(this));Event.observe(element,"click",this.onClick.bindAsEventListener(this));},onObserverEvent:function(){this.changed=false;this.tokenBounds=null;if(this.getToken().length>=this.options.minChars){this.getUpdatedChoices();}else{this.active=false;this.hide();}
this.oldElementValue=this.element.value;},getToken:function(){var bounds=this.getTokenBounds();return this.element.value.substring(bounds[0],bounds[1]).strip();},getTokenBounds:function(){if(null!=this.tokenBounds)return this.tokenBounds;var value=this.element.value;if(value.strip().empty())return[-1,0];var diff=arguments.callee.getFirstDifferencePos(value,this.oldElementValue);var offset=(diff==this.oldElementValue.length?1:0);var prevTokenPos=-1,nextTokenPos=value.length;var tp;for(var index=0,l=this.options.tokens.length;index<l;++index){tp=value.lastIndexOf(this.options.tokens[index],diff+offset-1);if(tp>prevTokenPos)prevTokenPos=tp;tp=value.indexOf(this.options.tokens[index],diff+offset);if(-1!=tp&&tp<nextTokenPos)nextTokenPos=tp;}
return(this.tokenBounds=[prevTokenPos+1,nextTokenPos]);}});Autocompleter.Base.prototype.getTokenBounds.getFirstDifferencePos=function(newS,oldS){var boundary=Math.min(newS.length,oldS.length);for(var index=0;index<boundary;++index)
if(newS[index]!=oldS[index])
return index;return boundary;};Ajax.Autocompleter=Class.create(Autocompleter.Base,{initialize:function(element,update,url,options){this.baseInitialize(element,update,options);this.options.asynchronous=true;this.options.onComplete=this.onComplete.bind(this);this.options.defaultParams=this.options.parameters||null;this.url=url;},getUpdatedChoices:function(){this.startIndicator();var entry=encodeURIComponent(this.options.paramName)+'='+
encodeURIComponent(this.getToken());this.options.parameters=this.options.callback?this.options.callback(this.element,entry):entry;if(this.options.defaultParams)
this.options.parameters+='&'+this.options.defaultParams;new Ajax.Request(this.url,this.options);},onComplete:function(request){this.updateChoices(request.responseText);}});Autocompleter.Local=Class.create(Autocompleter.Base,{initialize:function(element,update,array,options){this.baseInitialize(element,update,options);this.options.array=array;},getUpdatedChoices:function(){this.updateChoices(this.options.selector(this));},setOptions:function(options){this.options=Object.extend({choices:10,partialSearch:true,partialChars:2,ignoreCase:true,fullSearch:false,selector:function(instance){var ret=[];var partial=[];var entry=instance.getToken();var count=0;for(var i=0;i<instance.options.array.length&&ret.length<instance.options.choices;i++){var elem=instance.options.array[i];var foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase()):elem.indexOf(entry);while(foundPos!=-1){if(foundPos==0&&elem.length!=entry.length){ret.push("<li><strong>"+elem.substr(0,entry.length)+"</strong>"+
elem.substr(entry.length)+"</li>");break;}else if(entry.length>=instance.options.partialChars&&instance.options.partialSearch&&foundPos!=-1){if(instance.options.fullSearch||/\s/.test(elem.substr(foundPos-1,1))){partial.push("<li>"+elem.substr(0,foundPos)+"<strong>"+
elem.substr(foundPos,entry.length)+"</strong>"+elem.substr(foundPos+entry.length)+"</li>");break;}}
foundPos=instance.options.ignoreCase?elem.toLowerCase().indexOf(entry.toLowerCase(),foundPos+1):elem.indexOf(entry,foundPos+1);}}
if(partial.length)
ret=ret.concat(partial.slice(0,instance.options.choices-ret.length));return"<ul>"+ret.join('')+"</ul>";}},options||{});}});Field.scrollFreeActivate=function(field){setTimeout(function(){Field.activate(field);},1);};Ajax.InPlaceEditor=Class.create({initialize:function(element,url,options){this.url=url;this.element=element=$(element);this.prepareOptions();this._controls={};arguments.callee.dealWithDeprecatedOptions(options);Object.extend(this.options,options||{});if(!this.options.formId&&this.element.id){this.options.formId=this.element.id+'-inplaceeditor';if($(this.options.formId))
this.options.formId='';}
if(this.options.externalControl)
this.options.externalControl=$(this.options.externalControl);if(!this.options.externalControl)
this.options.externalControlOnly=false;this._originalBackground=this.element.getStyle('background-color')||'transparent';this.element.title=this.options.clickToEditText;this._boundCancelHandler=this.handleFormCancellation.bind(this);this._boundComplete=(this.options.onComplete||Prototype.emptyFunction).bind(this);this._boundFailureHandler=this.handleAJAXFailure.bind(this);this._boundSubmitHandler=this.handleFormSubmission.bind(this);this._boundWrapperHandler=this.wrapUp.bind(this);this.registerListeners();},checkForEscapeOrReturn:function(e){if(!this._editing||e.ctrlKey||e.altKey||e.shiftKey)return;if(Event.KEY_ESC==e.keyCode)
this.handleFormCancellation(e);else if(Event.KEY_RETURN==e.keyCode)
this.handleFormSubmission(e);},createControl:function(mode,handler,extraClasses){var control=this.options[mode+'Control'];var text=this.options[mode+'Text'];if('button'==control){var btn=document.createElement('input');btn.type='submit';btn.value=text;btn.className='editor_'+mode+'_button';if('cancel'==mode)
btn.onclick=this._boundCancelHandler;this._form.appendChild(btn);this._controls[mode]=btn;}else if('link'==control){var link=document.createElement('a');link.href='#';link.appendChild(document.createTextNode(text));link.onclick='cancel'==mode?this._boundCancelHandler:this._boundSubmitHandler;link.className='editor_inplace';if(extraClasses)
link.className+=' '+extraClasses;this._form.appendChild(link);this._controls[mode]=link;}},createEditField:function(){var text=(this.options.loadTextURL?this.options.loadingText:this.getText());var fld;if(1>=this.options.rows&&!/\r|\n/.test(this.getText())){fld=document.createElement('input');fld.type='text';var size=this.options.size||this.options.cols||0;if(0<size)fld.size=size;}else{fld=document.createElement('textarea');fld.rows=(1>=this.options.rows?this.options.autoRows:this.options.rows);fld.cols=this.options.cols||40;}
fld.name=this.options.paramName;fld.value=text;fld.className='form_input form_field_txt';if(this.options.submitOnBlur)
fld.onblur=this._boundSubmitHandler;this._controls.editor=fld;if(this.options.loadTextURL)
this.loadExternalText();this._form.appendChild(this._controls.editor);},createForm:function(){var ipe=this;function addText(mode,condition){var text=ipe.options['text'+mode+'Controls'];if(!text||condition===false)return;ipe._form.appendChild(document.createTextNode(text));};this._form=$(document.createElement('form'));this._form.id=this.options.formId;this._form.addClassName(this.options.formClassName);this._form.onsubmit=this._boundSubmitHandler;this.createEditField();if('textarea'==this._controls.editor.tagName.toLowerCase())
this._form.appendChild(document.createElement('br'));if(this.options.onFormCustomization)
this.options.onFormCustomization(this,this._form);addText('Before',this.options.okControl||this.options.cancelControl);this.createControl('ok',this._boundSubmitHandler);addText('Between',this.options.okControl&&this.options.cancelControl);this.createControl('cancel',this._boundCancelHandler,'editor_cancel');addText('After',this.options.okControl||this.options.cancelControl);},destroy:function(){if(this._oldInnerHTML)
this.element.innerHTML=this._oldInnerHTML;this.leaveEditMode();this.unregisterListeners();},enterEditMode:function(e){if(this._saving||this._editing)return;this._editing=true;this.triggerCallback('onEnterEditMode');if(this.options.externalControl)
this.options.externalControl.hide();this.element.hide();this.createForm();this.element.parentNode.insertBefore(this._form,this.element);if(!this.options.loadTextURL)
this.postProcessEditField();if(e)Event.stop(e);},enterHover:function(e){if(this.options.hoverClassName)
this.element.addClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onEnterHover');},getText:function(){return this.element.innerHTML.unescapeHTML();},handleAJAXFailure:function(transport){this.triggerCallback('onFailure',transport);if(this._oldInnerHTML){this.element.innerHTML=this._oldInnerHTML;this._oldInnerHTML=null;}},handleFormCancellation:function(e){this.wrapUp();if(e)Event.stop(e);},handleFormSubmission:function(e){var form=this._form;var value=$F(this._controls.editor);this.prepareSubmission();var params=this.options.callback(form,value)||'';if(Object.isString(params))
params=params.toQueryParams();params[this.options.paramName]=text_encode(value);params.editorId=this.element.id;if(this.options.htmlResponse){var options=Object.extend({evalScripts:true},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Updater({success:this.element},this.url,options);}else{var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:params,onComplete:this._boundWrapperHandler,onFailure:this._boundFailureHandler});new Ajax.Request(this.url,options);}
if(e)Event.stop(e);},leaveEditMode:function(){this.element.removeClassName(this.options.savingClassName);this.removeForm();this.leaveHover();this.element.style.backgroundColor=this._originalBackground;this.element.show();if(this.options.externalControl)
this.options.externalControl.show();this._saving=false;this._editing=false;this._oldInnerHTML=null;this.triggerCallback('onLeaveEditMode');},leaveHover:function(e){if(this.options.hoverClassName)
this.element.removeClassName(this.options.hoverClassName);if(this._saving)return;this.triggerCallback('onLeaveHover');},loadExternalText:function(){this._form.addClassName(this.options.loadingClassName);this._controls.editor.disabled=true;var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._form.removeClassName(this.options.loadingClassName);var text=transport.responseText;if(this.options.stripLoadedTextTags)
text=text.stripTags();this._controls.editor.value=urldecode(text);this._controls.editor.disabled=false;this.postProcessEditField();}.bind(this),onFailure:this._boundFailureHandler});new Ajax.Request(this.options.loadTextURL,options);},postProcessEditField:function(){var fpc=this.options.fieldPostCreation;if(fpc)
$(this._controls.editor)['focus'==fpc?'focus':'activate']();},prepareOptions:function(){this.options=Object.clone(Ajax.InPlaceEditor.DefaultOptions);Object.extend(this.options,Ajax.InPlaceEditor.DefaultCallbacks);[this._extraDefaultOptions].flatten().compact().each(function(defs){Object.extend(this.options,defs);}.bind(this));},prepareSubmission:function(){this._saving=true;this.removeForm();this.leaveHover();this.showSaving();},registerListeners:function(){this._listeners={};var listener;$H(Ajax.InPlaceEditor.Listeners).each(function(pair){listener=this[pair.value].bind(this);this._listeners[pair.key]=listener;if(!this.options.externalControlOnly)
this.element.observe(pair.key,listener);if(this.options.externalControl)
this.options.externalControl.observe(pair.key,listener);}.bind(this));},removeForm:function(){if(!this._form)return;this._form.remove();this._form=null;this._controls={};},showSaving:function(){this._oldInnerHTML=this.element.innerHTML;this.element.innerHTML=this.options.savingText;this.element.addClassName(this.options.savingClassName);this.element.style.backgroundColor=this._originalBackground;this.element.show();},triggerCallback:function(cbName,arg){if('function'==typeof this.options[cbName]){this.options[cbName](this,arg);}},unregisterListeners:function(){$H(this._listeners).each(function(pair){if(!this.options.externalControlOnly)
this.element.stopObserving(pair.key,pair.value);if(this.options.externalControl)
this.options.externalControl.stopObserving(pair.key,pair.value);}.bind(this));},wrapUp:function(transport){this.leaveEditMode();this._boundComplete(transport,this.element);}});Object.extend(Ajax.InPlaceEditor.prototype,{dispose:Ajax.InPlaceEditor.prototype.destroy});Ajax.InPlaceCollectionEditor=Class.create(Ajax.InPlaceEditor,{initialize:function($super,element,url,options){this._extraDefaultOptions=Ajax.InPlaceCollectionEditor.DefaultOptions;$super(element,url,options);},createEditField:function(){var list=document.createElement('select');list.name=this.options.paramName;list.size=1;this._controls.editor=list;this._collection=this.options.collection||[];if(this.options.loadCollectionURL)
this.loadCollection();else
this.checkForExternalText();this._form.appendChild(this._controls.editor);},loadCollection:function(){this._form.addClassName(this.options.loadingClassName);this.showLoadingText(this.options.loadingCollectionText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){var js=transport.responseText.strip();if(!/^\[.*\]$/.test(js))
throw('Server returned an invalid collection representation.');this._collection=eval(js);this.checkForExternalText();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadCollectionURL,options);},showLoadingText:function(text){this._controls.editor.disabled=true;var tempOption=this._controls.editor.firstChild;if(!tempOption){tempOption=document.createElement('option');tempOption.value='';this._controls.editor.appendChild(tempOption);tempOption.selected=true;}
tempOption.update((text||'').stripScripts().stripTags());},checkForExternalText:function(){this._text=this.getText();if(this.options.loadTextURL)
this.loadExternalText();else
this.buildOptionList();},loadExternalText:function(){this.showLoadingText(this.options.loadingText);var options=Object.extend({method:'get'},this.options.ajaxOptions);Object.extend(options,{parameters:'editorId='+encodeURIComponent(this.element.id),onComplete:Prototype.emptyFunction,onSuccess:function(transport){this._text=transport.responseText.strip();this.buildOptionList();}.bind(this),onFailure:this.onFailure});new Ajax.Request(this.options.loadTextURL,options);},buildOptionList:function(){this._form.removeClassName(this.options.loadingClassName);this._collection=this._collection.map(function(entry){return 2===entry.length?entry:[entry,entry].flatten();});var marker=('value'in this.options)?this.options.value:this._text;var textFound=this._collection.any(function(entry){return entry[0]==marker;}.bind(this));this._controls.editor.update('');var option;this._collection.each(function(entry,index){option=document.createElement('option');option.value=entry[0];option.selected=textFound?entry[0]==marker:0==index;option.appendChild(document.createTextNode(entry[1]));this._controls.editor.appendChild(option);}.bind(this));this._controls.editor.disabled=false;Field.scrollFreeActivate(this._controls.editor);}});Ajax.InPlaceEditor.prototype.initialize.dealWithDeprecatedOptions=function(options){if(!options)return;function fallback(name,expr){if(name in options||expr===undefined)return;options[name]=expr;};fallback('cancelControl',(options.cancelLink?'link':(options.cancelButton?'button':options.cancelLink==options.cancelButton==false?false:undefined)));fallback('okControl',(options.okLink?'link':(options.okButton?'button':options.okLink==options.okButton==false?false:undefined)));fallback('highlightColor',options.highlightcolor);fallback('highlightEndColor',options.highlightendcolor);};Object.extend(Ajax.InPlaceEditor,{DefaultOptions:{ajaxOptions:{},autoRows:3,cancelControl:'link',cancelText:'cancel',clickToEditText:'Click to edit',externalControl:null,externalControlOnly:false,fieldPostCreation:'activate',formClassName:'inplaceeditor-form',formId:null,highlightColor:'#ffff99',highlightEndColor:'#ffffff',hoverClassName:'',htmlResponse:true,loadingClassName:'inplaceeditor-loading',loadingText:'Loading...',okControl:'button',okText:'ok',paramName:'value',rows:1,savingClassName:'inplaceeditor-saving',savingText:'Saving...',size:0,stripLoadedTextTags:false,submitOnBlur:false,textAfterControls:'',textBeforeControls:'',textBetweenControls:''},DefaultCallbacks:{callback:function(form){return Form.serialize(form);},onComplete:function(transport,element){new Effect.Highlight(element,{startcolor:this.options.highlightColor,keepBackgroundImage:true});},onEnterEditMode:null,onEnterHover:function(ipe){ipe.element.style.backgroundColor=ipe.options.highlightColor;if(ipe._effect)
ipe._effect.cancel();},onFailure:function(transport,ipe){alert('Error communication with the server: '+transport.responseText.stripTags());},onFormCustomization:null,onLeaveEditMode:null,onLeaveHover:function(ipe){ipe._effect=new Effect.Highlight(ipe.element,{startcolor:ipe.options.highlightColor,endcolor:ipe.options.highlightEndColor,restorecolor:ipe._originalBackground,keepBackgroundImage:true});}},Listeners:{click:'enterEditMode',keydown:'checkForEscapeOrReturn',mouseover:'enterHover',mouseout:'leaveHover'}});Ajax.InPlaceCollectionEditor.DefaultOptions={loadingCollectionText:'Loading options...'};Form.Element.DelayedObserver=Class.create({initialize:function(element,delay,callback){this.delay=delay||0.5;this.element=$(element);this.callback=callback;this.timer=null;this.lastValue=$F(this.element);Event.observe(this.element,'keyup',this.delayedListener.bindAsEventListener(this));},delayedListener:function(event){if(this.lastValue==$F(this.element))return;if(this.timer)clearTimeout(this.timer);this.timer=setTimeout(this.onTimerEvent.bind(this),this.delay*1000);this.lastValue=$F(this.element);},onTimerEvent:function(){this.timer=null;this.callback(this.element,$F(this.element));}});
function Delegate(){}
Delegate.create=function(o,f){var a=new Array();var l=arguments.length;for(var i=2;i<l;i++)a[i-2]=arguments[i];return function(){var aP=[].concat(arguments,a);f.apply(o,aP);}}
Tween=function(obj,prop,func,begin,finish,duration,suffixe){this.init(obj,prop,func,begin,finish,duration,suffixe)}
var t=Tween.prototype;t.obj=new Object();t.prop='';t.func=function(t,b,c,d){return c*t/d+b;};t.begin=0;t.change=0;t.prevTime=0;t.prevPos=0;t.looping=false;t._duration=0;t._time=0;t._pos=0;t._position=0;t._startTime=0;t._finish=0;t.name='';t.suffixe='';t._listeners=new Array();t.setTime=function(t){this.prevTime=this._time;if(t>this.getDuration()){if(this.looping){this.rewind(t-this._duration);this.update();this.broadcastMessage('onMotionLooped',{target:this,type:'onMotionLooped'});}else{this._time=this._duration;this.update();this.stop();this.broadcastMessage('onMotionFinished',{target:this,type:'onMotionFinished'});}}else if(t<0){this.rewind();this.update();}else{this._time=t;this.update();}}
t.getTime=function(){return this._time;}
t.setDuration=function(d){this._duration=(d==null||d<=0)?100000:d;}
t.getDuration=function(){return this._duration;}
t.setPosition=function(p){this.prevPos=this._pos;var a=this.suffixe!=''?this.suffixe:'';this.obj[this.prop]=Math.round(p)+a;this._pos=p;this.broadcastMessage('onMotionChanged',{target:this,type:'onMotionChanged'});}
t.getPosition=function(t){if(t==undefined)t=this._time;return this.func(t,this.begin,this.change,this._duration);};t.setFinish=function(f){this.change=f-this.begin;};t.geFinish=function(){return this.begin+this.change;};t.init=function(obj,prop,func,begin,finish,duration,suffixe){if(!arguments.length)return;this._listeners=new Array();this.addListener(this);if(suffixe)this.suffixe=suffixe;this.obj=obj;this.prop=prop;this.begin=begin;this._pos=begin;this.setDuration(duration);if(func!=null&&func!=''){this.func=func;}
this.setFinish(finish);}
t.start=function(){this.rewind();this.startEnterFrame();this.broadcastMessage('onMotionStarted',{target:this,type:'onMotionStarted'});}
t.rewind=function(t){this.stop();this._time=(t==undefined)?0:t;this.fixTime();this.update();}
t.fforward=function(){this._time=this._duration;this.fixTime();this.update();}
t.update=function(){this.setPosition(this.getPosition(this._time));}
t.startEnterFrame=function(){this.stopEnterFrame();this.isPlaying=true;this.onEnterFrame();}
t.onEnterFrame=function(){if(this.isPlaying){this.nextFrame();setTimeout(Delegate.create(this,this.onEnterFrame),0);}}
t.nextFrame=function(){this.setTime((this.getTimer()-this._startTime)/1000);}
t.stop=function(){this.stopEnterFrame();this.broadcastMessage('onMotionStopped',{target:this,type:'onMotionStopped'});}
t.stopEnterFrame=function(){this.isPlaying=false;}
t.continueTo=function(finish,duration){this.begin=this._pos;this.setFinish(finish);if(this._duration!=undefined)
this.setDuration(duration);this.start();}
t.resume=function(){this.fixTime();this.startEnterFrame();this.broadcastMessage('onMotionResumed',{target:this,type:'onMotionResumed'});}
t.yoyo=function(){this.continueTo(this.begin,this._time);}
t.addListener=function(o){this.removeListener(o);return this._listeners.push(o);}
t.removeListener=function(o){var a=this._listeners;var i=a.length;while(i--){if(a[i]==o){a.splice(i,1);return true;}}
return false;}
t.broadcastMessage=function(){var arr=new Array();for(var i=0;i<arguments.length;i++){arr.push(arguments[i])}
var e=arr.shift();var a=this._listeners;var l=a.length;for(var i=0;i<l;i++){if(a[i][e])
a[i][e].apply(a[i],arr);}}
t.fixTime=function(){this._startTime=this.getTimer()-this._time*1000;}
t.getTimer=function(){return new Date().getTime()-this._time;}
Tween.backEaseIn=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*(t/=d)*t*((s+1)*t-s)+b;}
Tween.backEaseOut=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;return c*((t=t/d-1)*t*((s+1)*t+s)+1)+b;}
Tween.backEaseInOut=function(t,b,c,d,a,p){if(s==undefined)var s=1.70158;if((t/=d/2)<1)return c/2*(t*t*(((s*=(1.525))+1)*t-s))+b;return c/2*((t-=2)*t*(((s*=(1.525))+1)*t+s)+2)+b;}
Tween.elasticEaseIn=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else
var s=p/(2*Math.PI)*Math.asin(c/a);return-(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;}
Tween.elasticEaseOut=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d)==1)return b+c;if(!p)p=d*.3;if(!a||a<Math.abs(c)){a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);return(a*Math.pow(2,-10*t)*Math.sin((t*d-s)*(2*Math.PI)/p)+c+b);}
Tween.elasticEaseInOut=function(t,b,c,d,a,p){if(t==0)return b;if((t/=d/2)==2)return b+c;if(!p)var p=d*(.3*1.5);if(!a||a<Math.abs(c)){var a=c;var s=p/4;}
else var s=p/(2*Math.PI)*Math.asin(c/a);if(t<1)return-.5*(a*Math.pow(2,10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p))+b;return a*Math.pow(2,-10*(t-=1))*Math.sin((t*d-s)*(2*Math.PI)/p)*.5+c+b;}
Tween.bounceEaseOut=function(t,b,c,d){if((t/=d)<(1/2.75)){return c*(7.5625*t*t)+b;}else if(t<(2/2.75)){return c*(7.5625*(t-=(1.5/2.75))*t+.75)+b;}else if(t<(2.5/2.75)){return c*(7.5625*(t-=(2.25/2.75))*t+.9375)+b;}else{return c*(7.5625*(t-=(2.625/2.75))*t+.984375)+b;}}
Tween.bounceEaseIn=function(t,b,c,d){return c-Tween.bounceEaseOut(d-t,0,c,d)+b;}
Tween.bounceEaseInOut=function(t,b,c,d){if(t<d/2)return Tween.bounceEaseIn(t*2,0,c,d)*.5+b;else return Tween.bounceEaseOut(t*2-d,0,c,d)*.5+c*.5+b;}
Tween.strongEaseInOut=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;}
Tween.regularEaseIn=function(t,b,c,d){return c*(t/=d)*t+b;}
Tween.regularEaseOut=function(t,b,c,d){return-c*(t/=d)*(t-2)+b;}
Tween.regularEaseInOut=function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t+b;return-c/2*((--t)*(t-2)-1)+b;}
Tween.strongEaseIn=function(t,b,c,d){return c*(t/=d)*t*t*t*t+b;}
Tween.strongEaseOut=function(t,b,c,d){return c*((t=t/d-1)*t*t*t*t+1)+b;}
Tween.strongEaseInOut=function(t,b,c,d){if((t/=d/2)<1)return c/2*t*t*t*t*t+b;return c/2*((t-=2)*t*t*t*t+2)+b;}
ColorTween.prototype=new Tween();ColorTween.prototype.constructor=Tween;ColorTween.superclass=Tween.prototype;function ColorTween(obj,prop,func,fromColor,toColor,duration){this.targetObject=obj;this.targetProperty=prop;this.fromColor=fromColor;this.toColor=toColor;this.init(new Object(),'x',func,0,100,duration);this.listenerObj=new Object();this.listenerObj.onMotionChanged=Delegate.create(this,this.onColorChanged);this.addListener(this.listenerObj);}
var o=ColorTween.prototype;o.targetObject={};o.targetProperty={};o.fromColor='';o.toColor='';o.currentColor='';o.listenerObj={};o.onColorChanged=function(){this.currentColor=this.getColor(this.fromColor,this.toColor,this._pos);this.targetObject[this.targetProperty]=this.currentColor;}
o.getColor=function(start,end,percent)
{var r1=this.hex2dec(start.slice(0,2));var g1=this.hex2dec(start.slice(2,4));var b1=this.hex2dec(start.slice(4,6));var r2=this.hex2dec(end.slice(0,2));var g2=this.hex2dec(end.slice(2,4));var b2=this.hex2dec(end.slice(4,6));var pc=percent/100;r=Math.floor(r1+(pc*(r2-r1))+.5);g=Math.floor(g1+(pc*(g2-g1))+.5);b=Math.floor(b1+(pc*(b2-b1))+.5);return("#"+this.dec2hex(r)+this.dec2hex(g)+this.dec2hex(b));}
o.dec2hex=function(dec){return(this.hexDigit[dec>>4]+this.hexDigit[dec&15]);}
o.hexDigit=new Array("0","1","2","3","4","5","6","7","8","9","A","B","C","D","E","F");o.hex2dec=function(hex){return(parseInt(hex,16))};
var config=new Object();var tt_Debug=true
var tt_Enabled=true
var TagsToTip=true
config.Above=false
config.BgColor=''
config.BgImg=''
config.BorderColor=''
config.BorderStyle='solid'
config.BorderWidth=0
config.CenterMouse=false
config.ClickClose=false
config.ClickSticky=false
config.CloseBtn=false
config.CloseBtnColors=['#990000','#FFFFFF','#DD3333','#FFFFFF']
config.CloseBtnText='&nbsp;X&nbsp;'
config.CopyContent=true
config.Delay=400
config.Duration=0
config.Exclusive=false
config.FadeIn=500
config.FadeOut=100
config.FadeInterval=30
config.Fix=null
config.FollowMouse=true
config.FontColor='#000044'
config.FontFace='Verdana,Geneva,sans-serif'
config.FontSize='8pt'
config.FontWeight='normal'
config.Height=0
config.JumpHorz=false
config.JumpVert=true
config.Left=false
config.OffsetX=14
config.OffsetY=8
config.Opacity=100
config.Padding=3
config.Shadow=false
config.ShadowColor='#C0C0C0'
config.ShadowWidth=5
config.Sticky=false
config.TextAlign='left'
config.Title=''
config.TitleAlign='left'
config.TitleBgColor=''
config.TitleFontColor='#FFFFFF'
config.TitleFontFace=''
config.TitleFontSize=''
config.TitlePadding=2
config.Width=0
function Tip()
{tt_Tip(arguments,null);}
function TagToTip()
{var t2t=tt_GetElt(arguments[0]);if(t2t)
tt_Tip(arguments,t2t);}
function UnTip()
{tt_OpReHref();if(tt_aV[DURATION]<0&&(tt_iState&0x2))
tt_tDurt.Timer("tt_HideInit()",-tt_aV[DURATION],true);else if(!(tt_aV[STICKY]&&(tt_iState&0x2)))
tt_HideInit();}
var tt_aElt=new Array(10),tt_aV=new Array(),tt_sContent,tt_t2t,tt_t2tDad,tt_musX,tt_musY,tt_over,tt_x,tt_y,tt_w,tt_h;function tt_Extension()
{tt_ExtCmdEnum();tt_aExt[tt_aExt.length]=this;return this;}
function tt_SetTipPos(x,y)
{var css=tt_aElt[0].style;tt_x=x;tt_y=y;css.left=x+"px";css.top=y+"px";if(tt_ie56)
{var ifrm=tt_aElt[tt_aElt.length-1];if(ifrm)
{ifrm.style.left=css.left;ifrm.style.top=css.top;}}}
function tt_HideInit()
{if(tt_iState)
{tt_ExtCallFncs(0,"HideInit");tt_iState&=~(0x4|0x8);if(tt_flagOpa&&tt_aV[FADEOUT])
{tt_tFade.EndTimer();if(tt_opa)
{var n=Math.round(tt_aV[FADEOUT]/(tt_aV[FADEINTERVAL]*(tt_aV[OPACITY]/tt_opa)));tt_Fade(tt_opa,tt_opa,0,n);return;}}
tt_tHide.Timer("tt_Hide();",1,false);}}
function tt_Hide()
{if(tt_db&&tt_iState)
{tt_OpReHref();if(tt_iState&0x2)
{tt_aElt[0].style.visibility="hidden";tt_ExtCallFncs(0,"Hide");}
tt_tShow.EndTimer();tt_tHide.EndTimer();tt_tDurt.EndTimer();tt_tFade.EndTimer();if(!tt_op&&!tt_ie)
{tt_tWaitMov.EndTimer();tt_bWait=false;}
if(tt_aV[CLICKCLOSE]||tt_aV[CLICKSTICKY])
tt_RemEvtFnc(document,"mouseup",tt_OnLClick);tt_ExtCallFncs(0,"Kill");if(tt_t2t&&!tt_aV[COPYCONTENT])
tt_UnEl2Tip();tt_iState=0;tt_over=null;tt_ResetMainDiv();if(tt_aElt[tt_aElt.length-1])
tt_aElt[tt_aElt.length-1].style.display="none";}}
function tt_GetElt(id)
{return(document.getElementById?document.getElementById(id):document.all?document.all[id]:null);}
function tt_GetDivW(el)
{return(el?(el.offsetWidth||el.style.pixelWidth||0):0);}
function tt_GetDivH(el)
{return(el?(el.offsetHeight||el.style.pixelHeight||0):0);}
function tt_GetScrollX()
{return(window.pageXOffset||(tt_db?(tt_db.scrollLeft||0):0));}
function tt_GetScrollY()
{return(window.pageYOffset||(tt_db?(tt_db.scrollTop||0):0));}
function tt_GetClientW()
{return tt_GetWndCliSiz("Width");}
function tt_GetClientH()
{return tt_GetWndCliSiz("Height");}
function tt_GetEvtX(e)
{return(e?((typeof(e.pageX)!=tt_u)?e.pageX:(e.clientX+tt_GetScrollX())):0);}
function tt_GetEvtY(e)
{return(e?((typeof(e.pageY)!=tt_u)?e.pageY:(e.clientY+tt_GetScrollY())):0);}
function tt_AddEvtFnc(el,sEvt,PFnc)
{if(el)
{if(el.addEventListener)
el.addEventListener(sEvt,PFnc,false);else
el.attachEvent("on"+sEvt,PFnc);}}
function tt_RemEvtFnc(el,sEvt,PFnc)
{if(el)
{if(el.removeEventListener)
el.removeEventListener(sEvt,PFnc,false);else
el.detachEvent("on"+sEvt,PFnc);}}
function tt_GetDad(el)
{return(el.parentNode||el.parentElement||el.offsetParent);}
function tt_MovDomNode(el,dadFrom,dadTo)
{if(dadFrom)
dadFrom.removeChild(el);if(dadTo)
dadTo.appendChild(el);}
var tt_aExt=new Array(),tt_db,tt_op,tt_ie,tt_ie56,tt_bBoxOld,tt_body,tt_ovr_,tt_flagOpa,tt_maxPosX,tt_maxPosY,tt_iState=0,tt_opa,tt_bJmpVert,tt_bJmpHorz,tt_elDeHref,tt_tShow=new Number(0),tt_tHide=new Number(0),tt_tDurt=new Number(0),tt_tFade=new Number(0),tt_tWaitMov=new Number(0),tt_bWait=false,tt_u="undefined";function tt_Init()
{tt_MkCmdEnum();if(!tt_Browser()||!tt_MkMainDiv())
return;tt_IsW3cBox();tt_OpaSupport();tt_AddEvtFnc(document,"mousemove",tt_Move);if(TagsToTip||tt_Debug)
tt_SetOnloadFnc();tt_AddEvtFnc(window,"unload",tt_Hide);}
function tt_MkCmdEnum()
{var n=0;for(var i in config)
eval("window."+i.toString().toUpperCase()+" = "+n++);tt_aV.length=n;}
function tt_Browser()
{var n,nv,n6,w3c;n=navigator.userAgent.toLowerCase(),nv=navigator.appVersion;tt_op=(document.defaultView&&typeof(eval("w"+"indow"+"."+"o"+"p"+"er"+"a"))!=tt_u);tt_ie=n.indexOf("msie")!=-1&&document.all&&!tt_op;if(tt_ie)
{var ieOld=(!document.compatMode||document.compatMode=="BackCompat");tt_db=!ieOld?document.documentElement:(document.body||null);if(tt_db)
tt_ie56=parseFloat(nv.substring(nv.indexOf("MSIE")+5))>=5.5&&typeof document.body.style.maxHeight==tt_u;}
else
{tt_db=document.documentElement||document.body||(document.getElementsByTagName?document.getElementsByTagName("body")[0]:null);if(!tt_op)
{n6=document.defaultView&&typeof document.defaultView.getComputedStyle!=tt_u;w3c=!n6&&document.getElementById;}}
tt_body=(document.getElementsByTagName?document.getElementsByTagName("body")[0]:(document.body||null));if(tt_ie||n6||tt_op||w3c)
{if(tt_body&&tt_db)
{if(document.attachEvent||document.addEventListener)
return true;}
else
tt_Err("wz_tooltip.js must be included INSIDE the body section,"
+" immediately after the opening <body> tag.",false);}
tt_db=null;return false;}
function tt_MkMainDiv()
{if(tt_body.insertAdjacentHTML)
tt_body.insertAdjacentHTML("afterBegin",tt_MkMainDivHtm());else if(typeof tt_body.innerHTML!=tt_u&&document.createElement&&tt_body.appendChild)
tt_body.appendChild(tt_MkMainDivDom());if(window.tt_GetMainDivRefs&&tt_GetMainDivRefs())
return true;tt_db=null;return false;}
function tt_MkMainDivHtm()
{return('<div id="WzTtDiV"></div>'+
(tt_ie56?('<iframe id="WzTtIfRm" src="javascript:false" scrolling="no" frameborder="0" style="filter:Alpha(opacity=0);position:absolute;top:0px;left:0px;display:none;"></iframe>'):''));}
function tt_MkMainDivDom()
{var el=document.createElement("div");if(el)
el.id="WzTtDiV";return el;}
function tt_GetMainDivRefs()
{tt_aElt[0]=tt_GetElt("WzTtDiV");if(tt_ie56&&tt_aElt[0])
{tt_aElt[tt_aElt.length-1]=tt_GetElt("WzTtIfRm");if(!tt_aElt[tt_aElt.length-1])
tt_aElt[0]=null;}
if(tt_aElt[0])
{var css=tt_aElt[0].style;css.visibility="hidden";css.position="absolute";css.overflow="hidden";return true;}
return false;}
function tt_ResetMainDiv()
{tt_SetTipPos(0,0);tt_aElt[0].innerHTML="";tt_aElt[0].style.width="0px";tt_h=0;}
function tt_IsW3cBox()
{var css=tt_aElt[0].style;css.padding="10px";css.width="40px";tt_bBoxOld=(tt_GetDivW(tt_aElt[0])==40);css.padding="0px";tt_ResetMainDiv();}
function tt_OpaSupport()
{var css=tt_body.style;tt_flagOpa=(typeof(css.KhtmlOpacity)!=tt_u)?2:(typeof(css.KHTMLOpacity)!=tt_u)?3:(typeof(css.MozOpacity)!=tt_u)?4:(typeof(css.opacity)!=tt_u)?5:(typeof(css.filter)!=tt_u)?1:0;}
function tt_SetOnloadFnc()
{tt_AddEvtFnc(document,"DOMContentLoaded",tt_HideSrcTags);tt_AddEvtFnc(window,"load",tt_HideSrcTags);if(tt_body.attachEvent)
tt_body.attachEvent("onreadystatechange",function(){if(tt_body.readyState=="complete")
tt_HideSrcTags();});if(/WebKit|KHTML/i.test(navigator.userAgent))
{var t=setInterval(function(){if(/loaded|complete/.test(document.readyState))
{clearInterval(t);tt_HideSrcTags();}},10);}}
function tt_HideSrcTags()
{if(!window.tt_HideSrcTags||window.tt_HideSrcTags.done)
return;window.tt_HideSrcTags.done=true;if(!tt_HideSrcTagsRecurs(tt_body))
tt_Err("There are HTML elements to be converted to tooltips.\nIf you"
+" want these HTML elements to be automatically hidden, you"
+" must edit wz_tooltip.js, and set TagsToTip in the global"
+" tooltip configuration to true.",true);}
function tt_HideSrcTagsRecurs(dad)
{var ovr,asT2t;var a=dad.childNodes||dad.children||null;for(var i=a?a.length:0;i;)
{--i;if(!tt_HideSrcTagsRecurs(a[i]))
return false;ovr=a[i].getAttribute?(a[i].getAttribute("onmouseover")||a[i].getAttribute("onclick")):(typeof a[i].onmouseover=="function")?(a[i].onmouseover||a[i].onclick):null;if(ovr)
{asT2t=ovr.toString().match(/TagToTip\s*\(\s*'[^'.]+'\s*[\),]/);if(asT2t&&asT2t.length)
{if(!tt_HideSrcTag(asT2t[0]))
return false;}}}
return true;}
function tt_HideSrcTag(sT2t)
{var id,el;id=sT2t.replace(/.+'([^'.]+)'.+/,"$1");el=tt_GetElt(id);if(el)
{if(tt_Debug&&!TagsToTip)
return false;else
el.style.display="none";}
else
tt_Err("Invalid ID\n'"+id+"'\npassed to TagToTip()."
+" There exists no HTML element with that ID.",true);return true;}
function tt_Tip(arg,t2t)
{if(!tt_db||(tt_iState&0x8))
return;if(tt_iState)
tt_Hide();if(!tt_Enabled)
return;tt_t2t=t2t;if(!tt_ReadCmds(arg))
return;tt_iState=0x1|0x4;tt_AdaptConfig1();tt_MkTipContent(arg);tt_MkTipSubDivs();tt_FormatTip();tt_bJmpVert=false;tt_bJmpHorz=false;tt_maxPosX=tt_GetClientW()+tt_GetScrollX()-tt_w-1;tt_maxPosY=tt_GetClientH()+tt_GetScrollY()-tt_h-1;tt_AdaptConfig2();tt_OverInit();tt_ShowInit();tt_Move();}
function tt_ReadCmds(a)
{var i;i=0;for(var j in config)
tt_aV[i++]=config[j];if(a.length&1)
{for(i=a.length-1;i>0;i-=2)
tt_aV[a[i-1]]=a[i];return true;}
tt_Err("Incorrect call of Tip() or TagToTip().\n"
+"Each command must be followed by a value.",true);return false;}
function tt_AdaptConfig1()
{tt_ExtCallFncs(0,"LoadConfig");if(!tt_aV[TITLEBGCOLOR].length)
tt_aV[TITLEBGCOLOR]=tt_aV[BORDERCOLOR];if(!tt_aV[TITLEFONTCOLOR].length)
tt_aV[TITLEFONTCOLOR]=tt_aV[BGCOLOR];if(!tt_aV[TITLEFONTFACE].length)
tt_aV[TITLEFONTFACE]=tt_aV[FONTFACE];if(!tt_aV[TITLEFONTSIZE].length)
tt_aV[TITLEFONTSIZE]=tt_aV[FONTSIZE];if(tt_aV[CLOSEBTN])
{if(!tt_aV[CLOSEBTNCOLORS])
tt_aV[CLOSEBTNCOLORS]=new Array("","","","");for(var i=4;i;)
{--i;if(!tt_aV[CLOSEBTNCOLORS][i].length)
tt_aV[CLOSEBTNCOLORS][i]=(i&1)?tt_aV[TITLEFONTCOLOR]:tt_aV[TITLEBGCOLOR];}
if(!tt_aV[TITLE].length)
tt_aV[TITLE]=" ";}
if(tt_aV[OPACITY]==100&&typeof tt_aElt[0].style.MozOpacity!=tt_u&&!Array.every)
tt_aV[OPACITY]=99;if(tt_aV[FADEIN]&&tt_flagOpa&&tt_aV[DELAY]>100)
tt_aV[DELAY]=Math.max(tt_aV[DELAY]-tt_aV[FADEIN],100);}
function tt_AdaptConfig2()
{if(tt_aV[CENTERMOUSE])
{tt_aV[OFFSETX]-=((tt_w-(tt_aV[SHADOW]?tt_aV[SHADOWWIDTH]:0))>>1);tt_aV[JUMPHORZ]=false;}}
function tt_MkTipContent(a)
{if(tt_t2t)
{if(tt_aV[COPYCONTENT])
tt_sContent=tt_t2t.innerHTML;else
tt_sContent="";}
else
tt_sContent=a[0];tt_ExtCallFncs(0,"CreateContentString");}
function tt_MkTipSubDivs()
{var sCss='position:relative;margin:0px;padding:0px;border-width:0px;left:0px;top:0px;line-height:normal;width:auto;',sTbTrTd=' cellspacing="0" cellpadding="0" border="0" style="'+sCss+'"><tbody style="'+sCss+'"><tr><td ';tt_aElt[0].style.width=tt_GetClientW()+"px";tt_aElt[0].innerHTML=(''
+(tt_aV[TITLE].length?('<div id="WzTiTl" style="position:relative;z-index:1;">'
+'<table id="WzTiTlTb"'+sTbTrTd+'id="WzTiTlI" style="'+sCss+'">'
+tt_aV[TITLE]
+'</td>'
+(tt_aV[CLOSEBTN]?('<td align="right" style="'+sCss
+'text-align:right;">'
+'<span id="WzClOsE" style="position:relative;left:2px;padding-left:2px;padding-right:2px;'
+'cursor:'+(tt_ie?'hand':'pointer')
+';" onmouseover="tt_OnCloseBtnOver(1)" onmouseout="tt_OnCloseBtnOver(0)" onclick="tt_HideInit()">'
+tt_aV[CLOSEBTNTEXT]
+'</span></td>'):'')
+'</tr></tbody></table></div>'):'')
+'<div id="WzBoDy" style="position:relative;z-index:0;">'
+'<table'+sTbTrTd+'id="WzBoDyI" style="'+sCss+'">'
+tt_sContent
+'</td></tr></tbody></table></div>'
+(tt_aV[SHADOW]?('<div id="WzTtShDwR" style="position:absolute;overflow:hidden;"></div>'
+'<div id="WzTtShDwB" style="position:relative;overflow:hidden;"></div>'):''));tt_GetSubDivRefs();if(tt_t2t&&!tt_aV[COPYCONTENT])
tt_El2Tip();tt_ExtCallFncs(0,"SubDivsCreated");}
function tt_GetSubDivRefs()
{var aId=new Array("WzTiTl","WzTiTlTb","WzTiTlI","WzClOsE","WzBoDy","WzBoDyI","WzTtShDwB","WzTtShDwR");for(var i=aId.length;i;--i)
tt_aElt[i]=tt_GetElt(aId[i-1]);}
function tt_FormatTip()
{var css,w,h,pad=tt_aV[PADDING],padT,wBrd=tt_aV[BORDERWIDTH],iOffY,iOffSh,iAdd=(pad+wBrd)<<1;if(tt_aV[TITLE].length)
{padT=tt_aV[TITLEPADDING];css=tt_aElt[1].style;css.background=tt_aV[TITLEBGCOLOR];css.paddingTop=css.paddingBottom=padT+"px";css.paddingLeft=css.paddingRight=(padT+2)+"px";css=tt_aElt[3].style;css.color=tt_aV[TITLEFONTCOLOR];if(tt_aV[WIDTH]==-1)
css.whiteSpace="nowrap";css.fontFamily=tt_aV[TITLEFONTFACE];css.fontSize=tt_aV[TITLEFONTSIZE];css.fontWeight="bold";css.textAlign=tt_aV[TITLEALIGN];if(tt_aElt[4])
{css=tt_aElt[4].style;css.background=tt_aV[CLOSEBTNCOLORS][0];css.color=tt_aV[CLOSEBTNCOLORS][1];css.fontFamily=tt_aV[TITLEFONTFACE];css.fontSize=tt_aV[TITLEFONTSIZE];css.fontWeight="bold";}
if(tt_aV[WIDTH]>0)
tt_w=tt_aV[WIDTH];else
{tt_w=tt_GetDivW(tt_aElt[3])+tt_GetDivW(tt_aElt[4]);if(tt_aElt[4])
tt_w+=pad;if(tt_aV[WIDTH]<-1&&tt_w>-tt_aV[WIDTH])
tt_w=-tt_aV[WIDTH];}
iOffY=-wBrd;}
else
{tt_w=0;iOffY=0;}
css=tt_aElt[5].style;css.top=iOffY+"px";if(wBrd)
{css.borderColor=tt_aV[BORDERCOLOR];css.borderStyle=tt_aV[BORDERSTYLE];css.borderWidth=wBrd+"px";}
if(tt_aV[BGCOLOR].length)
css.background=tt_aV[BGCOLOR];if(tt_aV[BGIMG].length)
css.backgroundImage="url("+tt_aV[BGIMG]+")";css.padding=pad+"px";css.textAlign=tt_aV[TEXTALIGN];if(tt_aV[HEIGHT])
{css.overflow="auto";if(tt_aV[HEIGHT]>0)
css.height=(tt_aV[HEIGHT]+iAdd)+"px";else
tt_h=iAdd-tt_aV[HEIGHT];}
css=tt_aElt[6].style;css.color=tt_aV[FONTCOLOR];css.fontFamily=tt_aV[FONTFACE];css.fontSize=tt_aV[FONTSIZE];css.fontWeight=tt_aV[FONTWEIGHT];css.textAlign=tt_aV[TEXTALIGN];if(tt_aV[WIDTH]>0)
w=tt_aV[WIDTH];else if(tt_aV[WIDTH]==-1&&tt_w)
w=tt_w;else
{w=tt_GetDivW(tt_aElt[6]);if(tt_aV[WIDTH]<-1&&w>-tt_aV[WIDTH])
w=-tt_aV[WIDTH];}
if(w>tt_w)
tt_w=w;tt_w+=iAdd;if(tt_aV[SHADOW])
{tt_w+=tt_aV[SHADOWWIDTH];iOffSh=Math.floor((tt_aV[SHADOWWIDTH]*4)/3);css=tt_aElt[7].style;css.top=iOffY+"px";css.left=iOffSh+"px";css.width=(tt_w-iOffSh-tt_aV[SHADOWWIDTH])+"px";css.height=tt_aV[SHADOWWIDTH]+"px";css.background=tt_aV[SHADOWCOLOR];css=tt_aElt[8].style;css.top=iOffSh+"px";css.left=(tt_w-tt_aV[SHADOWWIDTH])+"px";css.width=tt_aV[SHADOWWIDTH]+"px";css.background=tt_aV[SHADOWCOLOR];}
else
iOffSh=0;tt_SetTipOpa(tt_aV[FADEIN]?0:tt_aV[OPACITY]);tt_FixSize(iOffY,iOffSh);}
function tt_FixSize(iOffY,iOffSh)
{var wIn,wOut,h,add,pad=tt_aV[PADDING],wBrd=tt_aV[BORDERWIDTH],i;tt_aElt[0].style.width=tt_w+"px";tt_aElt[0].style.pixelWidth=tt_w;wOut=tt_w-((tt_aV[SHADOW])?tt_aV[SHADOWWIDTH]:0);wIn=wOut;if(!tt_bBoxOld)
wIn-=(pad+wBrd)<<1;tt_aElt[5].style.width=wIn+"px";if(tt_aElt[1])
{wIn=wOut-((tt_aV[TITLEPADDING]+2)<<1);if(!tt_bBoxOld)
wOut=wIn;tt_aElt[1].style.width=wOut+"px";tt_aElt[2].style.width=wIn+"px";}
if(tt_h)
{h=tt_GetDivH(tt_aElt[5]);if(h>tt_h)
{if(!tt_bBoxOld)
tt_h-=(pad+wBrd)<<1;tt_aElt[5].style.height=tt_h+"px";}}
tt_h=tt_GetDivH(tt_aElt[0])+iOffY;if(tt_aElt[8])
tt_aElt[8].style.height=(tt_h-iOffSh)+"px";i=tt_aElt.length-1;if(tt_aElt[i])
{tt_aElt[i].style.width=tt_w+"px";tt_aElt[i].style.height=tt_h+"px";}}
function tt_DeAlt(el)
{var aKid;if(el)
{if(el.alt)
el.alt="";if(el.title)
el.title="";aKid=el.childNodes||el.children||null;if(aKid)
{for(var i=aKid.length;i;)
tt_DeAlt(aKid[--i]);}}}
function tt_OpDeHref(el)
{if(!tt_op)
return;if(tt_elDeHref)
tt_OpReHref();while(el)
{if(el.hasAttribute&&el.hasAttribute("href"))
{el.t_href=el.getAttribute("href");el.t_stats=window.status;el.removeAttribute("href");el.style.cursor="hand";tt_AddEvtFnc(el,"mousedown",tt_OpReHref);window.status=el.t_href;tt_elDeHref=el;break;}
el=tt_GetDad(el);}}
function tt_OpReHref()
{if(tt_elDeHref)
{tt_elDeHref.setAttribute("href",tt_elDeHref.t_href);tt_RemEvtFnc(tt_elDeHref,"mousedown",tt_OpReHref);window.status=tt_elDeHref.t_stats;tt_elDeHref=null;}}
function tt_El2Tip()
{var css=tt_t2t.style;tt_t2t.t_cp=css.position;tt_t2t.t_cl=css.left;tt_t2t.t_ct=css.top;tt_t2t.t_cd=css.display;tt_t2tDad=tt_GetDad(tt_t2t);tt_MovDomNode(tt_t2t,tt_t2tDad,tt_aElt[6]);css.display="block";css.position="static";css.left=css.top=css.marginLeft=css.marginTop="0px";}
function tt_UnEl2Tip()
{var css=tt_t2t.style;css.display=tt_t2t.t_cd;tt_MovDomNode(tt_t2t,tt_GetDad(tt_t2t),tt_t2tDad);css.position=tt_t2t.t_cp;css.left=tt_t2t.t_cl;css.top=tt_t2t.t_ct;tt_t2tDad=null;}
function tt_OverInit()
{if(window.event)
tt_over=window.event.target||window.event.srcElement;else
tt_over=tt_ovr_;tt_DeAlt(tt_over);tt_OpDeHref(tt_over);}
function tt_ShowInit()
{tt_tShow.Timer("tt_Show()",tt_aV[DELAY],true);if(tt_aV[CLICKCLOSE]||tt_aV[CLICKSTICKY])
tt_AddEvtFnc(document,"mouseup",tt_OnLClick);}
function tt_Show()
{var css=tt_aElt[0].style;css.zIndex=Math.max((window.dd&&dd.z)?(dd.z+2):0,1010);if(tt_aV[STICKY]||!tt_aV[FOLLOWMOUSE])
tt_iState&=~0x4;if(tt_aV[EXCLUSIVE])
tt_iState|=0x8;if(tt_aV[DURATION]>0)
tt_tDurt.Timer("tt_HideInit()",tt_aV[DURATION],true);tt_ExtCallFncs(0,"Show")
css.visibility="visible";tt_iState|=0x2;if(tt_aV[FADEIN])
tt_Fade(0,0,tt_aV[OPACITY],Math.round(tt_aV[FADEIN]/tt_aV[FADEINTERVAL]));tt_ShowIfrm();}
function tt_ShowIfrm()
{if(tt_ie56)
{var ifrm=tt_aElt[tt_aElt.length-1];if(ifrm)
{var css=ifrm.style;css.zIndex=tt_aElt[0].style.zIndex-1;css.display="block";}}}
function tt_Move(e)
{if(e)
tt_ovr_=e.target||e.srcElement;e=e||window.event;if(e)
{tt_musX=tt_GetEvtX(e);tt_musY=tt_GetEvtY(e);}
if(tt_iState&0x4)
{if(!tt_op&&!tt_ie)
{if(tt_bWait)
return;tt_bWait=true;tt_tWaitMov.Timer("tt_bWait = false;",1,true);}
if(tt_aV[FIX])
{tt_iState&=~0x4;tt_PosFix();}
else if(!tt_ExtCallFncs(e,"MoveBefore"))
tt_SetTipPos(tt_Pos(0),tt_Pos(1));tt_ExtCallFncs([tt_musX,tt_musY],"MoveAfter")}}
function tt_Pos(iDim)
{var iX,bJmpMod,cmdAlt,cmdOff,cx,iMax,iScrl,iMus,bJmp;if(iDim)
{bJmpMod=tt_aV[JUMPVERT];cmdAlt=ABOVE;cmdOff=OFFSETY;cx=tt_h;iMax=tt_maxPosY;iScrl=tt_GetScrollY();iMus=tt_musY;bJmp=tt_bJmpVert;}
else
{bJmpMod=tt_aV[JUMPHORZ];cmdAlt=LEFT;cmdOff=OFFSETX;cx=tt_w;iMax=tt_maxPosX;iScrl=tt_GetScrollX();iMus=tt_musX;bJmp=tt_bJmpHorz;}
if(bJmpMod)
{if(tt_aV[cmdAlt]&&(!bJmp||tt_CalcPosAlt(iDim)>=iScrl+16))
iX=tt_PosAlt(iDim);else if(!tt_aV[cmdAlt]&&bJmp&&tt_CalcPosDef(iDim)>iMax-16)
iX=tt_PosAlt(iDim);else
iX=tt_PosDef(iDim);}
else
{iX=iMus;if(tt_aV[cmdAlt])
iX-=cx+tt_aV[cmdOff]-(tt_aV[SHADOW]?tt_aV[SHADOWWIDTH]:0);else
iX+=tt_aV[cmdOff];}
if(iX>iMax)
iX=bJmpMod?tt_PosAlt(iDim):iMax;if(iX<iScrl)
iX=bJmpMod?tt_PosDef(iDim):iScrl;return iX;}
function tt_PosDef(iDim)
{if(iDim)
tt_bJmpVert=tt_aV[ABOVE];else
tt_bJmpHorz=tt_aV[LEFT];return tt_CalcPosDef(iDim);}
function tt_PosAlt(iDim)
{if(iDim)
tt_bJmpVert=!tt_aV[ABOVE];else
tt_bJmpHorz=!tt_aV[LEFT];return tt_CalcPosAlt(iDim);}
function tt_CalcPosDef(iDim)
{return iDim?(tt_musY+tt_aV[OFFSETY]):(tt_musX+tt_aV[OFFSETX]);}
function tt_CalcPosAlt(iDim)
{var cmdOff=iDim?OFFSETY:OFFSETX;var dx=tt_aV[cmdOff]-(tt_aV[SHADOW]?tt_aV[SHADOWWIDTH]:0);if(tt_aV[cmdOff]>0&&dx<=0)
dx=1;return((iDim?(tt_musY-tt_h):(tt_musX-tt_w))-dx);}
function tt_PosFix()
{var iX,iY;if(typeof(tt_aV[FIX][0])=="number")
{iX=tt_aV[FIX][0];iY=tt_aV[FIX][1];}
else
{if(typeof(tt_aV[FIX][0])=="string")
el=tt_GetElt(tt_aV[FIX][0]);else
el=tt_aV[FIX][0];iX=tt_aV[FIX][1];iY=tt_aV[FIX][2];if(!tt_aV[ABOVE]&&el)
iY+=tt_GetDivH(el);for(;el;el=el.offsetParent)
{iX+=el.offsetLeft||0;iY+=el.offsetTop||0;}}
if(tt_aV[ABOVE])
iY-=tt_h;tt_SetTipPos(iX,iY);}
function tt_Fade(a,now,z,n)
{if(n)
{now+=Math.round((z-now)/n);if((z>a)?(now>=z):(now<=z))
now=z;else
tt_tFade.Timer("tt_Fade("
+a+","+now+","+z+","+(n-1)
+")",tt_aV[FADEINTERVAL],true);}
now?tt_SetTipOpa(now):tt_Hide();}
function tt_SetTipOpa(opa)
{tt_SetOpa(tt_aElt[5],opa);if(tt_aElt[1])
tt_SetOpa(tt_aElt[1],opa);if(tt_aV[SHADOW])
{opa=Math.round(opa*0.8);tt_SetOpa(tt_aElt[7],opa);tt_SetOpa(tt_aElt[8],opa);}}
function tt_OnCloseBtnOver(iOver)
{var css=tt_aElt[4].style;iOver<<=1;css.background=tt_aV[CLOSEBTNCOLORS][iOver];css.color=tt_aV[CLOSEBTNCOLORS][iOver+1];}
function tt_OnLClick(e)
{e=e||window.event;if(!((e.button&&e.button&2)||(e.which&&e.which==3)))
{if(tt_aV[CLICKSTICKY]&&(tt_iState&0x4))
{tt_aV[STICKY]=true;tt_iState&=~0x4;}
else if(tt_aV[CLICKCLOSE])
tt_HideInit();}}
function tt_Int(x)
{var y;return(isNaN(y=parseInt(x))?0:y);}
Number.prototype.Timer=function(s,iT,bUrge)
{if(!this.value||bUrge)
this.value=window.setTimeout(s,iT);}
Number.prototype.EndTimer=function()
{if(this.value)
{window.clearTimeout(this.value);this.value=0;}}
function tt_GetWndCliSiz(s)
{var db,y=window["inner"+s],sC="client"+s,sN="number";if(typeof y==sN)
{var y2;return(((db=document.body)&&typeof(y2=db[sC])==sN&&y2&&y2<=y)?y2:((db=document.documentElement)&&typeof(y2=db[sC])==sN&&y2&&y2<=y)?y2:y);}
return(((db=document.documentElement)&&(y=db[sC]))?y:document.body[sC]);}
function tt_SetOpa(el,opa)
{var css=el.style;tt_opa=opa;if(tt_flagOpa==1)
{if(opa<100)
{if(typeof(el.filtNo)==tt_u)
el.filtNo=css.filter;var bVis=css.visibility!="hidden";css.zoom="100%";if(!bVis)
css.visibility="visible";css.filter="alpha(opacity="+opa+")";if(!bVis)
css.visibility="hidden";}
else if(typeof(el.filtNo)!=tt_u)
css.filter=el.filtNo;}
else
{opa/=100.0;switch(tt_flagOpa)
{case 2:css.KhtmlOpacity=opa;break;case 3:css.KHTMLOpacity=opa;break;case 4:css.MozOpacity=opa;break;case 5:css.opacity=opa;break;}}}
function tt_Err(sErr,bIfDebug)
{if(tt_Debug||!bIfDebug)
alert("Tooltip Script Error Message:\n\n"+sErr);}
function tt_ExtCmdEnum()
{var s;for(var i in config)
{s="window."+i.toString().toUpperCase();if(eval("typeof("+s+") == tt_u"))
{eval(s+" = "+tt_aV.length);tt_aV[tt_aV.length]=null;}}}
function tt_ExtCallFncs(arg,sFnc)
{var b=false;for(var i=tt_aExt.length;i;)
{--i;var fnc=tt_aExt[i]["On"+sFnc];if(fnc&&fnc(arg))
b=true;}
return b;}
tt_Init();
(function($){$.fn.lazyload=function(options){var settings={threshold:0,failurelimit:0,event:"scroll",effect:"show",container:window};if(options){$.extend(settings,options);}
var elements=this;if("scroll"==settings.event){$(settings.container).bind("scroll",function(event){var counter=0;elements.each(function(){if($.abovethetop(this,settings)||$.leftofbegin(this,settings)){}else if(!$.belowthefold(this,settings)&&!$.rightoffold(this,settings)){$(this).trigger("appear");}else{if(counter++>settings.failurelimit){return false;}}});var temp=$.grep(elements,function(element){return!element.loaded;});elements=$(temp);});}
this.each(function(){var self=this;if(undefined==$(self).attr("original")){$(self).attr("original",$(self).attr("src"));}
if("scroll"!=settings.event||undefined==$(self).attr("src")||settings.placeholder==$(self).attr("src")||($.abovethetop(self,settings)||$.leftofbegin(self,settings)||$.belowthefold(self,settings)||$.rightoffold(self,settings))){if(settings.placeholder){$(self).attr("src",settings.placeholder);}else{$(self).removeAttr("src");}
self.loaded=false;}else{self.loaded=true;}
$(self).one("appear",function(){if(!this.loaded){$("<img />").bind("load",function(){$(self).hide().attr("src",$(self).attr("original"))
[settings.effect](settings.effectspeed);self.loaded=true;}).attr("src",$(self).attr("original"));};});if("scroll"!=settings.event){$(self).bind(settings.event,function(event){if(!self.loaded){$(self).trigger("appear");}});}});$(settings.container).trigger(settings.event);return this;};$.belowthefold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).height()+$(window).scrollTop();}else{var fold=$(settings.container).offset().top+$(settings.container).height();}
return fold<=$(element).offset().top-settings.threshold;};$.rightoffold=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).width()+$(window).scrollLeft();}else{var fold=$(settings.container).offset().left+$(settings.container).width();}
return fold<=$(element).offset().left-settings.threshold;};$.abovethetop=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollTop();}else{var fold=$(settings.container).offset().top;}
return fold>=$(element).offset().top+settings.threshold+$(element).height();};$.leftofbegin=function(element,settings){if(settings.container===undefined||settings.container===window){var fold=$(window).scrollLeft();}else{var fold=$(settings.container).offset().left;}
return fold>=$(element).offset().left+settings.threshold+$(element).width();};$.extend($.expr[':'],{"below-the-fold":"$.belowthefold(a, {threshold : 0, container: window})","above-the-fold":"!$.belowthefold(a, {threshold : 0, container: window})","right-of-fold":"$.rightoffold(a, {threshold : 0, container: window})","left-of-fold":"!$.rightoffold(a, {threshold : 0, container: window})"});})(jQuery);
function show_backpack_list(blog_name)
{new Ajax.Updater('backpack_list',PATH+"modules/backpack/list.php?p=1&blog_name="+blog_name,{evalScripts:true});}
function mark_notification_as_read(id)
{if(!document.sending){var obj=new Object();obj.onSuccess=function(data)
{document.sending=false;var v_data=data.responseText.split("|");if(v_data[0]==1){Effect.Fade($('div_notification_'+id));decrease_notifications();}}
new Ajax.Request(PATH+"modules/backpack/read.php?PHPSESSID="+PHPSESSID+"&id="+id,obj);document.sending=true;}}
function mark_notification_as_read_and_go(id,url)
{if(!document.sending){var obj=new Object();obj.onSuccess=function(data)
{document.sending=false;var v_data=data.responseText.split("|");if(v_data[0]==1){window.location.href=url;}}
new Ajax.Request(PATH+"modules/backpack/read.php?PHPSESSID="+PHPSESSID+"&id="+id,obj);document.sending=true;}}
function decrease_notifications()
{var current=Number($F('notification_count'));current--;$('notification_count').value=current;if(current==0){Effect.Fade('div_notification_top');Effect.Fade('div_notification_panel');Effect.Fade('div_friends_request');setTimeout(function(){Effect.Appear('div_notification_empty');},1000);}else{$('notification_count_top').update(current);$('notification_count_right').update(current);}}
function bookmark_init(open_create)
{if(window.location.href.split("#")[1]=="create"||window.location.href.split("#")[1]=="edit"||open_create){Effect.toggle('div_create_edit','slide',{duration:1.0});arrowSwitch('arrow_create_edit');setTimeout(function(){$('bookmark_name').focus();},1500)}}
addInitFunc(bookmark_init);function bookmark_save(blog_name)
{if(document.sending){$('div_msg_bookmark').update(MSG_WAIT);}else{if($F('bookmark_name')==""){$('div_msg_bookmark').update(MSG_MISSING_TITLE);$('bookmark_name').focus();}else
if($F('bookmark_url')==""){$('div_msg_bookmark').update(MSG_MISSING_URL);$('bookmark_url').focus();}else
if($F('bookmark_description')==""){$('div_msg_bookmark').update(MSG_MISSING_DESCRIPTION);$('bookmark_description').focus();}else{document.sending=true;show_js_alert(ALERT_OK,{message:MSG_SENDING,close:false});$('div_msg_bookmark').update('');var AJAX=new sack(PATH+"modules/bookmarks/save.php");AJAX.setVar("id",$F('bookmark_id'));AJAX.setVar("name",text_encode($F('bookmark_name')));AJAX.setVar("url",urlencode($F('bookmark_url')));AJAX.setVar("description",text_encode($F('bookmark_description')));AJAX.setVar("private",($F('bookmark_private'))?"1":"0");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");hide_js_alert();if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED,callback:function(){window.location.href=BLOGPATH+"bookmarks/";}});}else{show_js_alert(ALERT_OK,{message:MSG_SERVER_ERROR});}
document.sending=false;}
AJAX.runAJAX();}}}
function show_bookmark_list(blog_name,p)
{new Ajax.Updater('bookmark_list',PATH+"modules/bookmarks/list.php?blog_name="+blog_name+"&p="+p);}
function show_bookmark_list_ihtb(p,search)
{new Ajax.Updater('bookmark_list',PATH+"modules/bookmarks/ihtb_list.php?p="+p+"&search="+urlencode(search));}
function bookmark_delete(id)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){show_js_alert(ALERT_OK,{message:MSG_DELETING,close:false});var AJAX=new sack(PATH+"modules/bookmarks/delete.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");hide_js_alert();if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DELETED,callback:function(){gotoURL(BLOGPATH+"bookmarks/");}});}else{show_js_alert(ALERT_ERROR,{message:MSG_SERVER_ERROR});}
document.sending=false;}
AJAX.runAJAX();}}}
function bookmark_report(id)
{if(document.sending){show_js_alert(ALERT_WARNING,{message:MSG_WAIT});}else{document.sending=true;var AJAX=new sack(PATH+"modules/bookmarks/broken.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{document.sending=false;hide_js_alert();var v_data=AJAX.response.split("|");$('div_report_broken_'+id).hide();$('div_report_nobroken_'+id).show();}
AJAX.runAJAX();}}
function event_init(open_create)
{if(window.location.href.split("#")[1]=="create"||window.location.href.split("#")[1]=="edit"||open_create){Effect.toggle('div_create_edit','slide',{duration:1.0});arrowSwitch('arrow_create_edit');setTimeout(function(){$('event_name').focus();},1500)}}
addInitFunc(event_init);function event_create_date(date,navigate_new_url)
{if(navigate_new_url){window.location.href=BLOGPATH+"events/"+date+"/#create";}else{event_select_date_ini(date);if($('div_create_edit').visible()==false){event_init(true);}else{Effect.ScrollTo('event_date_ini');}}}
function get_date_event(id)
{return $F(id)+" "+$F(id+"_H")+":"+$F(id+"_i");}
function event_filter_country(id_world_country)
{var world_name=$('id_world_country').options[$('id_world_country').selectedIndex]["text"];world_name=world_name.split(" ").join("-");window.location.href=PATH+"events-in/"+$F('id_world_country')+"_"+world_name+"/";}
function event_select_date_ini(selected_date)
{$('event_date_ini').value=selected_date;var myDateIni=createDate($F('event_date_ini'));var myDateEnd=createDate($F('event_date_end'));if(myDateIni.valueOf()>myDateEnd.valueOf())$('event_date_end').value=$F('event_date_ini');}
function event_select_date_end(selected_date)
{$('event_date_end').value=selected_date;var myDateIni=createDate($F('event_date_ini'));var myDateEnd=createDate($F('event_date_end'));if(myDateIni.valueOf()>myDateEnd.valueOf())$('event_date_ini').value=$F('event_date_end');}
function event_save()
{if(document.sending){$('div_msg_event').update(MSG_WAIT);}else{if($F('event_name')==""){$('div_msg_event').update(MSG_MISSING_NAME);$('event_name').focus();}else
if(!check_date_event_date_ini_validate()){$('div_msg_event').update(MSG_INVALID_DATE);}else
if(!check_date_event_date_end_validate()){$('div_msg_event').update(MSG_INVALID_DATE);}else
if($F('event_description')==""){$('div_msg_event').update(MSG_MISSING_DESCRIPTION);$('event_description').focus();}else
if(document.uploading){$('div_msg_event').update(MSG_FILE_UPLOADING);}else{document.sending=true;$('div_msg_event').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/events/save.php");AJAX.setVar("id",$F('event_id'));AJAX.setVar("name",urlencode($F('event_name')));AJAX.setVar("type",urlencode($F('event_type')));AJAX.setVar("date_ini",urlencode(get_date_event('event_date_ini')));AJAX.setVar("date_end",urlencode(get_date_event('event_date_end')));AJAX.setVar("image",urlencode($F('event_image')));AJAX.setVar("description",urlencode($F('event_description')));AJAX.setVar("location",get_location_str());AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_msg_event').update(MSG_DATA_SAVED);gotoURL(v_data[2]);}else{$('div_msg_event').update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function show_event_list(blog_name,p)
{new Ajax.Updater('event_list',PATH+"modules/events/list.php?p=1&blog_name="+blog_name+"&p="+p,{evalScripts:true});}
function show_event_list_ihtb(p,search)
{new Ajax.Updater('event_list',PATH+"modules/events/list_ihtb.php?p="+p+"&search="+urlencode(search),{evalScripts:true});}
function event_file_uploaded(param)
{$('event_image').value=param;document.uploading=false;}
function event_delete(id)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){var AJAX=new sack(PATH+"modules/events/delete.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){window.location.href=BLOGPATH+"events/";}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function event_report(id)
{var AJAX=new sack(PATH+"modules/events/broken.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){$('div_report_broken_'+id).hide();$('div_report_nobroken_'+id).show();}}
AJAX.runAJAX();}
function file_init(open_create)
{if(window.location.href.split("#")[1]=="create"||window.location.href.split("#")[1]=="edit"||open_create){Effect.toggle('div_create_edit','slide',{duration:1.0});arrowSwitch('arrow_create_edit');setTimeout(function(){$('file_name').focus();},1500)}}
addInitFunc(file_init);function file_file_uploaded(param)
{$('file_filename').value=param;document.uploading=false;}
function file_save_file()
{if(document.sending){show_js_alert(ALERT_WARNING,{message:MSG_WAIT});}else{if($F('file_name')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_NAME,callback:function(){$('file_name').focus();}});}else
if($F('file_filename')==""){show_js_alert(ALERT_WARNING,{message:MSG_MISSING_FILE});}else
if($F('file_description')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_DESCRIPTION,callback:function(){$('file_description').focus();}});}else
if(document.uploading){show_js_alert(ALERT_WARNING,{message:MSG_FILE_UPLOADING});}else{document.sending=true;show_js_alert(ALERT_OK,{message:MSG_SENDING,close:false});var AJAX=new sack(PATH+"modules/files/save.php");AJAX.setVar("id",$F('file_id'));AJAX.setVar("name",urlencode($F('file_name')));AJAX.setVar("description",urlencode($F('file_description')));AJAX.setVar("file_name",urlencode($F('file_filename')));AJAX.setVar("private",($F('file_private'))?"1":"0");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");hide_js_alert();if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED,callback:function(){gotoURL(v_data[2]);}});}else{show_js_alert(ALERT_OK,{message:MSG_SERVER_ERROR});}
document.sending=false;}
AJAX.runAJAX();}}}
function show_files_list(blog_name,p)
{new Ajax.Updater('file_list',PATH+"modules/files/list.php?blog_name="+blog_name+"&p="+p);}
function show_file_list_ihtb(p,search)
{new Ajax.Updater('file_list',PATH+"modules/files/ihtb_list.php?p="+p+"&search="+urlencode(search));}
function file_delete(id)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){show_js_alert(ALERT_OK,{message:MSG_DELETING,close:false});var AJAX=new sack(PATH+"modules/files/delete.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");hide_js_alert();if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DELETED,callback:function(){gotoURL(BLOGPATH+"files/");}});}else{show_js_alert(ALERT_ERROR,{message:MSG_SERVER_ERROR});}
document.sending=false;}
AJAX.runAJAX();}}}
function friends_find_check()
{$('div_friends_find_msg').hide();if(!$F('friends_find_provider')){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_PROVIDER});$('friends_find_email').focus();}else if(!is_email($F('friends_find_email'))){show_js_alert(ALERT_ERROR,{message:MSG_INVALID_EMAIL});$('friends_find_password').focus();}else if(!$F('friends_find_password')){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_PASSWORD});}else{friends_find_submit();}}
function friends_find_submit()
{$('div_friends_find_msg').update(MSG_SENDING);$('div_friends_find_msg').show();$('div_friends_list').update("");$('div_friends_list').show();var Obj=new Object();Obj.evalScripts=true;Obj.onComplete=function()
{$('div_friends_find_msg').update("");$('div_friends_find_msg').hide();}
new Ajax.Updater("div_friends_list",PATH+"modules/friends/find_external.php?user_email="+urlencode($F('friends_find_email'))+"&email_password="+urlencode($F('friends_find_password'))+"&email_provider="+urlencode($F('friends_find_provider')),Obj);}
function friends_add_check()
{var any_checked=false;var inputs=$$('input[type="checkbox"][type2="registered"]');inputs.each(function(chk){if(chk.checked)any_checked=true;});if(!any_checked){alert(MSG_MISSING_PERSON_CHECKED);}else friends_add_box();}
function friends_add_box()
{var obj=new Object();obj.onComplete=function(){$('friend_send_button').onclick=friends_add_submit;$('friend_send_message').focus();}
popUp(PATH+"html/tpl/app_friends_box.html",obj);}
function friends_add_submit()
{if(document.sending){alert(MSG_WAIT);}else{var id_array=new Array();var inputs=$$('input[type="checkbox"][type2="registered"]');inputs.each(function(chk){if(chk.checked)id_array.push(chk.value);});var AJAX=new sack(PATH+"modules/friends/request.php");AJAX.setVar("arr_users",id_array.join(","));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.setVar("message",urlencode($F('friend_send_message')));AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_popup_box_msg').update(MSG_REQUESTS_SENDED);setTimeout(function()
{popUpBG(false);popUpRemove();Effect.Fade('div_registered_list',{duration:3.0});},1500);}else{$('div_popup_box_msg').update(MSG_ERROR);}
document.sending=false;}
document.sending=true;$('div_popup_box_msg').update(MSG_SENDING);AJAX.runAJAX();}}
function friends_invite_check()
{var any_checked=false;var inputs=$$('input[type="checkbox"][type2="no_registered"]');inputs.each(function(chk){if(chk.checked)any_checked=true;});if(!any_checked){alert(MSG_MISSING_PERSON_CHECKED);}else friends_invite_box();}
function friends_invite_box()
{var obj=new Object();obj.onComplete=function(){$('friend_send_button').onclick=friends_invite_submit;}
popUp(PATH+"html/tpl/app_friends_box.html",obj);}
function friends_invite_submit()
{if(document.sending){alert(MSG_WAIT);}else{var id_array=new Array();var inputs=$$('input[type="checkbox"][type2="no_registered"]');inputs.each(function(chk){if(chk.checked)id_array.push(chk.value);});var AJAX=new sack(PATH+"modules/friends/invite.php");AJAX.setVar("arr_users",id_array.join(","));AJAX.setVar("message",urlencode($F('friend_send_message')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_popup_box_msg').update(MSG_REQUESTS_SENDED);setTimeout(function()
{popUpBG(false);popUpRemove();Effect.Fade('div_no_registered_list',{duration:2.0});},1500);}else{$('div_popup_box_msg').update(MSG_ERROR);}
document.sending=false;}
document.sending=true;$('div_popup_box_msg').update(MSG_SENDING);AJAX.runAJAX();}}
function friend_add(id_user)
{if(document.sending){alert(MSG_WAIT);}else{var obj=new Object();obj.evalScripts=true;obj.onComplete=function(){$('friend_send_button').onclick=function()
{var AJAX=new sack(PATH+"modules/friends/request.php");AJAX.setVar("arr_users",id_user);AJAX.setVar("message",urlencode($F('friend_send_message')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_popup_box_msg').update(MSG_REQUESTS_SENDED);setTimeout(function()
{popUpBG(false);popUpRemove();Effect.Fade('div_row_user_'+id_user,{duration:2.0});jQuery('.class_friend_request').fadeOut(1000);},1500);}else{$('div_popup_box_msg').update(MSG_ERROR);}
document.sending=false;}
document.sending=true;$('div_popup_box_msg').update(MSG_SENDING);AJAX.runAJAX();}
$('friend_send_message').focus();}
popUp(PATH+"html/tpl/app_friends_box.html",obj);}}
function people_find_check()
{$('div_friends_find_msg').hide();if(!$F('people_find_name')){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_TEXT});$('people_find_name').focus();}else{people_find_submit(1);}}
function people_find_submit(page)
{$('div_people_find_msg').update(MSG_SENDING);$('div_people_find_msg').show();$('div_friends_list').update("");$('div_friends_list').show();var Obj=new Object();Obj.evalScripts=true;Obj.onComplete=function()
{$('div_people_find_msg').update("");$('div_people_find_msg').hide();}
if(!page)page=1;new Ajax.Updater("div_find_by_data_results",PATH+"modules/friends/search_friends.php?q="+urlencode($F('people_find_name'))+"&p="+page,Obj);}
function friends_list_ihtb(p,search)
{new Ajax.Updater("friends_list",PATH+"modules/friends/search_friends_ihtb.php?p="+p+"&search="+search);}
function friends_list(p,id_blog)
{new Ajax.Updater("friends_list",PATH+"modules/friends/friends_list.php?p="+p+"&id_blog="+id_blog);}
function friend_remove(id_user)
{if(confirm(MSG_ARE_YOU_SURE)){var AJAX=new sack(PATH+"modules/friends/remove.php");AJAX.setVar("id_user",id_user);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){Effect.Fade('div_row_user_'+id_user,{duration:2.0});}else{alert(MSG_ERROR);}}
AJAX.runAJAX();}}
function friend_accept(id_user)
{var AJAX=new sack(PATH+"modules/friends/accept.php");AJAX.setVar("id_user",id_user);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){Effect.Fade('div_row_request_'+id_user,{duration:2.0});if($('div_friends_request'))decrease_notifications();}else{alert(MSG_ERROR);}}
AJAX.runAJAX();}
function friend_ignore(id_user)
{var AJAX=new sack(PATH+"modules/friends/ignore.php");AJAX.setVar("id_user",id_user);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){Effect.Fade('div_row_request_'+id_user,{duration:2.0});if($('div_friends_request'))decrease_notifications();}else{alert(MSG_ERROR);}}
AJAX.runAJAX();}
function fund_my_trip_save()
{if(document.sending){$('div_msg_fund_my_trip').update(MSG_WAIT);}else{document.sending=true;$('div_msg_fund_my_trip').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/fund_my_trip/save.php");AJAX.setVar("text",urlencode($F('fund_my_trip_text')));AJAX.setVar("code",urlencode($F('fund_my_trip_code')));AJAX.setVar("published",$F('fund_my_trip_published'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_msg_fund_my_trip').update(MSG_DATA_SAVED);window.location.href=BLOGPATH+"fund_my_trip/";}else{$('div_msg_fund_my_trip').update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}
function google_ads_save()
{if(document.sending){$('div_msg_google_ads').update(MSG_WAIT);}else{document.sending=true;$('div_msg_google_ads').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/google_ads/save.php");AJAX.setVar("code",urlencode($F('google_ads_code')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_msg_google_ads').update(MSG_DATA_SAVED);window.location.href=BLOGPATH+"google_ads/";}else{$('div_msg_google_ads').update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}
function journal_init(open_create)
{if(window.location.href.split("#")[1]=="create"||window.location.href.split("#")[1]=="edit"||open_create){Effect.toggle('div_create_journal','slide',{duration:1.0});arrowSwitch('arrow_create_edit');setTimeout(function(){$('journal_name').focus();},1500)}}
addInitFunc(journal_init);function journal_select_image(param)
{var AJAX=new sack(PATH+"modules/photos/photo_info.php");AJAX.method="GET";AJAX.setVar("id_photo",param);AJAX.setVar("id_album",$F('id_album'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){var obj=new Object();obj.duration=0.5;obj.afterFinish=function()
{$('img_album').src=PATH+urldecode(v_data[3]);$('img_album').onload=function(){$('img_album').show();$('a_img_album').href=PATH+urldecode(v_data[9]);Effect.SlideDown('div_img_album',{duration:0.5,afterFinish:function(){document.sending=false;}});}}
Effect.SlideUp('div_img_album',obj);}}
AJAX.runAJAX();}
function journal_hide_image()
{$('img_journal').fade({duration:0.5,from:1,to:0});}
function journal_file_uploaded(param)
{$('journal_filename').value=param;document.uploading=false;}
function journal_select_date(selected_date)
{$('journal_date').value=selected_date;}
function journal_check_submit()
{if(!$F('journal_name')){$('div_journal_msg').update(MSG_MISSING_TITLE);Effect.ScrollTo('journal_name',{offset:-20});$('journal_name').focus();}else
if(!$F('journal_description')){$('div_journal_msg').update(MSG_MISSING_DESCRIPTION);Effect.ScrollTo('journal_description',{offset:-20});$('journal_description').focus();}else
if(document.uploading){$('div_journal_msg').update(MSG_FILE_UPLOADING);}else{journal_submit();}}
function journal_submit()
{if(!document.sending){document.sending=true;$('div_journal_msg').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/journals/save.php");AJAX.setVar("id",$F('id_journal'));AJAX.setVar("id_album",$F('id_album'));AJAX.setVar("id_trip",$F('id_trip'));AJAX.setVar("name",urlencode($F('journal_name')));AJAX.setVar("date",$F('journal_date'));AJAX.setVar("description",urlencode($F('journal_description')));AJAX.setVar("image",$F('journal_filename'));AJAX.setVar("location",get_location_str());AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){gotoURL(v_data[2]);}else{$('div_journal_msg').update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}else{$('div_journal_msg').update(MSG_WAIT);}}
function show_journal_list(blog_name,p,id_category)
{new Ajax.Updater('journal_list',PATH+"modules/journals/list.php?p="+p+"&blog_name="+blog_name+"&id_category="+id_category);}
function show_journal_list_ihtb(p,search)
{new Ajax.Updater('journal_list',PATH+"modules/journals/list_ihtb.php?p="+p+"&search="+urlencode(search));}
function journal_delete(id)
{if(confirm(MSG_ARE_YOU_SURE)){show_js_alert(ALERT_WARNING,{message:MSG_DELETING,close:false});var AJAX=new sack(PATH+"modules/journals/delete.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{hide_js_alert();var v_data=AJAX.response.split("|");if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DELETED,close:false});gotoURL(BLOGPATH);}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}
function comment_send_check()
{if(!$F('comment_name')){$('div_msg_comment').update(MSG_MISSING_NAME);$('comment_name').focus();}else
if(!is_email($F('comment_email'))){$('div_msg_comment').update(MSG_INVALID_EMAIL);$('comment_email').focus();}else
if(!$F('comment_content')){$('div_msg_comment').update(MSG_MISSING_MSG);$('comment_content').focus();}else
if(comment_vote==0){$('div_msg_comment').update(MSG_MISSING_VOTE);}else{comment_send_submit();}}
function comment_send_submit()
{if(!document.sending){document.sending=true;document.body.style.cursor='wait';$('div_msg_comment').update(MSG_SENDING);var AJAX=new sack(PATH+"ajax/comment_submit/");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.setVar('table_ref',$F('comment_table_ref'));AJAX.setVar('id_ref',$F('comment_id_ref'));AJAX.setVar('name',$F('comment_name'));AJAX.setVar('email',$F('comment_email'));AJAX.setVar('content',urlencode($F('comment_content')));AJAX.setVar('vote',comment_vote);AJAX.setVar('id_user',$F('comment_id_user'));AJAX.setVar('id_blog',$F('comment_id_blog'));AJAX.setVar('module_info',$F('comment_module_info')+" "+urlencode($F('comment_content')));AJAX.setVar('url',text_encode(window.location.href));AJAX.setVar('captcha_string',$F('captcha_string'));AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){comment_vote=0;document.tbl_comment_id=v_data[2];var obj=new Object();obj.evalScripts=true;obj.onComplete=comment_send_tween;new Ajax.Updater('div_comments',PATH+"comments/"+$F('comment_table_ref')+"/"+$F('comment_id_ref')+"/1/"+$F('comment_id_blog'),obj);}else
if(v_data[1]==-1){$('div_msg_comment').update(MSG_ERROR_CAPTCHA);}else{$('div_msg_comment').update(MSG_SERVER_ERROR);}
document.sending=false;document.body.style.cursor='';}
AJAX.runAJAX();}else{$('div_msg_comment').update(MSG_WAIT);}}
function comment_send_tween()
{Effect.ScrollTo('tbl_comment_'+document.tbl_comment_id);colorTween=new ColorTween($('tbl_comment_'+document.tbl_comment_id),'backgroundColor',Tween.strongEaseIn,'F0EAD8','FFFFFF',5);colorTween.start();}
var comment_vote=0;function comment_star_onmouseover(nro)
{if(comment_vote==0){for(var i=1;i<=nro;i++){$('comment_star_'+i).className='star_to_rate_hover';$('comment_star_'+i).title="Your vote "+nro+"/5";}}else{$('comment_star_'+nro).title="Click to reset";}}
function comment_star_onmouseout(nro)
{if(nro>comment_vote){$('comment_star_'+nro).className='star_to_rate';}}
function comment_star_onclick(nro)
{if(comment_vote>0){comment_vote=0;for(var i=1;i<=5;i++){$('comment_star_'+i).className='star_to_rate';}}else{comment_vote=nro;}}
function comment_star_check()
{for(var i=1;i<=5;i++){if(i>comment_vote){$('comment_star_'+i).className='star_to_rate';}}}
function comment_update(table_ref,id_ref)
{new Ajax.Updater('div_comments',PATH+"comments/"+table_ref+"/"+id_ref+"/1/",{evalScripts:true});}
function comment_update_blog(table_ref,id_ref,id_blog)
{new Ajax.Updater('div_comments',PATH+"comments/"+table_ref+"/"+id_ref+"/1/"+id_blog+"/",{evalScripts:true});}
function comment_spam(id)
{var AJAX=new sack(PATH+"ajax/comment_spam/");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){$('div_comment_spam_'+id).hide();$('div_comment_nospam_'+id).show();}}
AJAX.runAJAX();}
function contact_send_check()
{if(!$F('contact_name')){$('div_msg_contact').update(MSG_MISSING_NAME);$('contact_name').focus();}else
if(!is_email($F('contact_email'))){$('div_msg_contact').update(MSG_INVALID_EMAIL);$('contact_email').focus();}else
if(!$F('contact_content')){$('div_msg_contact').update(MSG_MISSING_MSG);$('contact_content').focus();}else{contact_send_submit();}}
function contact_send_submit()
{if(!document.sending){document.sending=true;document.body.style.cursor='wait';$('div_msg_contact').update(MSG_SENDING);var AJAX=new sack(PATH+"ajax/contact_submit/");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.setVar('name',$F('contact_name'));AJAX.setVar('email',$F('contact_email'));AJAX.setVar('content',text_encode($F('contact_content')));AJAX.setVar('id_user',$F('contact_id_user'));AJAX.setVar('captcha_string',$F('captcha_string'));AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[1]==1){$('div_msg_contact').update(MSG_CONTACT_SUCESSFUL);get_captcha();$('contact_content').value="";$('contact_content').focus();}else
if(v_data[1]==-1){$('div_msg_contact').update(MSG_ERROR_CAPTCHA);}else{$('div_msg_contact').update(MSG_SERVER_ERROR);}
document.sending=false;document.body.style.cursor='';}
AJAX.runAJAX();}else{$('div_msg_contact').update(MSG_WAIT);}}
function hot_deals_category(year)
{var div=$("div_hot_deals_"+year);var td_img=$("td_hot_deals_"+year);if(div.isDisplayed()){div.hide();td_img.className="arrow";}else{div.show();td_img.className="arrow_down";}}
var gm_services_geocoder;function gm_services_load(wait)
{if(!gm_services_map)return;if(!wait&&!document.google_map_asking){document.google_map_asking=true;gm_services_map.clearOverlays();var gmBounds=gm_services_map.getBounds();var lat_ini=gmBounds.getSouthWest().lat();var lng_ini=gmBounds.getSouthWest().lng();var lat_fin=gmBounds.getNorthEast().lat();var lng_fin=gmBounds.getNorthEast().lng();if(gm_services_map.getZoom()<2){lat_ini=lng_ini=lat_fin=lng_fin=0;}
var AJAX=new sack(PATH+"modules/location/google_map_services.php");AJAX.setVar("lat_ini",lat_ini);AJAX.setVar("lat_fin",lat_fin);AJAX.setVar("lng_ini",lng_ini);AJAX.setVar("lng_fin",lng_fin);AJAX.setVar("youhaveto_eat_enabled",($F("youhaveto_eat_enabled"))?"1":"0");AJAX.setVar("youhaveto_party_enabled",($F("youhaveto_party_enabled"))?"1":"0");AJAX.setVar("youhaveto_sleep_enabled",($F("youhaveto_sleep_enabled"))?"1":"0");AJAX.setVar("photo_enabled",($F("photo_enabled"))?"1":"0");AJAX.setVar("journal_enabled",($F("journal_enabled"))?"1":"0");AJAX.method='GET';AJAX.onCompletion=function()
{document.google_map_asking=false;var v_data=AJAX.response.split("|");for(var i=0;i<v_data.length;i++)v_data[i]=v_data[i].split(",");gm_services_populate(v_data);}
AJAX.runAJAX();}else{clearInterval(document.gm_services_search);document.gm_services_search=setInterval(function(){clearInterval(document.gm_services_search);document.gm_services_search=0;gm_services_load(false);},1000);}}
function gm_services_address_search()
{initializeGMap();if($F('gm_services_address')){if(gm_services_geocoder){gm_services_geocoder.getLatLng($F('gm_services_address'),function(point)
{if(!point){alert($F('gm_services_address')+" not found");}else{gm_services_map.setCenter(point,8);}});}}}
function gm_services_populate(arr)
{function createGMmarker(arr_data){var gm_point=new GLatLng(arr_data[1],arr_data[2]);var gm_icon=new GIcon(G_DEFAULT_ICON);gm_icon.iconSize=new GSize(36,34);gm_icon.shadow="";switch(arr_data[0]){case'eat':gm_icon.image=PATH+"_img/google_map/eat.png";break;case'party':gm_icon.image=PATH+"_img/google_map/party.png";break;case'sleep':gm_icon.image=PATH+"_img/google_map/sleep.png";break;case'photo':gm_icon.image=PATH+"_img/google_map/photo.png";break;case'journal':gm_icon.image=PATH+"_img/google_map/journal.png";break;}
var gm_marker=new GMarker(gm_point,{icon:gm_icon,title:arr_data[4]});GEvent.addListener(gm_marker,"click",function(){if(!gm_marker["html"]){var url_details="";switch(arr_data[0]){case'eat':case'party':case'sleep':case'photo':case'journal':url_details=PATH+"map-detail/"+arr_data[0]+"/"+arr_data[3]+"/";break;}
var ajaxInfo=new sack(url_details);ajaxInfo.onCompletion=function()
{gm_marker["html"]=ajaxInfo.response;gm_marker.openInfoWindowHtml(gm_marker["html"]);}
ajaxInfo.runAJAX();}else{gm_marker.openInfoWindowHtml(gm_marker["html"]);}});return gm_marker;}
for(var i=1;i<arr.length;i++){gm_services_map.addOverlay(createGMmarker(arr[i]));}}
function gm_services_click()
{}
function location_country_change(sel_input,config_number)
{var obj=new Object();obj.evalScripts=true;obj.onComplete=function(){if($F('id_world_country')==0){$('id_world_region').selectedIndex=0;$('id_world_region').disabled=true;$('id_world_city').selectedIndex=0;$('id_world_city').disabled=true;}}
new Ajax.Updater('div_world_region',PATH+"modules/location/sel_regions.php?id_world_country="+sel_input.value+"&config_number="+config_number,obj);if($F('id_world_country')==223){$('id_world_city').selectedIndex=0;$('id_world_city').disabled=true;}else{new Ajax.Updater('div_world_city',PATH+"modules/location/sel_cities.php?id_world_country="+sel_input.value+"&config_number="+config_number,obj);}}
function location_region_change(sel_input,config_number)
{var obj=new Object();obj.evalScripts=true;obj.onComplete=function(){if($F('id_world_region')==0){new Ajax.Updater('div_world_city',PATH+"modules/location/sel_cities.php?id_world_country="+$F('id_world_country')+"&config_number="+config_number);}}
new Ajax.Updater('div_world_city',PATH+"modules/location/sel_cities.php?id_world_region="+sel_input.value+"&config_number="+config_number,obj);}
function location_city_change(sel_input,config_number)
{var obj=new Object();obj.evalScripts=true;obj.onComplete=function(){if($F('id_world_city')==0){}}
new Ajax.Updater('div_world_place',PATH+"modules/location/sel_places.php?id_world_city="+sel_input.value+"&config_number="+config_number,obj);}
function location_place_change(sel_input,config_number){}
function get_location_str()
{return $F('id_world_country')+","+$F('id_world_region')+","+$F('id_world_city');}
function place_add()
{if($F('id_world_city')>0){popUp(PATH+"modules/location/google_map.php?location="+get_location_str());}else{alert(MSG_MISSING_LOCATION_CITY);}}
function place_google_map_set(lat,lng,zoom)
{$('place_google_map').value=lat+","+lng+","+zoom;}
function place_google_map_hide()
{popUpRemove();popUpBG(false);}
function place_save()
{if($F('place_name')==""){$('div_msg_place').update(MSG_MISSING_NAME);$('place_name').focus();}else
place_submit();}
function place_submit()
{if(document.sending){$('div_msg_place').update(MSG_WAIT);}else{$('div_msg_place').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/location/place_save.php");AJAX.setVar('name',urlencode($F('place_name')));AJAX.setVar('private',$F('place_private'));AJAX.setVar('zip_code',$F('place_zip_code'));AJAX.setVar('google_map',$F('place_google_map'));AJAX.setVar('id_world_country',$F('id_world_country'));AJAX.setVar('id_world_region',$F('id_world_region'));AJAX.setVar('id_world_city',$F('id_world_city'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]>0){$('div_msg_place').update(MSG_DATA_SAVED);new Ajax.Updater('div_world_place',PATH+"modules/location/sel_places.php?id_world_city="+$F('id_world_city')+"&id_world_place="+v_data[0],{evalScripts:true});setTimeout(function(){$('place_opt').checked=true;place_opt_changed($('place_opt'));place_google_map_hide();},2000);}else{$('div_msg_place').update(MSG_SERVER_ERROR);}
document.sending=false;}
document.sending=true;AJAX.runAJAX();}}
function view_gooogle_map()
{$('div_google_map').show();Effect.ScrollTo('div_google_map',{offset:-50});}
var gm_user_profile_map;function initializeGMapUserProfile(id_user){if(GBrowserIsCompatible()){var gm_size=new GSize(500,400);var gm_map_types=Array(G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP);var gm_map;gm_map=new GMap2(document.getElementById('div_google_map_edit'),{size:gm_size,mapTypes:gm_map_types});gm_map.setCenter(new GLatLng(0,0),1);gm_map.setMapType(G_NORMAL_MAP);gm_map.disableDoubleClickZoom();gm_map.addControl(new GMenuMapTypeControl());gm_map.addControl(new GLargeMapControl());gm_map.addControl(new GOverviewMapControl(),new GControlPosition(G_ANCHOR_BOTTOM_LEFT));gm_user_profile_map=gm_map;loadGMapUserProfileEdit(id_user,false);}}
function initializeGMapUserProfileEdit(id_user){if(GBrowserIsCompatible()){var gm_size=new GSize(500,400);var gm_map_types=Array(G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP);var gm_map;gm_map=new GMap2(document.getElementById('div_google_map_edit'),{size:gm_size,mapTypes:gm_map_types,draggableCursor:'crosshair'});gm_map.setCenter(new GLatLng(0,0),1);gm_map.setMapType(G_NORMAL_MAP);gm_map.disableDoubleClickZoom();gm_map.addControl(new GMenuMapTypeControl());gm_map.addControl(new GLargeMapControl());gm_map.addControl(new GOverviewMapControl());gm_map.addControl(new google.maps.LocalSearch(),new GControlPosition(G_ANCHOR_BOTTOM_LEFT,new GSize(10,20)));GEvent.addListener(gm_map,'click',function(overlay,latlng){if(overlay)return;var title="";if(title=prompt("Enter your destination name","Location name")){if(title=="")title="Untitled place";var marker=createUserProfileMmarker(latlng,title,$RF('travel_profile_radio'),true);gm_map.addOverlay(marker);var AJAX=new sack(PATH+"ajax/user_travel_profile_add/");AJAX.setVar('type',$RF('travel_profile_radio'));AJAX.setVar('lat',latlng.lat());AJAX.setVar('lng',latlng.lng());AJAX.setVar('name',urlencode(title));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{if(AJAX.response.split("|")[1]==0){gm_map.removeOverlay(marker);alert("WARNING: we couldn't save "+title+". Please try again");}else{marker.id=AJAX.response.split("|")[1];}}
AJAX.runAJAX();}});GEvent.addListener(gm_map,'mouseover',function(){$('div_google_map_edit').title='Click to set a new place';});GEvent.addListener(gm_map,'mouseout',function(){$('div_google_map_edit').title='';});gm_user_profile_map=gm_map;loadGMapUserProfileEdit(id_user,true);}}
function initializeGMapPlaceEdit(lat,lng,zoom){if(GBrowserIsCompatible()){var gm_size=new GSize(520,400);var gm_map_types=Array(G_NORMAL_MAP,G_SATELLITE_MAP,G_HYBRID_MAP);var gm_map;var gm_point;var gm_marker;gm_point=new GLatLng(lat,lng);gm_marker=new GMarker(gm_point,{draggable:true});GEvent.addListener(gm_marker,"dragstart",function(){});GEvent.addListener(gm_marker,"dragend",function(){var gm_marker_coords=gm_marker.getLatLng();place_google_map_set(gm_marker_coords.lat(),gm_marker_coords.lng(),gm_map.getZoom());});gm_map=new GMap2($('div_google_map_edit'),{size:gm_size,mapTypes:gm_map_types});gm_map.setCenter(gm_point,15);gm_map.setMapType(G_HYBRID_MAP);gm_map.setZoom(zoom);gm_map.disableDoubleClickZoom();gm_map.enableScrollWheelZoom();gm_map.addControl(new GMenuMapTypeControl());gm_map.addControl(new GLargeMapControl());gm_map.addOverlay(gm_marker);GEvent.addListener(gm_map,'click',function(overlay,latlng){gm_marker.setLatLng(latlng);place_google_map_set(gm_marker_coords.lat(),gm_marker_coords.lng(),gm_map.getZoom());});}}
function loadGMapUserProfileEdit(id_user,enable_delete)
{var AJAX=new sack(PATH+"ajax/user_travel_profile/");AJAX.setVar("id_user",id_user);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");for(var i=1;i<v_data.length;i++){v_data[i]=v_data[i].split("/");var marker=createUserProfileMmarker(new GLatLng(v_data[i][2],v_data[i][3]),v_data[i][1],v_data[i][4],enable_delete);marker.id=v_data[i][0];gm_user_profile_map.addOverlay(marker);}}
AJAX.runAJAX();}
function createUserProfileMmarker(latlng,title,type,enable_delete){var gm_point=new GLatLng(latlng.lat(),latlng.lng());var gm_icon=new GIcon(G_DEFAULT_ICON);gm_icon.iconSize=new GSize(19,17);gm_icon.shadow="";gm_icon.image=PATH+"_img/google_map/star"+type+".png";gm_icon.iconAnchor=new GPoint(9,8);var gm_marker=new GMarker(gm_point,{icon:gm_icon,title:title});if(enable_delete){GEvent.addListener(gm_marker,'click',function(){if(confirm("Do you want to delete "+gm_marker.getTitle()+"?")){gm_user_profile_map.removeOverlay(gm_marker);var AJAX=new sack(PATH+"ajax/user_travel_profile_delete/");AJAX.setVar("id",gm_marker.id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{if(AJAX.response.split("|")[1]==0){alert("Server error: try again");};}
AJAX.runAJAX();}});}
return gm_marker;}
function photos_init(open_create)
{if(window.location.href.split("#")[1]=="create"||window.location.href.split("#")[1]=="edit"||open_create){Effect.toggle('div_create_edit','slide',{duration:1.0});arrowSwitch('arrow_create_edit');setTimeout(function(){$('album_name').focus();},1500)}}
addInitFunc(photos_init);function photos_check_anchor()
{var arr_href_1=window.location.href.split("?");var arr_href_2=window.location.href.split("#");if(arr_href_2[1]=="edit"||arr_href_2[1]=="create"){photos_init(true);}else
if(arr_href_2.length==2){if(arr_href_1.length==1){window.location.href=arr_href_2[0]+"?"+arr_href_2[1];}else
if(arr_href_1.length==2){window.location.href=arr_href_1[0]+"?"+arr_href_2[1];}}}
function show_photos_list(blog_name,p)
{new Ajax.Updater('photos_list',PATH+"modules/photos/list.php?blog_name="+blog_name+"&p="+p);}
function show_photos_list_ihtb(p,search)
{new Ajax.Updater('photos_list',PATH+"modules/photos/list_ihtb.php?p="+p+"&search="+urlencode(search));}
function photos_home_select(param)
{window.location.href=PATH+"modules/photos/photo_view.php?id_photo="+param+"&blog_path="+BLOGPATH;}
function album_save_check()
{if(!$F('album_name')){show_js_alert(ALERT_ERROR,{message:MSG_PHOTOS_TITLE});return false;}else
if($F('id_world_city')==0){show_js_alert(ALERT_ERROR,{message:MSG_PHOTOS_SELECT_CITY});return false;}else
if(!$F('id_album')&&!document.uploaded){show_js_alert(ALERT_ERROR,{message:MSG_PHOTOS_UPLOAD_PHOTO});return false;}else{return true;}}
function album_save(tmp_filename)
{var sAlbumName=urlencode($F('album_name'));var sAlbumDesc=urlencode($F('album_description'));var sAlbumDate=urlencode($F('album_date'));var sLocationStr=get_location_str();if(!tmp_filename&&!album_save_check()){return;}else
if(document.uploading){show_js_alert(ALERT_ERROR,{message:MSG_FILE_UPLOADING});return;}else
if(!document.sending){document.sending=true;$('div_msg_album').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/photos/album_save.php");AJAX.setVar("id_album",$F('id_album'));AJAX.setVar('id_trip',$F('id_trip'));AJAX.setVar("name",sAlbumName);AJAX.setVar("description",sAlbumDesc);AJAX.setVar("date",sAlbumDate);AJAX.setVar("location",sLocationStr);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){if(tmp_filename){$('id_album').value=v_data[1];photos_file_uploaded(tmp_filename);$('div_msg_album').update("");}else{gotoURL(v_data[2]);}}else{$('div_msg_album').update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}
function photos_file_uploaded(param)
{document.uploading=false;document.uploaded=true;if($F('id_album')){show_js_alert(ALERT_WARNING,{message:MSG_PHOTOS_PROCESSING_WAIT,close:false});var AJAX=new sack(PATH+"modules/photos/photo_upload.php");AJAX.setVar('id_album',$F('id_album'));AJAX.setVar('filename',param);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{hide_js_alert();var v_data=AJAX.response.split("|");if(v_data[0]==1){$Flash('flash_album_edit').SetVariable("SELECTED",v_data[2]);$('id_photo').value=v_data[2];$('div_photo_description').update(MSG_ENTER_PHOTO_DESCRIPTION);$('div_photo_edit').show();startListenPhotoDescription();photos_list_refresh();}}
AJAX.runAJAX();}else{album_save(param);}}
function photos_list_refresh()
{$Flash('flash_album_edit').SetVariable("SOURCE","modules/photos/gallery.php?id_album="+$F('id_album'));$Flash('flash_album_edit').SetVariable("js_controller_mc.last_selected","true");$Flash('flash_album_edit').TGotoFrame("js_controller_mc",1);}
function photos_select_image_edit(param)
{$('div_photo_edit').show();$('div_photo_description').update("loading...");$('id_photo').value=param;var AJAX=new sack(PATH+"modules/photos/photo_info.php");AJAX.method="GET";AJAX.setVar("id_photo",param);AJAX.setVar("id_album",$F('id_album'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){if(!v_data[2])v_data[2]=MSG_ENTER_PHOTO_DESCRIPTION;$('div_photo_description').update(v_data[2]);startListenPhotoDescription();}}
AJAX.runAJAX();}
function photos_navigate(val)
{var current=arr_album_ids.search($F('img_navigator_pointer'));current+=val;if(current>=arr_album_ids.length)current=0;else if(current<0)current=arr_album_ids.length-1;album_select_image(arr_album_ids[current]);}
function photos_update_navigator(id)
{var current=arr_album_ids.search(id);$('img_navigator_pointer').value=id;$('div_img_navigator_info').update((current+1)+"/"+arr_album_ids.length);}
function album_select_image(param)
{if(!document.sending){var AJAX=new sack(PATH+"modules/photos/photo_info.php");AJAX.method="GET";AJAX.setVar("id_photo",param);AJAX.setVar("id_album",$F('id_album_detail'));AJAX.setVar("hit",1);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){var obj=new Object();obj.duration=0.5;obj.afterFinish=function()
{$('img_album').src=v_data[3];$('img_album').onload=function(){$('img_album').show();$('a_img_album').href=PATH+v_data[9];Effect.SlideDown('div_img_album',{duration:0.5,afterFinish:function(){document.sending=false;}});}}
Effect.SlideUp('div_img_album',obj);$('photo_description').update(v_data[2]);$('footer_hits').update(v_data[6]);$('footer_comment_count').update(v_data[4]);$('table_stars').title="Rate: "+v_data[7]+" ("+v_data[8]+" votes)";for(var i=1;i<=5;i++){$('td_star_'+i).className=((i<=v_data[7])?"star_selected":"star_not_selected");}
comment_update_blog("module_f_image",param,$F('comment_id_blog'));window.location.href="#id_photo="+param;photos_update_navigator(param);}}
AJAX.runAJAX();document.sending=true;}}
function startListenPhotoDescription()
{if($('div_photo_description').InPlaceEditor)$('div_photo_description').InPlaceEditor.dispose();$('div_photo_description').InPlaceEditor=new Ajax.InPlaceEditor($('div_photo_description'),PATH+'modules/photos/photo_save.php?id_photo='+$F('id_photo'),{okLink:true,cancelLink:true,textBetweenControls:' | ',rows:1,okText:"\nok",paramName:'description',formClassName:'form_field_txt txt_small form_margin_0',highlightColor:'#FFA12D',highlightEndColor:'#FAE8CE',size:35,callback:function(f,value){if(value==MSG_ENTER_PHOTO_DESCRIPTION){$('div_photo_description').update("");}},onComplete:function(transport){this.element.innerHTML=urldecode(this.element.innerHTML);},ajaxOptions:{method:'post'}});}
function photo_delete()
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){var AJAX=new sack(PATH+"modules/photos/photo_delete.php");AJAX.setVar("id",$F('id_photo'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){photos_list_refresh();$('div_photo_edit').hide();window.location.href=window.location.href.split("#")[0]+"#id_photo=0";}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function album_delete(id_album)
{if(confirm(MSG_ARE_YOU_SURE)){show_js_alert(ALERT_WARNING,{message:MSG_DELETING,close:false});var AJAX=new sack(PATH+"modules/photos/album_delete.php");AJAX.setVar("id",id_album);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{hide_js_alert();var v_data=AJAX.response.split("|");if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DELETED,close:false});gotoURL(v_data[2]);}else{show_js_alert(ALERT_ERROR,{message:MSG_ERROR});}}
AJAX.runAJAX();}}
function terminal_init()
{var id=Number(window.location.href.split("#")[1]);if(id>0){Effect.ScrollTo('terminal_'+id);}}
addInitFunc(terminal_init);function terminal_save(blog_name)
{if(document.sending){$('div_msg_terminal').update(MSG_WAIT);}else{if($F('terminal_text')==""){$('div_msg_terminal').update(MSG_MISSING_MESSAGE);$('terminal_text').focus();}else{document.sending=true;$('div_msg_terminal').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/terminal/save.php");AJAX.setVar("id_user",$F('terminal_id_user'));AJAX.setVar("text",urlencode($F('terminal_text')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){if($('div_blog_18')){show_terminal_home(blog_name,1);}else{show_terminal_list(blog_name,1);}}else{$('div_msg_terminal').update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function terminal_app_panel_save(blog_name,id_user)
{var terminal_text=urlencode(jQuery('#app_terminal_text').val());if(terminal_text=="")return;show_js_alert(ALERT_OK,{message:MSG_SENDING,close:false});jQuery.ajax({type:'post',async:false,data:{blog_name:blog_name,id_user:id_user,text:terminal_text},url:PATH+'modules/terminal/save.php',success:function(response)
{hide_js_alert();var v_data=response.split("|");if(v_data[0]==1){gotoURL(BLOGPATH+'terminal');}else{show_js_alert(ALERT_ERROR,{message:MSG_SERVER_ERROR});}}});}
function show_terminal_home(blog_name,p)
{new Ajax.Updater('div_blog_18',PATH+"modules/terminal/list.php?blog_name="+blog_name+"&p="+p+"&home=1");}
function show_terminal_list(blog_name,p)
{new Ajax.Updater('terminal_list',PATH+"modules/terminal/list.php?blog_name="+blog_name+"&p="+p);}
function terminal_delete(id)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){var AJAX=new sack(PATH+"modules/terminal/delete.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){Effect.Fade($('div_terminal_'+id));}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function video_init(open_create)
{if(window.location.href.split("#")[1]=="create"||window.location.href.split("#")[1]=="edit"||open_create){Effect.toggle('div_create_edit','slide',{duration:1.0});arrowSwitch('arrow_create_edit');setTimeout(function(){$('video_name').focus();},1500)}}
addInitFunc(video_init);function video_save(blog_name)
{if(document.sending){$('div_msg_video').update(MSG_WAIT);}else{if($F('video_name')==""){$('div_msg_video').update(MSG_MISSING_TITLE);$('video_name').focus();}else
if($F('video_date')==""){$('div_msg_video').update(MSG_MISSING_DESCRIPTION);$('video_date').focus();}else
if($F('video_embed')==""){$('div_msg_video').update(MSG_MISSING_EMBED);$('video_embed').focus();}else{document.sending=true;$('div_msg_video').update(MSG_SENDING);var AJAX=new sack(PATH+"modules/videos/save.php");AJAX.setVar("id",$F('video_id'));AJAX.setVar("name",urlencode($F('video_name')));AJAX.setVar("date",urlencode($F('video_date')));AJAX.setVar("description",urlencode($F('video_description')));AJAX.setVar("embed",urlencode($F('video_embed')));AJAX.setVar("trip_assoc",$F('cmbTrips'));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){$('div_msg_video').update(MSG_DATA_SAVED);setTimeout(function(){window.location.href=v_data[2];},1000);}else{$('div_msg_video').update(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function show_video_list(blog_name,p)
{new Ajax.Updater('video_list',PATH+"modules/videos/list.php?blog_name="+blog_name+"&p="+p);}
function show_video_list_ihtb(p,search)
{new Ajax.Updater('video_list',PATH+"modules/videos/ihtb_list.php?p="+p+"&search="+urlencode(search));}
function video_delete(id)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){var AJAX=new sack(PATH+"modules/videos/delete.php");AJAX.setVar("id",id);AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){gotoURL(v_data[1]);}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
var youhaveto_vote=0;function youhaveto_star_onmouseover(nro)
{if(youhaveto_vote==0){for(var i=1;i<=nro;i++){$('youhaveto_star_'+i).className='star_to_rate_hover';$('youhaveto_star_'+i).title="Your vote "+nro+"/5";}}else{$('youhaveto_star_'+nro).title="Click to reset";}}
function youhaveto_star_onmouseout(nro)
{if(nro>youhaveto_vote){$('youhaveto_star_'+nro).className='star_to_rate';}}
function youhaveto_star_onclick(nro)
{if(youhaveto_vote>0){youhaveto_vote=0;for(var i=1;i<=5;i++){$('youhaveto_star_'+i).className='star_to_rate';}}else{youhaveto_vote=nro;}}
function youhaveto_star_check()
{for(var i=1;i<=5;i++){if(i>youhaveto_vote){$('youhaveto_star_'+i).className='star_to_rate';}}}
function eat_file_uploaded(param)
{$('eat_filename').value=param;document.uploading=false;}
function party_file_uploaded(param)
{$('party_filename').value=param;document.uploading=false;}
function sleep_file_uploaded(param)
{$('sleep_filename').value=param;document.uploading=false;}
function eat_save(blog_name)
{if(document.sending){show_js_alert(ALERT_WARNING,{message:MSG_WAIT});}else{if($F('eat_name')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_NAME,callback:function(){$('eat_name').focus();}});}else
if($F('eat_description')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_DESCRIPTION,callback:function(){$('eat_description').focus();}});}else
if(youhaveto_vote==0){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_VOTE});}else
if($F('id_world_city')==0){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_CITY,callback:function(){$('id_world_city').focus();}});}else
if(document.uploading){show_js_alert(ALERT_WARNING,{message:MSG_FILE_UPLOADING});}else{document.sending=true;show_js_alert(ALERT_OK,{message:MSG_SENDING,close:false});var AJAX=new sack(PATH+"modules/youhaveto/eat_save.php");AJAX.setVar("id",$F('eat_id'));AJAX.setVar("id_trip",$F('eat_id_trip'));AJAX.setVar("name",urlencode($F('eat_name')));AJAX.setVar("telephone",urlencode($F('eat_telephone')));AJAX.setVar("address",urlencode($F('eat_address')));AJAX.setVar("costs",urlencode($F('eat_costs')));AJAX.setVar("description",urlencode($F('eat_description')));AJAX.setVar("vote",youhaveto_vote);AJAX.setVar("location",get_location_str());AJAX.setVar("url",urlencode($F('eat_url')));AJAX.setVar("image",urlencode($F('eat_filename')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");hide_js_alert();if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED,callback:function(){gotoURL(v_data[2]);}});}else{show_js_alert(ALERT_OK,{message:MSG_SERVER_ERROR});}
document.sending=false;}
AJAX.runAJAX();}}}
function party_save(blog_name)
{if(document.sending){show_js_alert(ALERT_WARNING,{message:MSG_WAIT});}else{if($F('party_name')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_NAME,callback:function(){$('party_name').focus();}});}else
if($F('party_description')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_DESCRIPTION,callback:function(){$('party_description').focus();}});}else
if(youhaveto_vote==0){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_VOTE});}else
if($F('id_world_city')==0){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_CITY,callback:function(){$('id_world_city').focus();}});}else
if(document.uploading){show_js_alert(ALERT_WARNING,{message:MSG_FILE_UPLOADING});}else{document.sending=true;show_js_alert(ALERT_OK,{message:MSG_SENDING,close:false});var AJAX=new sack(PATH+"modules/youhaveto/party_save.php");AJAX.setVar("id",$F('party_id'));AJAX.setVar("id_trip",$F('party_id_trip'));AJAX.setVar("name",urlencode($F('party_name')));AJAX.setVar("telephone",urlencode($F('party_telephone')));AJAX.setVar("address",urlencode($F('party_address')));AJAX.setVar("entrance_price",urlencode($F('party_entrance_price')));AJAX.setVar("drink_price",urlencode($F('party_drink_price')));AJAX.setVar("description",urlencode($F('party_description')));AJAX.setVar("vote",youhaveto_vote);AJAX.setVar("location",get_location_str());AJAX.setVar("url",urlencode($F('party_url')));AJAX.setVar("image",urlencode($F('party_filename')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");hide_js_alert();if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED,callback:function(){gotoURL(v_data[2]);}});}else{show_js_alert(ALERT_OK,{message:MSG_SERVER_ERROR});}
document.sending=false;}
AJAX.runAJAX();}}}
function sleep_save(blog_name)
{if(document.sending){$('div_msg').update(MSG_WAIT);}else{if($F('sleep_name')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_NAME,callback:function(){$('sleep_name').focus();}});}else
if($F('sleep_description')==""){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_DESCRIPTION,callback:function(){$('sleep_description').focus();}});}else
if(youhaveto_vote==0){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_VOTE});}else
if($F('id_world_city')==0){show_js_alert(ALERT_ERROR,{message:MSG_MISSING_CITY,callback:function(){$('id_world_city').focus();}});}else
if(document.uploading){show_js_alert(ALERT_WARNING,{message:MSG_FILE_UPLOADING});}else{document.sending=true;show_js_alert(ALERT_OK,{message:MSG_SENDING,close:false});var AJAX=new sack(PATH+"modules/youhaveto/sleep_save.php");AJAX.setVar("id",$F('sleep_id'));AJAX.setVar("id_trip",$F('sleep_id_trip'));AJAX.setVar("name",urlencode($F('sleep_name')));AJAX.setVar("telephone",urlencode($F('sleep_telephone')));AJAX.setVar("address",urlencode($F('sleep_address')));AJAX.setVar("stars",$F('sleep_stars'));AJAX.setVar("costs",urlencode($F('sleep_costs')));AJAX.setVar("description",urlencode($F('sleep_description')));AJAX.setVar("vote",youhaveto_vote);AJAX.setVar("location",get_location_str());AJAX.setVar("from_airport",urlencode($F('sleep_from_airport')));AJAX.setVar("url",urlencode($F('sleep_url')));AJAX.setVar("image",urlencode($F('sleep_filename')));AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");hide_js_alert();if(v_data[0]==1){show_js_alert(ALERT_OK,{message:MSG_DATA_SAVED,callback:function(){gotoURL(v_data[2]);}});}else{show_js_alert(ALERT_OK,{message:MSG_SERVER_ERROR});}
document.sending=false;}
AJAX.runAJAX();}}}
function show_youhaveto_eat_list(blog_name,home,p)
{home=(home)?"1":"";new Ajax.Updater('youhaveto_eat_list',PATH+"modules/youhaveto/eat_list.php?blog_name="+blog_name+"&home="+home+"&p="+p);}
function show_youhaveto_party_list(blog_name,home,p)
{home=(home)?"1":"";new Ajax.Updater('youhaveto_party_list',PATH+"modules/youhaveto/party_list.php?blog_name="+blog_name+"&home="+home+"&p="+p);}
function show_youhaveto_sleep_list(blog_name,home,p)
{home=(home)?"1":"";new Ajax.Updater('youhaveto_sleep_list',PATH+"modules/youhaveto/sleep_list.php?blog_name="+blog_name+"&home="+home+"&p="+p);}
function show_youhaveto_eat_list_ihtb(p)
{new Ajax.Updater('youhaveto_eat_list',PATH+"modules/youhaveto/eat_list_ihtb.php?p="+p);}
function show_youhaveto_party_list_ihtb(p)
{new Ajax.Updater('youhaveto_party_list',PATH+"modules/youhaveto/party_list_ihtb.php?p="+p);}
function show_youhaveto_sleep_list_ihtb(p)
{new Ajax.Updater('youhaveto_sleep_list',PATH+"modules/youhaveto/sleep_list_ihtb.php?p="+p);}
function show_youhaveto_eat_list_search(p,search)
{new Ajax.Updater('youhaveto_list',PATH+"modules/youhaveto/eat_list_search.php?p="+p+"&search="+urlencode(search));}
function show_youhaveto_party_list_search(p,search)
{new Ajax.Updater('youhaveto_party_list',PATH+"modules/youhaveto/party_list_search.php?p="+p+"&search="+urlencode(search));}
function show_youhaveto_sleep_list_search(p,search)
{new Ajax.Updater('youhaveto_sleep_list',PATH+"modules/youhaveto/sleep_list_search.php?p="+p+"&search="+urlencode(search));}
function show_ihaveto_eat_list(p,id_world_country,id_world_region,id_world_city)
{new Ajax.Updater('ihaveto_eat_list',PATH+"modules/youhaveto/eat_list_ihave.php?p="+p+"&id_world_country="+id_world_country+"&id_world_region="+id_world_region+"&id_world_city="+id_world_city);}
function show_ihaveto_party_list(p,id_world_country,id_world_region,id_world_city)
{new Ajax.Updater('ihaveto_party_list',PATH+"modules/youhaveto/party_list_ihave.php?p="+p+"&id_world_country="+id_world_country+"&id_world_region="+id_world_region+"&id_world_city="+id_world_city);}
function show_ihaveto_sleep_list(p,id_world_country,id_world_region,id_world_city)
{new Ajax.Updater('ihaveto_sleep_list',PATH+"modules/youhaveto/sleep_list_ihave.php?p="+p+"&id_world_country="+id_world_country+"&id_world_region="+id_world_region+"&id_world_city="+id_world_city);}
function eat_delete(id,owner)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){var AJAX=new sack(PATH+"modules/youhaveto/eat_delete.php");AJAX.setVar("id",id);AJAX.setVar("owner",(owner)?"1":"0");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){window.location.href=BLOGPATH+"youhaveto/eat/";}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function party_delete(id,owner)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){var AJAX=new sack(PATH+"modules/youhaveto/party_delete.php");AJAX.setVar("id",id);AJAX.setVar("owner",(owner)?"1":"0");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){window.location.href=BLOGPATH+"youhaveto/party/";}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function sleep_delete(id,owner)
{if(confirm(MSG_ARE_YOU_SURE)){if(!document.sending){var AJAX=new sack(PATH+"modules/youhaveto/sleep_delete.php");AJAX.setVar("id",id);AJAX.setVar("owner",(owner)?"1":"0");AJAX.setVar("PHPSESSID",PHPSESSID);AJAX.onCompletion=function()
{var v_data=AJAX.response.split("|");if(v_data[0]==1){window.location.href=BLOGPATH+"youhaveto/sleep/";}else{alert(MSG_SERVER_ERROR);}
document.sending=false;}
AJAX.runAJAX();}}}
function youhaveto_create()
{try{if(window.location.href.split("#")[1]=="create"){Effect.toggle('div_edit','slide');arrowSwitch('arrow_create_edit');}}catch(e){}}
addInitFunc(youhaveto_create);
