//  ******************* CLIENT_SIDE SNIFFER CODE *******************
//	stylesheet selection removed - used for some DHTML stuff that is not on every page, but is on
//	enough to justify being in global file

// comment out this line when doing javascript debugging
self.onerror = function() {return true;}
// override by including Log.js
var dlog = new function (){this.alert = function() {} }

var agt=navigator.userAgent.toLowerCase();

//  BROWSER VERSION
// Note: On IE5, these return 4, so use is_ie5up to detect IE5. ** actually is_ie5up only works for 5.0x (see below)  **
var is_major = parseInt(navigator.appVersion);
var is_minor = parseFloat(navigator.appVersion);
var is_saf_build = parseFloat(agt.substring(agt.indexOf("safari") + 7));  // Will drop anything after the 2nd decimal

//  BROWSER TYPE
var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1)
            && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1)
            && (agt.indexOf('webtv')==-1));
var is_nav4up = (is_nav && (is_major >= 4 && is_major < 5)); // Netscape 4.x (should be named is_nav4x)
var is_nav6 = (is_nav && (is_major >= 5 )); // Used for Netscape 6+, will return true for all Mozilla (should be is_moz5up)
var is_nav6x= (is_nav && (is_major == 5 ) && (agt.indexOf("netscape6")!=-1) ); // Netscape 6.x
var is_ie   = (agt.indexOf("msie") != -1);
var is_ie3  = (is_ie && (is_major < 4));
var is_ie4  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")==-1) ); // incorrectly returns true for IE 5.5 and IE 5.2
var is_ie4up  = (is_ie  && (is_major >= 4));
var is_ie5x = (is_ie && (is_major == 4) && (agt.indexOf("msie 5")!=-1) );
var is_ie5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) ); // IE 5.0x only (not 5.x)
var is_ie55  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5")!=-1) ); // IE 5.5x only
var is_ie5up  = (is_ie  && !is_ie3 && !is_ie4); // based off of is_ie4, so misidentifies IE 5.5x and IE 5.2x as false
var is_saf = (agt.indexOf("safari")!=-1);
var is_saf12up = (is_saf && is_saf_build >= 125);

//  PLATFORM
var is_win   = ( (agt.indexOf("win")!=-1) || (agt.indexOf("16bit")!=-1) );
var is_mac    = (agt.indexOf("mac")!=-1);
var is_linux = (agt.indexOf("inux")!=-1);
var is_unix  = ((agt.indexOf("x11")!=-1) || is_linux);

// UNUSED FLAGS
// var is_saf11up = (is_saf && is_saf_build >= 100);
// var is_saf13up = (is_saf && is_saf_build >= 312);
// var is_saf2up = (is_saf && is_saf_build >= 412);

// Reroute non-dom browsers, all IE 5.x versions except 5.5x, Netscape 6, Safari below 1.2

if ( !document.getElementById || (is_ie5x && !is_ie55) || is_nav6x || (is_saf && !is_saf12up) ) {
	document.location="http://www.orbitz.com/shared/util/browserUpgrade.jsp";
}

// DATE FUNCTIONALITY
var today = new Date();
var thisDay = today.getDate();
var thisMonth = today.getMonth();
var thisYear = y2k(today.getYear());

var monthArray = new Array('Jan','Feb','Mar','Apr','May','Jun','Jul','Aug','Sep','Oct','Nov','Dec');
var dayArray = new Array(31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31);

function y2k (number) {
	return (number < 1000) ? number + 1900 : number;
}

function setArrays() {
	if (((thisYear % 4 == 0) && (thisYear % 100 != 0)) || (thisYear % 400 == 0))
		dayArray[1] = 29;
}
// this function is currently irrelevent, and could be merged with changeDateGen,
// but i'm leaving here in case further abstraction is necessary down the road.

function changeDate (ddArray,whichDD) {
	if (ddArray.length >= 4) {
		var sMo = ddArray[0];
		var sDy = ddArray[1];
		var eMo = ddArray[2];
		var eDy = ddArray[3];
		if (whichDD != 3 && whichDD != 4) // put in because of in-stream change of date-chaning rules.
			changeDateGen(sMo,sDy,eMo,eDy,whichDD);
	}
}

