﻿//Copyright © Meetings and Conventions, LLC. All Rights Reserved - code may not be reused in whole or in part without written consent- removal of this section consitutes a copyright violation
var tpwin;var pgevt;var div;var divIdx;var nc=new Array();var ajevt=null;var bpaTrack=false;var lgu='';var usrv=false;
var lgPID;var istp=false;var acced=false;var last=null;var lastT=null;var lastP=null;var lnk;var pncls='clsPin1'
if (isIE6p()){pncls='clsPin2'}
function myrnd(){return Math.round(Math.random() * 10000000000)}
function appndURL(u,a){if (u.indexOf('?')==-1){u = u + '?'}else{u = u + '&'};u = u + a;return u}

function _SearchType(){var i=readCookie("SearchType");if (i==null){i='DEST_HOT'};return i}
function _sSearchType(v){if (v==""){eraseCookie("SearchType")}else{createCookie("SearchType",v,365)}}
function _SelPlaces(){var i=readCookie("SelPlaces");if (i==null){i=0};return i}
function _sSelPlaces(v){if (v==""){eraseCookie("SelPlaces")}else{createCookie("SelPlaces",v,1)}}
function _UserID(){var i=readCookie("UserKey");if (i==null){i=0};return i}
function _vpr(){var i=readCookie("vpr");if (i==null){i="WM"};return i}
function _Cmpstyle(){var i=readCookie("mapstyle");if (i==null){i='r';}return i}
function _sUserID(v){if (v=="0"){eraseCookie("UserKey")}else{createCookie("UserKey",v,365)}}
function _svpr(v){if (v==""){eraseCookie("vpr")}else{createCookie("vpr",v,365)}}
function _sCmpstyle(v){createCookie("mapstyle",v,365)}

function setFocus(o){if(o){try{o.focus()}catch(e){}}}
function getObj(objID) {if (document.getElementById){return document.getElementById(objID);}else if (document.all){return document.all[objID];}else if (document.layers){return document.layers[objID];}}
function _pgEvt(){var e;try{e=event}catch(err){};return e}
function _cnEvt(evt){try{evt = (evt) ? evt : window.event;evt.returnValue = false;evt.cancelBubble = true;}catch(err){};}
function createCookie(name,value,days) {if (days) {var date = new Date();date.setTime(date.getTime()+(days*24*60*60*1000));var expires = "; expires="+date.toGMTString();}else var expires = "";document.cookie = name+"="+value+expires+"; path=/";}
function readCookie(cookie_name) {var results = document.cookie.match ( cookie_name + '=(.*?)(;|$)' );  if ( results ){return ( unescape ( results[1] ) )}else{return null}}
function eraseCookie(name) {createCookie(name,"",-1);}
function showError(error) {var stackTrace = error.get_stackTrace();var message = error.get_message();var statusCode = error.get_statusCode();var exceptionType = error.get_exceptionType();var timedout = error.get_timedOut();alert(message);}


function printhis(k){}
function emailthis(k){}
function showVideoInline(){if(document.getElementById('divVid')){document.getElementById('divVid').style.display=''};document.getElementById('imgFull').style.display='none';}
function showVideoInline2(){
if(divVid){divVid.style.display=''};
if(divVT){divVT.style.display='none'}
if(imgFull){imgFull.style.display='none'}
}
function showVTInline2(src,c){
if(divVT){divVT.style.display=''}
if (divVTCaption){divVTCaption.innerHTML=c}
if(divVid){divVid.style.display='none'};
if(imgFull){imgFull.style.display='none'}
LoadTour(src);
}
function showFullSize2(src,t) { 
if(divVid){divVid.style.display='none'};
if(divVT){divVT.style.display='none'}
if(imgFull){imgFull.style.display=''
imgFull.src = src;
imgFull.title=t; 
}
document.getElementById('imgFullDesc').innerHTML=t 
}
function OnFailed2(error){ showError(error);}
function donothing(){}
function disablelink(a){a.disabled=true;a.onclick=dontdo;a.href=''}
function enablelink(a,href){a.disabled=false;a.onclick='';a.href = href;}
function dontdo(){return false}
function suptwinloc() {

    var b=true;

    if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)) { //test for Firefox/x.x or Firefox x.x (ignoring remaining digits);

        var ffversion = new Number(RegExp.$1) // capture x.x portion and store as a number

        b = ffversion < 5;

    }

    return b;

}

