function show_print_coupon(url, lCouponId)
{
	if (url) {
	    var oNewWin = window.open(url + "?cid="+lCouponId, "printcoupon", "height=540,width=430,resizable=yes,menubar=no,location=no,status=no,scrollbars=no");
	    oNewWin.focus();
	}
}

function show_print_allcoupons(url, sOfferType) 
{
	if (url) {
	    var oNewWin = window.open(url + "?t="+sOfferType, "printcoupons", "height=540,width=444,resizable=yes,menubar=no,location=no,status=no,scrollbars=yes");
	    oNewWin.focus();
	}
}

function pwordPopup(url) {
	if (url) {
	    var oNewWin = window.open(url, "passWindow", "height=400,width=432,resizable=no,menubar=no,location=no,status=no,scrollbars=no");
        oNewWin.focus();
    }
}

function windowOpen(url) 
{
	if (url) {
        window.open (url,"")
    }
}
    
function popupEstore(url)
{
	if (url) {
		var oNewWin = window.open(url, '', 'width='+screen.width+',height='+screen.height+',resizable=yes,scrollbars=yes,menubar=false');
	    oNewWin.focus();
	}
}

function popRadioNavi(url)
{
    if (url) {
	    var oNewWin = window.open(url, '', 'height=725, width=1010,resizable=no,menubar=no,location=no,status=no,scrollbars=no');
	    oNewWin.focus();
	    }
}

function helpPopUp(url) 
{
	
	if (url) {
	    var oNewWin = window.open(url, 'helpWindow', 'height=350, width=586,resizable=no,menubar=no,location=no,status=no,scrollbars=yes');
	    oNewWin.focus();
	}
}

function helpPopUpForRemoteEngineStarter(url) 
{
	
	if (url) {
	    var oNewWin = window.open(url, 'RemoteEngineStarterhelpWindow', 'height=400, width=798,resizable=no,menubar=no,location=no,status=no,scrollbars=yes');
	    oNewWin.focus();
	}
}

function ResetApptReminderDays(chkEmailApptReminder, ddlReminderDays){
	if(chkEmailApptReminder.checked == false){
		//Reset to 1 Day
		ddlReminderDays.selectedIndex = 1;
	}
}

function ResetApptReminderDaysAcuraLink(chkApptReminder, ddlReminderDays){
	if(chkApptReminder.checked == false){
		var ctl;
		ctl = document.getElementById(ddlReminderDays);
		ctl.disabled = true; }
	
	else {
    	var ctl;
		ctl = document.getElementById(ddlReminderDays);
		ctl.disabled = false; }
}


function CreateControl(CODEBASE, CLSID, ObjectID, WIDTH, HEIGHT, URL, QUALITY, BGCOLOR, ALIGN, SCRIPTACCESS, TYPE, PLUGINSPAGE, type)	
{
    if (type == 'swf')	{
	    var	sString = '<object classid=' + CLSID + ' codebase=' + CODEBASE + ' id=' + ObjectID + ' width=' + WIDTH + ' height=' + HEIGHT + ' align=' + ALIGN + '><param name="allowScriptAccess" value="' + SCRIPTACCESS + '"><param name="movie" value="' + URL + '"><param name="quality" value="' + QUALITY + '"><param name="bgcolor" value="' + BGCOLOR + '"><param name="wmode" value="transparent"><embed src=' + URL + ' quality=' + QUALITY + ' bgcolor=' + BGCOLOR + ' width=' + WIDTH + ' height=' + HEIGHT + ' name=' + ObjectID + ' align=' + ALIGN + ' wmode=transparent allowScriptAccess=' + SCRIPTACCESS + ' type=' + TYPE +' pluginspage=' + PLUGINSPAGE + '></embed></object>';
    }
    else if (type == 'mov')	{
	    var	sString = '<embed src=' + URL + ' width=' + WIDTH + ' height=' + HEIGHT + '></embed>';
    }
    document.write(sString);
}

// Download PDF Files with Tracking for Omniture Created by Amit Lathi (alathi@genex.com)"

function popUpPDFAttachment(obj, URL, OmnitureTrackingName, SectionName)
{
    //alert('Tracking obj: ' + obj + ' URL: ' + URL + ' Name: ' + OmnitureTrackingName);
    TagFileDownload(obj,OmnitureTrackingName);
    //alert('Tracked');
    
	window.open(URL, 'pdfWindow', 'height=840,width=800,left=200,top=50,resizable=yes,menubar=no,location=no,status=no,scrollbars=yes');
}

//added on 19-may-2008

function popForTsxNewLinks(url)
{
    if (url) {
	    var oNewWin = window.open(url, '', 'height=900, width=980,resizable=no,menubar=no,location=no,status=no,scrollbars=yes,left=100,top=50');
	    oNewWin.focus();
	    }
}

function SubmitFormOnEnter(e,buttonID)
{
	var iKeyCode;
	if(navigator.appName=='Netscape')
		iKeyCode = e.which;
	else
		iKeyCode = e.keyCode;

    if(iKeyCode==13) { 
        var objSubmit=document.getElementById(buttonID);
        if (objSubmit!=null) 
            objSubmit.click(); }
}

function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}

function popupDealerCommPref(obj, URL, Width, Height)
{
    if (URL=='') {return false;}
    
    TagDealerPrefLinkClick(obj);
    
	window.showModalDialog(URL, '', 'dialogWidth:'+Width+'px;dialogHeight:'+Height+'px;status:no;help:no;center:yes;scroll:yes;');
	
	return false;
}

function ServicePromotionPopup(url)
{
    if (url) {
	    var oNewWin = window.open(url, 'ServicePromotion', 'height=275, width=300,resizable=no,menubar=no,location=no,status=no,scrollbars=no');
	    oNewWin.focus();
	}
}

function AADPromotionPopup(url)
{
    if (url) {
	    var oNewWin = window.open(url, 'AAD2009', 'height=275, width=300,left=400,top=300,resizable=no,menubar=no,location=no,status=no,scrollbars=no');
	    oNewWin.focus();
	}
}

function popupWHotelsBanner()
{
    var oNewWin = window.open('whotel/whotels.aspx', 'WHotels', 'height=850,width=737,left=200,top=50,resizable=yes,menubar=no,location=no,status=no,scrollbars=yes');
	oNewWin.focus();
}

function createCookie(name, val, days)
{
  var value = val.replace(/~BAR~/g, '|');
  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(name)
{
  var ca = document.cookie.split(';');
  var nameEQ = name + "=";
  for(var i=0; i < ca.length; i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1, c.length); //delete spaces
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length, c.length);
    }
  return null;
}

function eraseCookie(name)
{
  createCookie(name, "", -1);
}