// generic date changing function
// only thing missing is safeguard against dates that don't exist (e.g. nov 31)
function changeDateGen (sMo,sDy,eMo,eDy,whichDD) {
	var sMoIndex = sMo.options.selectedIndex;
	var sDyIndex = sDy.options.selectedIndex;
	var eMoIndex = eMo.options.selectedIndex;
	var eDyIndex = eDy.options.selectedIndex;

	var sDate = getDDdate(sMo,sDy);
	var eDate = getDDdate(eMo,eDy);

	if (whichDD==0 && sDate>eDate) {
		if (whichCal==1) {
			setDDdate(eMo,eDy,addDays(sDate,tripLength));
		} else if (whichCal==2) {
			setDDdate(sMo,sDy,addDays(eDate,-1*tripLength));
		}
	} else if (sMoIndex>eMoIndex) {
		if (whichDD==1) {
			eMo.options.selectedIndex = sMoIndex;
			if (sDyIndex>eDyIndex) setDDdate(eMo,eDy,addDays(sDate,tripLength));
		} else if (whichDD==3) {
			sMo.options.selectedIndex = eMoIndex;
			if (sDyIndex>eDyIndex) setDDdate(sMo,sDy,addDays(eDate,-1*tripLength));
		}
	} else if (sMoIndex==eMoIndex && sDyIndex>eDyIndex) {
//		these two lines should be there instead of the two lines that follow.
//		if (whichDD==1 || whichDD==3) {
//			eDy.options.selectedIndex = Math.min(sDy.options.selectedIndex+tripLength,getMonthLength(eMo.options[eMoIndex].value)-1);
		if (whichDD==1) { // put in because of in-stream change of date-chaning rules.
			setDDdate(eMo,eDy,addDays(sDate,tripLength));
		} else if (whichDD==2) {
			setDDdate(eMo,eDy,addDays(sDate,tripLength));
		} else if (whichDD==4) {
			setDDdate(sMo,sDy,addDays(eDate,-1*tripLength));
		}
	}
}

function getDDdate (moDD,dyDD) {
	var moYr = moDD.options[moDD.options.selectedIndex].value.split(" ");
	var mo = moYr[0].substr(0,3);
	var yr = (moYr.length > 1) ? moYr[1] : thisYear;
	var dy = dyDD.options[dyDD.options.selectedIndex].value;

	for (i=0;i<monthArray.length;i++) {
		if (monthArray[i] == mo) break;
	}
	return new Date(yr,i,dy);
}

function getMonthLength (mo) {
	mo = mo.substr(0,3).toLowerCase();
	for (var i=0;i<monthArray.length;i++) {
		if (monthArray[i].toLowerCase() == mo) break;
	}
	return dayArray[i];
	return 31;
}

function setDDdate (moDD,dyDD,theDate) {
	var maxMoYr = moDD.options[moDD.options.length-1].value;
	maxMoYr = maxMoYr.split(" ");
	var maxDy = getMonthLength(maxMoYr[0]);
	//BCL - temp js fix
	//theDate = new Date(Math.min(new Date(maxMoYr[0]+" "+maxDy+", "+maxMoYr[1]),theDate));

	var yr = theDate.getFullYear();
	var mo = monthArray[theDate.getMonth()];
	var dy = theDate.getDate();
	var matchedMo = -1;

	var matchVal = (yr==thisYear) ? mo : mo + " " + yr;
	for (var i=0;i<moDD.options.length;i++) {
		if (moDD.options[i].value == matchVal) {
			matchedMo = i;
			break;
		}
	}
	if (matchedMo == -1) dy = 1;

	moDD.options.selectedIndex = Math.max(0,matchedMo);
	if(whichCalsNum>0)
		dyDD.options.selectedIndex = dy;
	else
		dyDD.options.selectedIndex = dy-1;
}

function addDays (theDate,days) {
	if (!days) days = 0;
	var mseconds = theDate.getTime() + 86400000 * days;
	return new Date(mseconds);
}

var theForm;
var dateDDs = new Array();
var whichCal = 0;
var whichCalsNum = 0;
var tripLength = 7;
var changeDates = true; 