function winloc(u) {//do this to get referer on window.location calls

    if (!suptwinloc()) { window.location = u; return; } 

    var a = document.createElement("a");

    if (!a.click) { window.location = u; return; }

    a.setAttribute("href", u); 

    a.style.display = "none";

    document.body.appendChild(a); //prototype shortcut

    a.click();

}

 

var rfpk=0
function closeRFP(){closePAj2();window.setTimeout(closeRFP2,500)}
function closeRFP2(){window.alert('Your RFP has been sent successfully.')}
function openRFP(k){
_cnEvt();
//mDisablePage()
rfpk=k
try{mShowModalWin('doRFP','aj','/meeting-facilities/rfp?pk=' + rfpk,550  ,850,20,true,false,'RFP',true)}catch(e){HTIWS.LogJSError( e.description,'openRFP;' + k,donothing,donothing)}

//window.setTimeout(openRFP2,500)
}
function openRFP2(){
//window.open('/meeting-facilities/rfp?pk=' + rfpk + '&sa=1','FacClassification','width=850,height=550,resizable,scrollbars')
}
function showMapP(a){try{var b = $common.getBounds(pnlMapPop);  var b2 = $common.getBounds(a ); b.y=b2.y+15;b.x=b2.x ;b.height=340;b.width=331 ;$common.setBounds( pnlMapPop,b);if (ifrMap.src!=a.href + ':Popup-Map'){ifrMap.src=a.href+ ':Popup-Map'};myTrackEvent('Popup','ShowPopup','Map','');pnlMapPop.style.display="";}catch(e){HTIWS.LogJSError( e.description,'showMapP;' + a ,donothing,donothing)}}
function domaploaded(){pnlLoadingMap.style.display="none";ifrMap.style.display=""}
function hideMapP(a){pnlMapPop.style.display="none"}


/// **************  START PAGE TRACKING ********************************************************
function myTrackPageView(u, r, a) {
    if (a == undefined) { a = "" }
    var orgu = u; qs = ""; qs2 = "";
    if (u.indexOf('?') != -1) { qs = u.substring(u.indexOf('?') + 1); qs2 = "?" + qs }
    try { initTracking(); u = s.prop1 + "/AJAX/" + a; } catch (e) { };
    try { pageTracker._trackPageview(u + qs2); } catch (e) { };
    try { s.prop70 = a; s.prop1 = u; s.prop2 = qs; s.t(); } catch (e) { };
    try { ntptEventTag(u + qs2); } catch (e) { };
    if (bpaTrack) {
        var _BPAtrk = new Image(1, 1)
        _BPAtrk.src = "http://secure-us.imrworldwide.com/cgi-bin/m?ci=us-bpaww&cg=0&cc=1&si=http://www.meetings-conventions.com" + escape(orgu) + "&rnd=" + Math.ceil(Math.random() * 1000000000);
    }
    if (r) { window.setTimeout(rotateads, 1000) }
}



function myTrackEvent(category,action,label, value){
    if (value!='' || label!=''){
        var val=value; if (val==''){val=label};
         try{ntptAddPair( 'val',val)}catch(e){};    
   }
    try{ntptEventTag('ev=' + action )}catch(e){};   
    try{pageTracker._trackEvent(category, action,label, value)}catch(e){};
    
}
// **************  END PAGE TRACKING ********************************************************  



