/*******************************************************************************
* Global Javascript variables
*
*******************************************************************************/
var site_domain 	= 'juneauempire.com';
var blogs_domain	= 'blogs.juneauempire.com';
var login_domain	= 'juneauempire.com'	// dev environment workaround; this should be the same as site domain in future
var mtl_property	= 'JUNEAU AK';

/******** VIEW TOPAD ********/
function view_top_ad(b){var a=new Array("mdw_topJobs","mdw_topHomes","mdw_topRentals","mdw_topAutos","mdw_topBoats");for(i=0;i<a.length;i++){if(document.getElementById(a[i])){if(b==document.getElementById(a[i]).id){view_top_ad_display(document.getElementById(a[i]))}else{document.getElementById(a[i]).style.display="none"}}}}function view_top_ad_display(a){if(a){a.style.display=(a.style.display=="block")?"none":"block"}};

/******** GET COOKIE ********/
function getcookie(a){var d=document.cookie;var c=d.indexOf(a);if(c==-1||a==""){return""}var b=d.indexOf(";",c);if(b==-1){b=d.length}return unescape(d.substring(c+a.length+1,b))};

/******** SET COOKIE ********/
function setCookie(c,e,a,g,d,f){var b=c+"="+escape(e)+((a)?"; expires="+a.toGMTString():"")+((g)?"; path="+g:"/")+((d)?"; domain="+d:"")+((f)?"; secure":"");document.cookie=b};

/******** XMLHTTPRequest object ********/
$good_ajax=(window.XMLHttpRequest)?1:0;function ajaxinclude(f,c){var a=null;try{a=new ActiveXObject("Msxml2.XMLHTTP")}catch(g){try{a=new ActiveXObject("Microsoft.XMLHTTP")}catch(b){a=null}}if(!a&&typeof XMLHttpRequest!="undefined"){a=new XMLHttpRequest()}var h=a;var d=(f.indexOf("?")>-1)?"&":"?";h.open("GET","http://"+window.location.hostname+f+d+Math.random(),false);h.send(null);if(c){if(window.location.href.indexOf("http")==-1||h.status==200){document.getElementById(c).innerHTML=h.responseText}}else{return h.responseText}};

/******** PRINT DASHBOARD ***********/
function print_dashboard(){var a=getcookie("mdwuser");if(getcookie("mdwac")&&a!=""){if(avatar_url_init&&avatar_url_init!=""){document.write('<a href="#"><img src="'+avatar_url_init+'" width="30" height="30" alt="" /></a>')}else{blogs_avatar_url=get_avatar_url();if(blogs_avatar_url&&blogs_avatar_url!=""){setCookie("blogs_avatar",blogs_avatar_url);avatar_url=blogs_avatar_url;document.write('<a href="#"><img src="'+avatar_url+'" width="30" height="30" alt="" /></a>')}else{document.write('<a href="#"><img src="/images/TEMP/avatar1.gif" width="30" height="30" alt="" /></a>')}}document.write('<a href="http://'+site_domain+'/account.shtml">'+a+"</a>");document.write("|");document.write('<a href="http://register.'+login_domain+"/forge/dataentry?tp="+mtl_property+"&tl=2&temp_type=LOGIN&category=REGISTRATION&reg_redirect=http://dev."+login_domain+'"> log out </a>')}else{document.write('<a href="#"><img src="/images/TEMP/avatar1.gif" width="30" height="30" alt="" /></a>');document.write('<a href="http://register.'+login_domain+"/forge/dataentry?tp="+mtl_property+"&temp_type=DATA ENTRY&category=registration&reg_redirect=http://dev."+login_domain+'"> register </a>');document.write("|");document.write('<a href="http://register.'+login_domain+"/forge/dataentry?tp="+mtl_property+"&temp_type=DATA ENTRY&category=registration&reg_redirect=http://dev."+login_domain+'"> log in </a>')}};

/******** DROP MENU ********/
sfHover=function(){var c=navigator.userAgent;var e=c.indexOf("MSIE");var a=e>=0;var d=document.getElementById("nav").getElementsByTagName("LI");for(var b=0;b<d.length;b++){d[b].onmouseover=function(){this.className+=" sfhover"};d[b].onmouseout=function(){this.className=this.className.replace(new RegExp(" sfhover\\b"),"")};if(d[b].parentNode==document.getElementById("site_nav")&&a){d[b].style.width="1px"}}};if(window.attachEvent){window.attachEvent("onload",sfHover)};

/******** STORY THUMBNAIL SELECTION ********/
function select_thumb(d,c){var a=document.getElementsByTagName("div");var b=new Array();for(i=0;i<a.length;i++){if(a[i].id.indexOf("photo-id-")==0){b.push(a[i].id)}}var a=document.getElementsByTagName("img");var e=new Array();for(i=0;i<a.length;i++){if(a[i].id.indexOf("thumb-id-")==0){e.push(a[i].id)}}for(i=0;i<b.length;i++){if(document.getElementById(b[i])){document.getElementById(b[i]).style.display=(b[i]=="photo-id-"+d)?"block":"none"}if(document.getElementById(e[i])){document.getElementById(e[i]).className=(e[i]=="thumb-id-"+c)?"selected":""}}};