function selectDate (dy,moYr) {
	moYr = moYr.split(" ");
	var mo = moYr[0].substr(0,3);
	var yr = moYr[1];
	var theDate = new Date(mo + " " + dy + ", " + yr);

	var moDD, dyDD;
	if(whichCalsNum>0){
		var monthDDType=(whichCal==1)?'monthInPIB':'monthOutPIB';
		var dayDDType=(whichCal==1)?'dayInPIB':'dayOutPIB';
		moDD=document.getElementById(monthDDType+whichCalsNum);
		dyDD=document.getElementById(dayDDType+whichCalsNum);
	}else{
		moDD = dateDDs[(whichCal*2)-2];
		dyDD = dateDDs[(whichCal*2)-1];
	}
	setDDdate (moDD,dyDD,theDate,0);

	if (changeDates) {
	
		if(whichCalsNum>0){
			whichCalsNum = 0;
			moDD.onchange();
			dyDD.onchange();
		}
		if (dateDDs.length == 4) changeDateGen (dateDDs[0],dateDDs[1],dateDDs[2],dateDDs[3],0);
		else if (dateDDs.length > 4) changeMultiDate(whichCal,0);
	}
	whichCal = 0;
}

function changeMultiDate (whichDate,whichDD) {
	var whichMoDD = (whichDate-1)*2;
 	var whichDyDD = whichMoDD+1;
	var dateDiff = 0;
	var i, firsti, whichDDofFour;
	whichCal=2;
	for (i=firsti=whichDate-1;i>=1;i--) {
		dateDiff = (firsti-i) * 2;
		whichDDofFour = (i==firsti && whichDD>0) ? whichDD+2 : 0;
		changeDateGen(dateDDs[whichMoDD-dateDiff-2],dateDDs[whichDyDD-dateDiff-2],dateDDs[whichMoDD-dateDiff],dateDDs[whichDyDD-dateDiff],whichDDofFour);
	}
	whichCal=1;
	for (i=firsti=whichDate+1;i<=(dateDDs.length/2);i++) {
		dateDiff = (i-firsti) * 2;
		whichDDofFour = (i==firsti && whichDD>0) ? whichDD : 0;
		changeDateGen(dateDDs[whichMoDD+dateDiff],dateDDs[whichDyDD+dateDiff],dateDDs[whichMoDD+dateDiff+2],dateDDs[whichDyDD+dateDiff+2],whichDDofFour);
	}
	whichCal=0;
}

// ONFOCUS & ONBLUR FUNCTIONALITY
// how to call: [onFocus="textFocus(this);" onBlur="textBlur(this);"]
function textFocus (el,val) {
	if (val) {
		el.defaultValue = val;
		if (el.value == val) el.select();
	}
	else if ((el.value != "")||(el.value != " ")) {
		//el.defaultValue = el.value;
		el.select();
	}
}

function textBlur (el,val) {
	if (val) el.defaultValue = val;
	if ((el.value == "")||(el.value == " ")) {
		//el.value = el.defaultValue;
	}
}


//reloads the window if Nav4 resized
function MM_reloadPage (init) {
 	if (init) with (navigator) {
 		if ((appName=="Netscape") &&(parseInt(appVersion)==4)) {
			document.MM_pgW=innerWidth;
			document.MM_pgH=innerHeight;
			onresize=MM_reloadPage;
		}
	} else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) {
		location.reload();
	}
}

//img swap
function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_showHideLayers() { //v6.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-1); i+=2) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+1];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v=='hide')?'hidden':v; }
    obj.visibility=v; }
}

MM_reloadPage(true);

function isXPSP2(){
var isSP2=window.navigator.userAgent.indexOf("SV1") != -1;
return isSP2;
}


function msgUserPopUpBlockerIsOn(){
	//alert("It appears that you currently have pop-up blocking turned on.\n In order to view this content, please use the Control key when clicking the link.");
	if (document.getElementById("blockedPUMesgBox")) {
		document.getElementById("blockedPUMesgBox").style.display = "block";
	}
}


// general popup - specify href, width, and height in function call
function popUpGen (page,w,h,id,globalProps,sWindowName) {
	if (!sWindowName) sWindowName = "oPop";
	if (!id) id="popup";
	if (!globalProps) globalProps = "resizable=yes,menubar=no,status=no,scrollbars=yes,toolbar=no,directories=no,location=no";
	if (!w||w=='') w=500;
	if (!h||h=='') h=500;
	var win;
	if (navigator.appName == 'Netscape') {
		win = window.open(page,id,'width='+w+',height='+h+','+globalProps+',screenX=0,screenY=0');
	} else {
		win = window.open(page,id,'width='+w+',height='+h+','+globalProps+',top=0,left=0');
	}
	eval(sWindowName + " = win");
	if(isXPSP2() && win==null){
		msgUserPopUpBlockerIsOn();
	} else {
		win.focus();
	}
  	return false;
}