// **************  START USER REG ********************************************************  
function doLogout(){_sUserID(0); window.location=window.location}
function dologin(q){var s=appndURL(location.href,q);window.location=lgu+ '?sh=0&caller=' + escape(s)}
function doProfile(){window.location=lgu+ '?action=editprofile&sh=0&caller=' + escape(location.href)}
function showSignup(){window.location=lgu+ '?sh=0&caller=' + escape(location.href)}
// **************  END USER REG ********************************************************  


// **************  START COMMON MAP ********************************************************  
var curmaplink=null;function dogetmapdest(sb){
try{
document.getElementById('pnlMapPlacesP').className='ColumnLinkListRef';
myTrackEvent('HotMap','HotMapNav',sb,'')
HTIWS.GetMapDest(sb,ondogetmapdest,showError)
}catch(e){HTIWS.LogJSError( e.description,'dogetmapdest;'+sb ,donothing,donothing)}}



function ondogetmapdest(s){
if(pnlMapPlacesHTML){pnlMapPlacesHTML.style.display='none'};
pnlMapPlaces.style.display='';
pnlMapPlaces.innerHTML=s;
pnlMapPlaces.className='LinkList3';
document.getElementById('pnlMapPlacesP').className='';
$get('bkBox').scrollIntoView();
if (curmaplink){curmaplink.childNodes[0].className='';curmaplink=null;}
}
// **************  END COMMON MAP ********************************************************  

// **************  START USER REVIEW ********************************************************  
function showReviewwin(pk,rid,ct){mShowModalWin('UserRating','aj','/meeting-facilities/widgets/UserRating/widget.aspx?rid=' + rid + '&ppk='+ pk + '&ct='+ct,600,770,20,true,false,'UserReview',true) }   
function refreshfromedit(r,t){try{var bhv=$find('bhvRating'); bhv.set_Rating(r); updMyRating();refreshcomments(false)}catch(e){}}
function showmsg(){if (bShow){ showdim()}}
function showdim(){ bShow=false;var bhv=$find('bhvDim');bhv.showPopup()}   
function hidedim(){var bhv=$find('bhvDim');if(bhv){bhv.hidePopup()}  }
function showReview(rid){if (!usrv){forcelg2()}else{bShow=false;hidedim();showReviewwin(ppk,rid,ct);}}   
function onsavMyRating(n){showmsg()}
function savRat(n){var bhv=$find('bhvRating');bhv.set_Rating(n);savMyRating();}
function updMyRating(){lblInstr.style.display='none'}
function forcelg2() {if (window.confirm("You must be logged in to review this facility. Click 'OK' to Login or Register, click 'Cancel' to continue using the site")){dologin('act=' + "rvw,0");}}
function forcelg() {var bhv=$find('bhvRating');if (window.confirm("You must be logged in to rate this facility. Click 'OK' to Login or Register, click 'Cancel' to continue using the site")){var n=bhv.get_Rating();dologin('act=' + "savRat," + n )}else{bhv.set_Rating(orgrat)}}
function savMyRating() {var bhv=$find('bhvRating');var n=bhv.get_Rating();if (n!=orgrat){if (orgrat==0){updMyRating()};HTIWS.SaveQuickRating(n,ppk,onsavMyRating,onsavMyRating,n)}}
function openRatings(){window.open('/meeting-facilities/Facility-Classifications?sa=1','FacClassification','width=1040,height=600,resizable,scrollbars');}
// **************  END USER REVIEW ********************************************************  

// **************  GUI ELEMENTS ********************************************************  
function showshelp(){mShowModalWin('MapHelp','aj','/meeting-facilities/widgets/MapHelp/widget.aspx',400  ,700,30,true,false,'SearchHelp',true)}

function showMostTb(n){
    var tabContainers01 = $get(".tab-container-most");    
    $get("tbmr" + (n==0?'1':'0')).className="";
    $get("tbmr" + (n==0?'0':'1')).className="selected";
    
    $get("tbmrc" + (n==0?'1':'0')).style.display="none";
    $get("tbmrc" + (n==0?'0':'1')).style.display="block";
       
}


