/*These are the object definitions and functions for the featured car stuff*/ var currentFeaturedAuto = -1; var lastFeaturedAuto = -1; var feat_list; function loadNextFeaturedAuto() { //only do this if there is something to load if (feat_list && feat_list.length > 0) { //increment the counter and get the auto currentFeaturedAuto++; if (currentFeaturedAuto > feat_list.length - 1) { currentFeaturedAuto = 0; } if (currentFeaturedAuto != lastFeaturedAuto) { lastFeaturedAuto = currentFeaturedAuto; populateFeaturedAuto(feat_list[currentFeaturedAuto]); //set the timer to change the featured car info if (feat_list.length > 1) { setTimeout("loadNextFeaturedAuto()", 5000); } } } else { //hide the featured section document.get var sect = document.getElementById("featuredauto"); if (sect) sect.style.visibility = "hidden"; } } function populateFeaturedAuto(thisAuto) { getElement("feat_pic").src = thisAuto.pic; getElement("feat_link1").href = thisAuto.url; getElement("feat_link2").href = thisAuto.url; getElement("feat_make").innerHTML = thisAuto.make; getElement("feat_model").innerHTML = thisAuto.model; getElement("feat_year").innerHTML = thisAuto.year; getElement("feat_milage").innerHTML = thisAuto.milage; getElement("feat_price").innerHTML = thisAuto.price; } function getElement(_id) { return document.getElementById(_id); } function featured_auto (_id, _make, _model, _year, _milage, _price, _desc, _pic, _url) { this.id = _id; this.make = _make; this.model = _model; this.year = _year; this.milage = _milage; this.price = _price; this.desc = _desc; this.pic = _pic; this.url = _url; } function closeWindow() { if (window.opener) { window.close(); } } /*This is the RUZEE stuff. Used for rounded corners on DIVs*/ RUZEE.Borders.add({ '#maincontainer': { borderType:'glow', cornerRadius:5, glowRadius:5, glowColor:'#FFFFFF' }, '#subcontainer': { borderType:'glow', cornerRadius:5, glowRadius:5, glowColor:'#000000' }, '#subtablink_browse, #subtablink_buying, #subtablink_selling, #subtablink_detailing, #subtablink_services, #subtablink_tmons, #subtablink_hours': { borderType:'simple', cornerRadius:5 }, '#topnavlink_home, #topnavlink_contact, #topnavlink_moredetails': { borderType:'glow', cornerRadius:5, glowRadius:5, glowColor:'#777777' }, '#subpagecontent': { borderType:'simple', cornerRadius:5 }, '#entrydetailbottom': { borderType:'simple', cornerRadius:5 }, '#featuredautodetail': { borderType:'simple', cornerRadius:10, edges:'lrb' } }); //REPLACE THE ONLOAD WITH OUR OWN var initEditor; var w_onload_orig; if (window.onload) w_onload_orig = window.onload(); window.onload=function(){ RUZEE.Borders.render(); loadNextFeaturedAuto(); if (initEditor && typeof(initEditor) == "function") { initEditor(); } //rendering is done, show the body document.body.style.visibility = "visible"; if (w_onload_orig && typeof(w_onload_orig) == "function") { w_onload_orig(); } }; function getBaseUrl() { var ret = "/pcc.nsf"; var loc = window.location.href; var loc_l = loc.toLowerCase(); var idx = loc_l.indexOf(".nsf"); if (idx > -1) { ret = loc.substring(0,idx + 4); } return ret; } function deleteDocument(id) { if (confirm("Are you sure you want to delete this document?")) { window.location.href = getBaseUrl() + "/0/" + id + "?DeleteDocument"; } } /******************************** ** Cookie Management ********************************/ function hasCookie(name) { var ret = false; var ck = getCookie(name); if (ck != null && ck != "") ret = true; return ret; } function getCookie(name) { var cname = name + "="; var dc = document.cookie; if (dc.length > 0) { begin = dc.indexOf(cname); if (begin != -1) { begin += cname.length; end = dc.indexOf(";", begin); if (end == -1) end = dc.length; return unescape(dc.substring(begin, end)); } } return null; } // Use this function to save a cookie. function setCookie(name, value, expires) { document.cookie = name + "=" + escape(value) + "; path=/" + ((expires == null) ? "" : "; expires=" + expires.toGMTString()); } // Use this function to delete a cookie. function delCookie(name) { document.cookie = name + "=; expires=Thu, 01-Jan-70 00:00:01 GMT" + "; path=/"; } function getExpireDate(nodays) { var UTCstring; Today = new Date(); nomilli=Date.parse(Today); Today.setTime(nomilli+nodays*24*60*60*1000); UTCstring = Today.toUTCString(); return UTCstring; } function isUserLoggedIn() { //return true; var namx = getCookie("DomAuthSessId"); if (namx != null && namx != "") { return true; } else { return false; } } function signout() { delCookie("DomAuthSessId"); } function writeIfLoggedIn(val, alt) { if (isUserLoggedIn()) { document.write(val); } else if (alt != null) { document.write(alt); } } function convertToNum(val) { var ALL_CHARS = "0123456789."; var ret = ""; for (var i = 0; i < val.length; i++) { var chr = val.substring(i, i + 1); if (ALL_CHARS.indexOf(chr) > -1) { ret += chr; if (chr == ".") { ALL_CHARS = "0123456789"; } } } var num = ret; num++; num--; return num; } /****************************** * This is the Paging stuff * ******************************/ function writePagingLinks(formname, count) { if (count == null) count = "30"; var CLASS_NORM = "paginglink"; var CLASS_SEL = "paginglink paginglink_sel"; var SPACER = "  "; var sWrite = ""; var viewCount = convertToNum(document.forms[formname].ViewCount.value); var pageStart = convertToNum(getQsValue("Start","1")); var pageCount = convertToNum(getQsValue("Count",count)); var pageEnd = (pageStart - 1) + pageCount; var pageStartPrev = pageStart - pageCount; var pageStartNext = pageStart + pageCount; var pageStartFirst = 1; var pageStartLast = 1; var bShowFirst = false; var bShowPrev = false; var bShowNext = false; var bShowLast = false; //document.write(":s=" + pageStart + ":e=" + pageEnd + ":c=" + viewCount + "
"); if (pageStart > 1) { bShowFirst = bShowPrev = true; } if (pageEnd < viewCount) { bShowLast = bShowNext = true; } sWrite += "Page: "; if (bShowFirst) { sWrite += "<<" + SPACER; } if (bShowPrev) { sWrite += "<" + SPACER; } sWrite += SPACER; var idxPage = 0; for (var i = 1; i <= viewCount; i+=pageCount) { idxPage++; pageStartLast = i; var thisclass = CLASS_NORM; if (pageStart >= i && pageStart < i + pageCount) { thisclass = CLASS_SEL; } sWrite += "" + idxPage + "" + SPACER; } sWrite += SPACER; if (bShowNext) { sWrite += ">" + SPACER; } if (bShowLast) { sWrite += ">>" + SPACER; } if (pageStartFirst != pageStartLast) { document.write(sWrite); } } function openPageLink(start, count) { window.location.href = getPageLink(start, count); } function writePageLink(start, count) { document.write(getPageLink(start, count)); } function getPageLink(start, count) { var loc = window.location.href; if (loc.indexOf("?") == -1) { loc += "?Open"; } loc = replaceQsValue(loc, "Start", start); loc = replaceQsValue(loc, "Count", count); return loc; } function getQsValue(sname, sdefault) { var ret = sdefault; var loc = window.location.href + "&"; var idx = loc.indexOf(sname+"="); if (idx > -1) { var sortx = loc.substring(idx+5); sortx = sortx.substring(0,sortx.indexOf("&")); ret = sortx; } return ret; } function replaceQsValue(source, name, value) { var hasParam = false; source = "&" + source; idx = source.indexOf("&" + name + "="); if (idx > -1) hasParam = true; if (!hasParam) { source += "&" + name + "=" + value; } else { source = source.substring(1); var params = source.split("&"); source = ""; for (var i = 0; i < params.length; i++) { source += "&"; if (params[i].indexOf(name + "=") > -1) { source += name + "=" + value; } else { source += params[i]; } } } while (source.indexOf("&") == 0) { source = source.substring(1); } return source; } function openPictureWindow(baseurl, url) { url = baseurl + "/ImageDetail?Open&k=" + escape(url); var PictureWin = window.open(url, 'PictureWin', 'resizable,scrollbars=no,width=400,height=400,left=1,top=50'); PictureWin.focus(); } function openContactWindow(url) { var ContactWin = window.open(url, 'ContactWin', 'resizable,scrollbars=yes,width=700,height=500,left=1,top=50'); ContactWin.focus(); } function openLoanWindow(url) { var loanWin = window.open(url, 'LoanWin', 'resizable,scrollbars=yes,width=600,height=200,left=75,top=475'); loanWin.focus(); } function managePics(baseurl, id) { var picsWin = window.open(baseurl + "/ManagePics?OpenForm&parentUNID=" + id, "PicsWin", 'resizable,scrollbars=yes,width=600,height=600,left=75,top=100'); picsWin.focus(); } function writeAdminLinks(baseurl, id) { var x = "
"; x+= ""; x += "
"; x+= ""; x += "
"; writeIfLoggedIn(x); }