//add an event listener using the appropriate DOM or proprietary methods
function addEvent(obj, evType, fn, useCapture) {
	if (obj.addEventListener) {
		obj.addEventListener(evType, fn, useCapture);
		return true;
	} else if (obj.attachEvent) {
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
}

//	hotwire popup
function popUpHotwire(page) {
	return popUpGen(page, 760, 620, 'hotwire', 'resizable=yes,menubar=yes,status=yes,scrollbars=yes,toolbar=yes,directories=yes,location=yes');
}


function popUpPrintItin(url){
	return popUpGen(url, 635, 600, 'print', 'resizable=yes,menubar=yes,status=no,scrollbars=yes,toolbar=no,directories=no,location=no');
}

// standard popup
function popUp(page) {
	return popUpGen('http://www.orbitz.com/'+page+'.jsp',420,400,'popup');
}

// specialized popup functions
function popUpHelp (page) {
	return popUpGen('http://www.orbitz.com/help/'+page+'.jsp',420,400,'popuphelp');
}

var calendarLink = "http://www.orbitz.com/App/ViewCalendar";
function popUpCal(n) {
	whichCalsNum = 0;
	whichCal = n;
	var setMonth = "";
	if(arguments.length>1){
		var monthDDType=(whichCal==1)?'monthInPIB':'monthOutPIB';
		whichCalsNum = arguments[1];
		var monthDD=document.getElementById(monthDDType+whichCalsNum);
		if(monthDD.value=='none'||monthDD.value==''){
			setMonth=monthDD.options[1].value.split(" ");
		}else{
			setMonth=monthDD.value.split(" ");
		}
	}else{
		setMonth = dateDDs[(n-1)*2].options[dateDDs[(n-1)*2].options.selectedIndex].value.split(" ");
	}
	var setYear = setMonth[1] ? setMonth[1] : "";
	setMonth = setMonth[0];
	var token = calendarLink.indexOf("?") == -1 ? "?" : "&";
	return popUpGen(calendarLink+token+"n="+n+"&view=calendar&setMonth="+setMonth+"&setYear="+setYear,200,390,'popupcal','resizable=yes,menubar=no,status=no,scrollbars=no,toolbar=no,directories=no,location=no');
}

function popUpAirCode() {
	return popUpGen('http://www.orbitz.com/shared/pagedef/content/air/airportCodes.jsp',600,725,'popupaircode');
}

function popUpLearnMore (url) {
	return popUpGen(url,500,400,'popuplearnmore');
}

// privacy and terms
function popUpReg(page) {
	return popUpGen('http://www.orbitz.com/App/global/legal/'+page+'.jsp',550,500);
}

// close window
function closeWin () {
	window.close();
	return true;
}

//Used for dynamically generated booking path section numbers
var sCount=0;
function stepCount(){
	sCount++;
	document.write(sCount);
}

var field_length=0;

function tabNext (obj,event,len,next_field) {
	if (event == "down") {field_length=obj.value.length;}
	else if (event == "up") {
		if (obj.value.length != field_length) {
			field_length=obj.value.length;
			if (field_length == len) {next_field.focus();}
		}
	}
}

// onkeyup="tabNext(this,'up',3,this.form.elements['NEXTFIELD'])" onkeydown="tabNext(this,'down',3)"

function selectCheck(formName,checkName){
	if (document.forms[formName].elements[checkName].checked){document.forms[formName].elements[checkName].checked=false;}
	else {document.forms[formName].elements[checkName].checked=true;}
}

function selectRadioBtn(formName, radioGroupName, btnIndex) {
	var radioBtns = document.forms[formName].elements[radioGroupName];
	radioBtns[btnIndex].checked = true;
}

// Netscape style sheet modifications
var text = "";
text += '<style type="text/css">\n';
text += 'td			{font-family: arial, sans-serif; font-size: 12px;}\n';
text += 'p			{font-family: arial, sans-serif; font-size: 12px;}\n';
text += 'input		{font-family: arial, sans-serif; font-size: 12px; margin: 0px;}\n';
text += 'select		{font-family: arial, sans-serif; font-size: 12px; margin: 0px}\n';
text += '.t1		{font-family: arial, sans-serif; font-size: 10px;}\n';
text += '.t2		{font-family: arial, sans-serif; font-size: 11px;}\n';
text += '.t3		{font-family: arial, sans-serif; font-size: 12px;}\n';
text += '.dealList	{padding-bottom: 0px; padding-right: 0px; line-height: normal;}\n';
text += '</style>';

if (document.layers) {document.write(text);}

//	Windows IE stylesheet mods

var ieStyle = "";
ieStyle += '<style type="text/css">\n';
ieStyle += '.radioOutdent	{margin-left: -6px;}\n'
ieStyle += '.checkOutdent	{margin-left: -4px;}\n'
ieStyle += '</style>';

if (is_ie4up && is_win) {document.write(ieStyle);}


// NN 6+ stylesheet mods

var nnStyle = "";
nnStyle += '<style type="text/css">\n';
nnStyle += '.radioMargin	{margin-right: 6px;}\n'
nnStyle += '</style>';

if (is_nav6 && is_win) {document.write(nnStyle);}



function bonusDays (el,legs) {
	// unsure why this function is needed. i don't think it's ever called.
	if (el.checked) {
		dateDDs[0].selectedIndex = 0;
		dateDDs[1].selectedIndex = 0;
		if (legs == 2) {
			dateDDs[2].selectedIndex = 0;
			dateDDs[3].selectedIndex = 0;
		}
	}
}


function activateCkbox(id){
	//this function is designed to *only* turn a checkbox on.  Use toggleCheckbox for toggling
	if(document.getElementById(id))
		document.getElementById(id).checked=true;
}

function toggleCheckbox (el) {
	el.checked = !el.checked;
}

function changeStatus (txt) {
	if (!txt) txt="";
	window.status=txt;
	return true;
}

function stripYears(x) {
	//This goes from the bottom up.
	//I causes problems.
	//Why was it done this way?
	for (var i = x.options.length - 1; i >= 0; i--)  {
		noYear = x.options[i].text.split(' ');
		x.options[i].text = noYear[0];
	}
	/*This works fine.
	for (var i=0; i<x.options.length; i++)  {
		noYear = x.options[i].text.split(' ');
		x.options[i].text = noYear[0];
	}*/
}


function botInit () {
	//will be redefined on any page that needs it.
}

function pageInit () {
	//will be redefined on any page that needs it.
}

function init () {
	setArrays();
	botInit(); // for bots
	pageInit();
}

var isDynamicPackage=false;
var nothing="";//don't ask


function jumpMenu(targ,selObj,restore){
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}



//--------------------------------------------------------
// Use for long select boxes

var alphabet = new Array("A","B","C","D","E","F","G","H","I","J","K","L","M","N","O","P","Q","R","S","T","U","V","W","X","Y","Z");

//Jumps down select box to first option text that starts with letter

function goToLetter(selectBox,letter) {
    var idx;
    for (var n = 0; n < selectBox.options.length; n ++) {
        var firstLetter = selectBox.options[n].text.charAt(0).toUpperCase();
        if (firstLetter == letter) {
            idx = n;
            var scroll = selectBox.options.length - 1;
           //This places selected option at top of select box
            selectBox.selectedIndex = scroll;
            selectBox.selectedIndex = idx;
            break;
        } else if (n == selectBox.options.length - 1) {
            if (letter == "A") {
                selectBox.selectedIndex = 0;
            } else if (letter == "Z") {
                selectBox.selectedIndex = selectBox.options.length - 1;
            } else {
                for (var t = 0; t < alphabet.length; t ++) {
                    if (alphabet[t] == letter) {
                        var newLetter = alphabet[t + 1];
                    }
                }
                //IF no options begin with letter, display option that begins with next letter in alphabet
                goToLetter(selectBox,newLetter);
            }
        }
    }
}

function toggleCkbox(id){
	if(document.getElementById){
			document.getElementById(id).checked=true;
			}
		}
 

//--------------------------------------------------------

//global catch for the exit app
var runUnLoadActivity=true;

// declaring exitapp functions as blank, they get redefined by exitApp.js,
// but this way, if they are called by a page that doesn't call exitApp.js,
// they won't cause errors. - this eliminates the need for switches in the
// body tag.
function unLoadActivity(){};
function onLoadActivity(){};
function noEA(){
	runUnLoadActivity=false;
}

function formHIASubmit() {
// usage - formSubmit('formName', 'replaceFormAction', 'firstElement|firstElementNewValue', 'secondElement|secondElementNewValue')
	var a=formHIASubmit.arguments;
    var f=document[formHIASubmit.arguments[0]];
    f.action = formHIASubmit.arguments[1];
	l=a.length;
	for (i=2; i<l; i+=1){
		pair = a[i].split('|');
		el = pair[0];
		newVal = pair[1];
		f[el].value = newVal;
	}
	f.submit();
	return false;
}

function formSubmit() {
// usage - formSubmit('formName', 'firstElement|firstElementNewValue', 'secondElement|secondElementNewValue')
// you can use as many element/value pairs as you want
	var a = formSubmit.arguments;
	var f = document[formSubmit.arguments[0]];
	for (var i = 1; i < a.length; i++){
		var pair = a[i].split('|');
		var el = pair[0];
		var newVal = pair[1];
		f[el].value = newVal;
	}
	f.submit();
	return false;
}

function dpToggle(x){
	document.getElementById('check' + x).checked=true;
	document.dpswitch.submit();
}

function goTo(URL) {
	self.location = URL;
}

//Set the max characters on a textarea (doesnt accept "maxlength" property like text fields) - onkeyup, onkeypress, onkeydown events
function restrictLength(field,n) { //n is the max characters allowed
	if (field.value.length > n) {
		field.value = field.value.substring(0,n);
	}
}

// OnlineOpinion (S3t,1424b)
// This product and other products of OpinionLab, Inc. are protected by U.S. Patent No. 6606581, 6421724, 6785717 B1 and other patents pending.
var custom_var,_sp='%3A\\/\\/',_rp='%3A//',_poE=0.0, _poX=0.0,_sH=screen.height,_d=document,_w=window,_ht=escape(_w.location.href),_hr=_d.referrer,_tm=(new Date()).getTime(),_kp=0,_sW=screen.width;_d.onkeypress=_fK;
function _fK(_e){if(!_e)_e=_w.event;var _k=(typeof _e.which=='number')?_e.which:_e.keyCode;if((_kp==15&&_k==12))_w.open('http://www.opinionlab.com/ozone/24-7.asp?referer='+_fC(_ht),'Report','width=370,height=200,resizable=no,copyhistory=no,scrollbars=no');_kp=_k};
function _fC(_u){_aT=_sp+',\\/,\\.,-,_,'+_rp+',%2F,%2E,%2D,%5F';_aA=_aT.split(',');for(i=0;i<5;i++){eval('_u=_u.replace(/'+_aA[i]+'/g,_aA[i+5])')}return _u};
function O_LC(){_w.open('http://ccc01.opinionlab.com/comment_card.asp?time1='+_tm+'&time2='+(new Date()).getTime()+'&prev='+_fC(escape(_hr))+'&referer='+_fC(_ht)+'&height='+_sH+'&width='+_sW+'&custom_var='+custom_var,'comments','width=535,height=192,screenX='+((_sW-535)/2)+',screenY='+((_sH-192)/2)+',top='+((_sH-192)/2)+',left='+((_sW-535)/2)+',resizable=yes,copyhistory=yes,scrollbars=no')};
function _fPe(){if(Math.random()>=1.0-_poE){O_LC();_poX=0.0}};
function _fPx(){if(Math.random()>=1.0-_poX)O_LC()};window.onunload=_fPx;
function O_GoT(_p){_d.write('<a href=\'javascript:O_LC()\'>'+_p+'</a>');_fPe()}

//Address and Phone modules
function submitWithActionFromHref(a){
//This function gets the parent form of the clicked link,
//sets the action to the link href, and submits the form.
var f=getParentFormFromElement(a);
	if(f!=null){
		f.action=a.href;
		f.submit();
	}else{
		return true;
	}
	return false;
}

function submitWithActionFromElement(el,url){
var f=getParentFormFromElement(el);
	if(f!=null){
		f.action=document.getElementById(url).value;
		f.submit();
	}else{
		return true;
	}
	return false;
}

function getParentFormFromElement(el){
//returns the parent form of the passed element, or null if the element is not in a form
	while(el.parentNode!=null&&el.tagName.toUpperCase()!='FORM'){
		el=el.parentNode;
	}
	return el;
}

function changeCss(id,style) {
        document.getElementById(id).className = style;
}

function expandPromoCode() {
document.getElementById('promoDirections').className+=" visible";
document.getElementById('expand').className+=" expanded";
}

function collapsePromoCode() {
document.getElementById('promoDirections').className=document.getElementById('promoDirections').className.replace(new RegExp(" visible\\b"), "");
document.getElementById('expand').className=document.getElementById('expand').className.replace(new RegExp(" expanded\\b"), "");
}