function togVid(a){var divWM=document.getElementById('divWM');var divRM=document.getElementById('divRM');_svpr(a);if (a=='RM'){divRM.style.display="";divWM.style.display="none";}else{divWM.style.display="";divRM.style.display="none";}}
function dogetalldest(u,l,a,bCC){
try{document.getElementById('pnlListP').className='ColumnLinkListRef';
if (a){myTrackEvent('Places','APlacesLetter',l,'')}else{myTrackEvent('Places','PlacesLetter',l,'')}
myTrackPageView(u + ':' + l, false, 'GetAllDest')
HTIWS.GetListDest(u,l,a,bCC,ondogetalldest,showError)
}catch(e){HTIWS.LogJSError( e.description,'dogetalldest;'+u + ';' + l+ ';' +a ,donothing,donothing)}}
function ondogetalldest(s){pnlListPlaces.innerHTML=s;pnlListPlaces.className='LinkList3';document.getElementById('pnlListP').className='LinkList3';window.setTimeout(rotateads,500)}
function tglStyle(a){if(a.className=='cSlideVHS'){a.className= 'cSlideVH'}else{a.className= 'cSlideVHS'}}
function showmore(){document.getElementById('divMore').className='cMoreS';document.getElementById('lnkMore').className='cMoreH';document.getElementById('lnkLess').className='cMoreS';}
function showless(){document.getElementById('divMore').className='cMoreH';document.getElementById('lnkMore').className='cMoreS';document.getElementById('lnkLess').className='cMoreH'}
function accChanging(s,a){ var idx=a._selectedIndex;rot_pnls[idx].className='';rot_pnls[rot_pnlsL].className='cPanelROff'; rot_pnlsL=idx}
function setTab(a,i,t,s){
try{  if (s!=''){s=s+'_'}
    if (t==false){var _th=0; eval('_th=' + i + 'tabth'); var s='window.clearInterval(' + _th + ')';;eval(s)}
    if (i==null  || i=='undefined'){i=''}
    var _lasttab=0
    eval('_lasttab=' + i + 'lasttab')
    if (_lasttab!=-1){
            var t=document.getElementById(i+"celTab" + _lasttab)
        var c=document.getElementById(i+"divTab" + _lasttab)
        t.className=s+ "clsTabOff"
        c.className=s+ "clsTabContentOff"
        var t=document.getElementById(i+"celTab" + a)
        var c=document.getElementById(i+"divTab" + a)        
        t.className=s+ "clsTabOn"
        c.className=s+ "clsTabContentOn"
    }
    eval(i+ 'lasttab=a')
}catch(e){HTIWS.LogJSError( e.description,'setTab' ,donothing,donothing)}
}
var tabplayer;
function inittabplayer(a){tabplayer=a;eval(a + "tabth=window.setInterval(shownext,7000)")  }
function shownext(){var _lasttab=0;var _tabcount=0;eval('_tabcount=' + tabplayer + 'tabcount');eval('_lasttab=' + tabplayer + 'lasttab');var l=_lasttab+1;if (l>_tabcount){l=1}; setTab(l,tabplayer,true)}


function setSlide(a,i,t){
    if (t==false){var _th=0; eval('_th=' + i + 'tabth'); var s='window.clearInterval(' + _th + ')';;eval(s)}
    if (i==null  || i=='undefined'){i=''}
    var _lasttab=0
    eval('_lasttab=' + i + 'lasttab')
    if (_lasttab!=-1){
            var t=document.getElementById(i+"celTab" + _lasttab)
        var c=document.getElementById(i+"divTab" + _lasttab)
        t.className="clsSlideOff"
        c.className="clsTabContentOff"
        var t=document.getElementById(i+"celTab" + a)
        var c=document.getElementById(i+"divTab" + a)        
        t.className="clsSlideOn"
        c.className="clsTabContentOn"
    }
    eval(i+ 'lasttab=a')
    
 }
 var slideplayer;
 function initslideplayer(a){slideplayer=a;eval(a + "tabth=window.setInterval(shownextslide,7000)")  }
