


  if(location.pathname){
     var dir              = "../";
  }
  else{
     var dir              = "";
  }


/////////////////////////////////////
//  Opens Cliffs Reservation Window
/////////////////////////////////////

function checkCookie(){
    if (GetCookie("Cliffs") != "true" && typeof(add) == 'undefined'){
//         displayWindow(dir + 'connect-north-rental-properties/CliffsReservations.html',329,327,200,200,0,0,0,0,0);
        SetCookie ("Cliffs", "true");
    }
}

function getCookieVal (offset) {
  var endstr = document.cookie.indexOf (";", offset);
  if (endstr == -1)
    endstr = document.cookie.length;
  return unescape(document.cookie.substring(offset, endstr));
}

function GetCookie (name) {
  var arg = name + "=";
  var alen = arg.length;
  var clen = document.cookie.length;
  var i = 0;
  while (i < clen) {
    var j = i + alen;
    if (document.cookie.substring(i, j) == arg)
      return getCookieVal (j);
    i = document.cookie.indexOf(" ", i) + 1;
    if (i == 0) break; 
  }
  return null;
}

function SetCookie (name, value) {
  var argv = SetCookie.arguments;
  var argc = SetCookie.arguments.length;
  var expires = (argc > 2) ? argv[2] : null;
  var path = (argc > 3) ? argv[3] : null;
  var domain = (argc > 4) ? argv[4] : null;
  var secure = (argc > 4) ? argv[5] : false;
  document.cookie = name + "=" + escape (value) + ((expires == null) ? "" : ("; expires=" + expires.toGMTString())) + ((path == null) ? "" : ("; path=" + path)) + ((domain == null) ? "" : ("; domain=" + domain));
}


checkCookie();



//////////////////////////////////
//  Season .CSS
//////////////////////////////////

function style(){
   Main     = new Date;
   if(Main.getMonth() >= 2 && Main.getMonth() <= 4){
      document.write('<link rel="stylesheet" type="text/css" href="' + dir + 'css/ConnectNorth(spring).css">');
   }
   else if(Main.getMonth() >= 5 && Main.getMonth() <= 7){
      document.write('<link rel="stylesheet" type="text/css" href="' + dir + 'css/ConnectNorth(spring).css">');
   }
   else if(Main.getMonth() >= 8 && Main.getMonth() <= 10){
      document.write('<link rel="stylesheet" type="text/css" href="' + dir + 'css/ConnectNorth(fall).css">');
   }
   else{
      document.write('<link rel="stylesheet" type="text/css" href="' + dir + 'css/ConnectNorth(winter).css">');
   }
}


////////////////////////////////////////////////////////////////////
//  Show element
////////////////////////////////////////////////////////////////////
   function show(ele){
         document.all[ele].style.display="block";
   }


////////////////////////////////////////////////////////////////////
//  Hide element
////////////////////////////////////////////////////////////////////
   function hide(ele){
         document.all[ele].style.display="none";
   }



////////////////////////////////////////////////////////////////////
//  Writes Date
////////////////////////////////////////////////////////////////////
function WriteDate(){
   now     = new Date;
   dayName = new Array("", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday", "Sunday");
   monName = new Array("January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
   document.write(monName[now.getMonth()] + " " + now.getDate() + ", " + now.getFullYear());
}


////////////////////////////////////////////////////////////////////
//  Nav
////////////////////////////////////////////////////////////////////
//top_tab
//MM_preloadImages('images/MapTab2.gif','images/DirectionsTab2.gif','images/WeatherTab2.gif','images/CommerceTab2.gif');
function MM_preloadImages() {
  if (document.images) {
    var imgFiles = MM_preloadImages.arguments;
    var preloadArray = new Array();
    for (var i=0; i<imgFiles.length; i++) {
      preloadArray[i] = new Image;
      preloadArray[i].src = imgFiles[i];
    }
  }
}

function MM_swapImage() {
  var i,j=0,objStr,obj,swapArray=new Array,oldArray=document.MM_swapImgData;
  for (i=0; i < (MM_swapImage.arguments.length-2); i+=3) {
    objStr = MM_swapImage.arguments[(navigator.appName == 'Netscape')?i:i+1];
    if ((objStr.indexOf('document.layers[')==0 && document.layers==null) ||
        (objStr.indexOf('document.all[')   ==0 && document.all   ==null))
      objStr = 'document'+objStr.substring(objStr.lastIndexOf('.'),objStr.length);
    obj = eval(objStr);
    if (obj != null) {
      swapArray[j++] = obj;
      swapArray[j++] = (oldArray==null || oldArray[j-1]!=obj)?obj.src:oldArray[j];
      obj.src = MM_swapImage.arguments[i+2];
  } }
  document.MM_swapImgData = swapArray; //used for restore
}

function MM_swapImgRestore() {
  if (document.MM_swapImgData != null)
    for (var i=0; i<(document.MM_swapImgData.length-1); i+=2)
      document.MM_swapImgData[i].src = document.MM_swapImgData[i+1];
}



//////////////////////////////////
//  New Window
//////////////////////////////////
function displayWindow(url,width,height,x,y,res,scroll,loc,stat,center) {
   if(center == 1){
      x = (screen.width) ? ((screen.width-width)/2)-50 : 0;
      y = (screen.height) ? ((screen.height-width)/2)+100 : 0;
   }
   window.Win = window.open(url,"displayWindow",'width=' + width + ',height=' + height + ',screenX=' + x + ',screenY=' + y + ',top=' + x + ',left=' + y + ',resizable=' + res + ',scrollbars=' + scroll + ',location=' + loc + ',status=' + stat);
   window.Win.focus();
}

//////////////////////////////////
//  Close New Window
//////////////////////////////////
function closeWin(){
   if(window.Win){
      window.Win.close();
   }
}


////////////////////////////////////////////////////////////////////
//  Search using Yahoo
////////////////////////////////////////////////////////////////////
function yahooSearch(){
   var search_for = document.forms[0].yahoo_search.value;
   if(search_for == "" || search_for == "Search"){
      alert("Enter Search Criteria and then Search.");
      document.forms[0].yahoo_search.focus();
   }
   else{
      window.location ="http://search.yahoo.com/search?p=" + search_for +"&ei=UTF-8&vm=i&n=20&fl=0&vst=0&vs=www.connectnorth.com";
   }
}
