function postalert(gotourl) {
	var answer = confirm ("This will create a new property listing for your account. Would you like to proceed?")
	if (answer) {
		window.location= gotourl;
	}
}

 // script by http://www.hypergurl.com
 var urlAddress = "http://www.corporatehousingbyowner.com";
 var pageName = "Corporate Housing By Owner";
 function addToFavorites() {
   if (window.external) {
     window.external.AddFavorite(urlAddress,pageName);
   } else {
     alert("Sorry! Your browser doesn't support this function.");
   }
 }

function toggleAll(itemname,state){
    tmp = document.getElementsByTagName('div');
    for (i=0;i<tmp.length;i++){
        if (tmp[i].className == itemname) tmp[i].style.display = state;
    }
}
function toggle(idname){
    document.getElementById(idname).style.display = (document.getElementById(idname).style.display == 'block') ? 'none' : 'block';
}
function toggleCloseOthers(idname){
    origStatus = (document.getElementById(idname).style.display == 'block') ? 'block' : 'none';
    toggleAll('toggle','none');
    if (origStatus=='none') toggle(idname);
}

function newImage(arg) {if (document.images) {rslt = new Image(); rslt.src = arg; return rslt;}}

function changeImages() {
  //alert('hi');
  if (document.images){
    for (var i=0; i<changeImages.arguments.length; i+=2){
      document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
    }
  }
}

// select list code
function setList(thislist,content,content_val) {
  thislist.options.length = 0;
  var i = 0;
  while(1) {
    if( ! content[content_val][i] ) break;
    thislist.options[i] = new Option(content[content_val][i][1],content[content_val][i][0],false,false);
    i++;
  }
}

// premature exit checking
function unloadMess() {
  mess = "You are about to leave the CHBO website and your information will be stored so you can return and complete your listing. Please call 877.333.2426 with any questions about posting a property."
  if(!isSolved) return mess;
}

function allSolved() {
  isSolved = true;
}

// required arg's: event, image path and file name (as this.href)
// important but optional arg's: width of image, height of image 
// other optional arg's: txt, layer width, offx, offy
function wrapContent(e, img, w, h, txt, wd, offx, offy) {
  var imgStr, cntnt, win, str;
  imgStr = '<img src="' + img + '"' + (w? ' width="' + w + '"': "") + (h? ' height="' + h + '"': "") + '>';
  if ( dragObj.supported && typeof document.body.innerHTML != "undefined" ) {
    cntnt = '<div class="img">'  + '</div>';
    if (txt) cntnt += '<div class="msg">' + txt + '</div>';  
    if (!wd) wd = w; 
    writeDrag.set(e, cntnt, wd, offx, offy);
  } else { // non-capable browsers will open sub window
    w = w+80 || wd || 250; h = h+80 || 250; // size
    win = window.open('', 'subwin', 'resizable,width='+w+',height='+h+',left=100,top=100');
    if (win && !win.closed) win.resizeTo(w,h); 
    str = '<html><head><title>Image Display</title></head>';
  	str += '<body style="text-align:center">';
    str += imgStr + (txt? '<p>' + txt + '</p>':"");
  	str += '</body></html>'
  	win.document.write(str);
  	win.document.close();
    if (win && !win.closed) win.focus(); 
  } 
  return false;
}

//instantiate all nav images
newImage('/images/n1.gif');
newImage('/images/n2.gif');
newImage('/images/n3.gif');
newImage('/images/n4.gif');
newImage('/images/n5.gif');
newImage('/images/n6.gif');
newImage('/images/n1_on.gif');
newImage('/images/n2_on.gif');
newImage('/images/n3_on.gif');
newImage('/images/n4_on.gif');
newImage('/images/n5_on.gif');
newImage('/images/n6_on.gif');