function shownextslide(){var _lasttab=0;var _tabcount=0;eval('_tabcount=' + slideplayer + 'tabcount');eval('_lasttab=' + slideplayer + 'lasttab');var l=_lasttab+1;if (l>_tabcount){l=1}; setSlide(l,slideplayer,true)}


 function pageLoad(s,e) {s
     try{pageLoad_vtab(s,e)}catch(e){}
     try{pageLoad_htab(s,e)}catch(e){}
     try{pageLoad_map(s,e)}catch(e){}
     try{pageLoad_temp(s,e)}catch(e){}
 }
// **************  END COMMON MAP ********************************************************  

// **************  START HOTEL SEARCH ********************************************************  
var hotLURL='/Hotels'
function __rating(){
    var rt=''
    for (var k=0; k<=5; k++)
    {	var ctxt=getObj("chkStar"+k);
        if (ctxt){rt=rt+ ctxt.checked + '|'}
    }   
	return rt
}	      
function rtachecked(b){
var c=getObj('chkStar0')
 if (c){c.checked=true}
	for (var k=1; k<=5; k++)
	{	var ctxt=getObj("chkStar"+k);
	    if (ctxt){ctxt.checked=false}
	}
if (b){try{fchecked()}catch(e){}}
}
function rtchecked(){
var s=false;
	for (var k=1; k<=5; k++)
	{	var ctxt=getObj("chkStar"+k);
	    if (ctxt){s=s || ctxt.checked}
	}
	var c=getObj('chkStar0');
    if (c){c.checked=!s}
	try{fchecked()}catch(e){}
}
function htsearch(e){_cnEvt(e);winloc(hotLURL + '?hn=' + txtNameFilter.value + '&rt=' + __rating())}
// **************  END HOTEL SEARCH ********************************************************  

// **************  START APP MESSAGES ********************************************************  
var TPTOH=0;
function showTPPop(bhv,parentID,evt,md){if (md==null){md=2;}pnlTPMsg.style.display=''; if (parentID!=null){$find(bhv+ 'PopupBehavior').set_parentElement(parentID);} $find(bhv + 'PopupBehavior').set_positioningMode(md);if (parentID==null){ $find(bhv+ 'PopupBehavior').set_y(pHeight()/3); $find(bhv+ 'PopupBehavior').set_x(winWidth()/3)};$find(bhv).showPopup();if (parentID==null){$find(bhv+ 'PopupBehavior').set_y(pHeight()/3); $find(bhv+ 'PopupBehavior').set_x(winWidth()/3)};_cnEvt(evt);}
function hideTPPop(bhv){ var b=$find(bhv+ 'PopupBehavior'); if (b){b._hidePopup();}}
function shTPMsg(parentID,  msg,evt,pos,h,t){if (h==null){h=true};showTPMsg(parentID,  msg,evt,pos) ;if(h){ hideTPMsg(true,t);}}
function showTPMsg(parentID,  msg,evt,md){ if (md==null){md=2}; if (TPTOH>0){window.clearTimeout(TPTOH);TPTOH=0}; document.getElementById('divTPMsg').innerHTML=msg; showTPPop('popTPMsgOn',parentID,evt,md)}
function hideTPMsg(fd,t){if (!t){t=3000};   if (fd){TPTOH=window.setTimeout(hideTPMsgto,t)}else{_cnEvt();hideTPPop('popTPMsgOn');}}
function hideTPMsgto(){pnlTPMsg.style.display='none';  TPTOH=0}
// **************  START END MESSAGES ********************************************************  

// **************  START AJAX POPUP ********************************************************  
var bLastX=-1
function OnAJAXPopDataSucceeded(r, typ){if (r!=''){showdetail(r,typ)}}
function closePAj2(e){  window.setTimeout(closePAj,25)}//if this is done to quickly on click, it causes an error
function closePAjRef(e){window.location=window.location;  }
function closePAj(){ hideModal('aj')}   
function closeAj(){    
    //if (bLastX!=-1){var mybb =  $find('popBhvAj'+ 'PopupBehavior');bLastX=mybb.get_x();}
     b=$find('popBhvAj');if (b){b.hidePopup()}
}
function rAJAXPop(u,typ,arg,e){_cnEvt(e);if (typ=='DEST' ){jumpDest(u)}else{  showdetail('nw',typ,u) }}
function setDetail(c,h){c="<div id=ajTop2></div>"+c;pnlCnt.innerHTML=c;if (isMoz()){pnlCnt.style.height= h + 'px';}else{pnlCnt.style.height= h;}}
function showdetail(r,t,u){ 
_cnEvt()
    mShowModalWin ('HotelQuickView','aj',u,550,720,10,true,false,'HotelQuickView',true)
}	
function jumpDest(u){
    if (istp){
        if (tpwin){
            try{tpwin.location=u}catch(e){tpwin= window.open(u,'destination')}}
            else{tpwin= window.open(u,'destination')}
        if (!tpwin){alert('Unable to show Destination detail.  Please be sure your popup blockers are disabled.')}else{tpwin.focus();}
    }else{winloc(u)}
}
// **************  END AJAX POPUP ********************************************************  


function showAJAXPop(bhv,evt){$find(bhv).show(); _cnEvt(evt);}
function hideAJAXPop(bhv){$find(bhv).hide()}

// **************  END AJAX POPUP ********************************************************  

// **************  START FUNCTIONS  ********************************************************  
function isDate(dateStr) {
    var datePat = /^(\d{1,2})(\/|-)(\d{1,2})(\/|-)(\d{4})$/;
    var matchArray = dateStr.match(datePat); // is the format ok?
    return matchArray != null
}
function DateAdd(timeU,byMany,dateObj) {
	var millisecond=1;
	var second=millisecond*1000;
	var minute=second*60;
	var hour=minute*60;
	var day=hour*24;
	var year=day*365;

	var newDate;
	var dVal=dateObj.valueOf();
	switch(timeU) {
		case "ms": newDate=new Date(dVal+millisecond*byMany); break;
		case "s": newDate=new Date(dVal+second*byMany); break;
		case "mi": newDate=new Date(dVal+minute*byMany); break;
		case "h": newDate=new Date(dVal+hour*byMany); break;
		case "d": newDate=new Date(dVal+day*byMany); break;
		case "y": newDate=new Date(dVal+year*byMany); break;
	}
	return newDate;
}
function AND(a, b) {
  var result=0;
  var x=binaryArray(parseInt(a));
  var y=binaryArray(parseInt(b));
  var biggerArray=(x.length>=y.length)?x:y;
  var smallerArray=(biggerArray==x)?y:x;
  var len=biggerArray.length;
  for (var i=0;i<len;i++) {
    biggerArray[i]=(biggerArray[i]&smallerArray[i])?1:0;
    result+=biggerArray[i]*Math.pow(2, i);
  }
  return result;  
}

function binaryArray(num) {
  var arr=new Array();
  var div;
  var mod;
  var n=num;
  var count=0;
  do {
    mod=n%2;
    n=parseInt(n/2);
    arr[count++]=mod;
  } while (n>0)
  return arr;
}

// **************  END FUNCTIONS  ********************************************************  


function mEnablePage(){

    }

function mDisablePage(){
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var height = document.documentElement.clientHeight + document.documentElement.scrollTop;

    var layer = document.createElement('div');
    layer.style.zIndex = 2;
    layer.id = 'layer';
    layer.style.position = 'absolute';
    layer.style.top = '0px';
    layer.style.left = '0px';
    layer.style.height = document.documentElement.scrollHeight + 'px';
    layer.style.width = width + 'px';
    layer.style.backgroundColor = 'gray';
    layer.style.opacity = '.6';
    layer.style.filter += ("progid:DXImageTransform.Microsoft.Alpha(opacity=60)");
    document.body.style.position = 'static';
    document.body.appendChild(layer);      
    
}

function hideModal(n) { if (document.getElementById('layer')) { document.body.removeChild(document.getElementById('layer')); document.body.style.position = ''; document.body.removeChild(document.getElementById(n)) }; $("#header-search").css('z-index',501) }
function mShowModalWin(name,id,src,h,w,t,trn,cntr,type,bHeight)
{
    $("#header-search").css('z-index', 1)
_cnEvt();
try{
    var width = document.documentElement.clientWidth + document.documentElement.scrollLeft;
    var height = document.documentElement.clientHeight + document.documentElement.scrollTop;
    mDisablePage()
    var size = { 'height':h, 'width': w };
    var i = document.createElement('iframe');
    i.name = name;
    i.id = id;
    if (size.height>0 && bHeight){src=appndURL(src,"h=" + size.height)}
    i.src = '/meeting-facilities/ifrblank.htm'// no white    
    i.scrolling='no';
    i.style.height = size.height + 'px';
    i.style.width = size.width + 'px';
    t=(document.documentElement.scrollTop-20)+t;
    i.style.position = 'absolute';
    i.style.zIndex = 3;
    if (trn){i.allowTransparency=true}
    else{
      i.style.backgroundColor = 'white';
      i.style.border = '2px solid silver';
    }
    i.frameBorder = 'no';	
   
    if (cntr){i.style.top = '100px'}else{    
    i.style.top = t + 'px'}
    i.style.left = (width / 2) - (size.width / 2) + 'px';		
    document.body.appendChild(i); 
    i.src = src;    
    myTrackEvent('Popup','ShowPopup',name, '')
}catch(e){HTIWS.LogJSError( e.description,'mShowModalWin;'+name ,donothing,donothing)}
}

// **************  START BROWSER  ********************************************************  
function pWidth(){var w=winWidth(); if (w>1050){w=1050}else{w=900};return w}   
function pWidth2(){var w=winWidth();if (w>730){w=730};return w;}   
function pHeight2(){var h=winHeight();if (h>600){h=600};return h;}   
function pHeight(){var h=winHeight();return h;}     

function scrollTop(){
  var scr = 0
  if( isMoz()) {
    scr = window.pageYOffset;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    scr = document.documentElement.scrollTop;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    scr = document.body.scrollTop;  
   }
  return scr;
}
function setscrollTop(x){
  if( isMoz()) {
    window.pageYOffset=x;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
     document.documentElement.scrollTop=x;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
     document.body.scrollTop=x
   }
  
}
function winWidth(){
  var myWidth = 0
  if( isMoz()) {
    myWidth = window.innerWidth;
      } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;  }
  
  return myWidth;
}
function isMoz(){return  (typeof( window.innerHeight ) == 'number') }
function isIE(){return !isMoz()}
function isIE7(){if (isIE()){return (navigator.appVersion.indexOf('MSIE 7.0')!=-1)}else{return false}}
function isIE6p(){if (isIE()){return !(isIE7())}else{return false}}
function winHeight(){
  var myHeight = 0
  if( isMoz()) {
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientHeight || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientHeight || document.body.clientHeight ) ) {
    //IE 4 compatible
    myHeight = document.body.clientHeight;
  }
  return myHeight; 
}
function f_scrollTop() {
var n=0
	if (window.pageYOffset){n= window.pageYOffset}
	else if(document.documentElement){n= document.documentElement.scrollTop}
	else if(document.body){n= document.body.scrollTop}
return n
}
function s_scrollTop() {
	if (window.pageYOffset){window.pageYOffset=0}
	else if(document.documentElement){document.documentElement.scrollTop=0}
	else if(document.body){document.body.scrollTop=0}
}
function s_scrollLeft() {
	if (window.pageXOffset){window.pageXOffset=0}
	else if(document.documentElement){document.documentElement.scrollLeft=0}
	else if(document.body){document.body.scrollLeft=0}
}

// **************  END BROWSER  ********************************************************  



function rotatingTab(settingarg){
	this.setting=settingarg
	settingarg=null
	var setting=this.setting
	setting.fadeduration=parseInt(setting.fadeduration)
	setting.tabcount=parseInt(setting.tabcount)
	setting.curTab=1
	setting.ispaused=!setting.autoplay[0]
	setting.currentstep=0 //keep track of # of slides tabs has gone through
	setting.totalsteps=setting.tabcount*setting.autoplay[2]
	setting.fglayer=0, setting.bglayer=1 //index of active and background layer (switches after each change of slide)
	setting.oninit=setting.oninit || function(){}
	setting.onTabChange=setting.onTabChange || function(){}
	var tabs=this
	
		var setting=tabs.setting
		tabs.showslide(setting.curTab) //show initial slide
		setting.oninit.call(tabs) //trigger oninit() event
	
}

rotatingTab.prototype={

    showtab: function(idx){
      if (!this.setting.ispaused){this.navigate('pause')}
        this.navigate(idx)
     },
	navigate:function(keyword){
		clearTimeout(this.setting.playtimer)
		this.setting.totalsteps=100000 //if any of the nav buttons are clicked on, set totalsteps limit to an "unreachable" number 
		if (!isNaN(parseInt(keyword))){
			this.showslide(parseInt(keyword))
		}
		else if (/(prev)|(next)/i.test(keyword)){
			this.showslide(keyword.toLowerCase())
		}
		else{ //if play|pause button
			var tabs=this
			if (!this.setting.ispaused){ //if pause Gallery
				this.setting.autoplay[0]=false
			}
			else if (this.setting.ispaused){ //if play Gallery
				this.setting.autoplay[0]=true
				this.setting.playtimer=setTimeout(function(){tabs.showslide('next')}, this.setting.autoplay[1])
			}
			tabs.setting.ispaused=!tabs.setting.ispaused
		}
	},

	showslide:function(keyword){
		var tabs=this
		
		var setting=tabs.setting
		var totaltabs=setting.tabcount
		var tabindex=(keyword=="next")? (setting.curTab<totaltabs? setting.curTab+1 : 1)
			: (keyword=="prev")? (setting.curTab>1? setting.curTab-1 : totaltabs)
			: Math.min(keyword, totaltabs)		
        var t=document.getElementById(setting.wrapperid +"celTab" + setting.curTab)
        var c=document.getElementById(setting.wrapperid +"divTab" + setting.curTab)
        t.className=setting.skin + "clsTabOff"
        c.className=setting.skin + "clsTabContentOff"
        var t=document.getElementById(setting.wrapperid+"celTab" + tabindex)
        var c=document.getElementById(setting.wrapperid+"divTab" + tabindex)        
        t.className=setting.skin + "clsTabOn"
        c.className=setting.skin + "clsTabContentOn"
        

	clearTimeout(setting.playtimer)
				setting.currentstep+=1
				if (setting.autoplay[0]){
					if (setting.currentstep<=setting.totalsteps)
						setting.playtimer=setTimeout(function(){tabs.showslide('next')}, setting.autoplay[1])
					else
						tabs.navigate("play/pause")
				}
		setting.curTab=tabindex

	}
	
	}

	$('div.ad').ready(function() {if ($('div.ad div').length > 0) { $('div.ad div').css('position', 'absolute'); }});




