var browser, verStr = navigator.appVersion, app = navigator.appName, version = parseFloat(verStr);

function test_browser() {
  if ((app.indexOf('Netscape') != -1) && version >= 5) {
    browser = "netscape";
  }
  else if ((app.indexOf('Microsoft') != -1) && version >= 4) {
    browser = "ie";
  }
}

var body_content = new Array("bodycontent", "preloader");
test_browser();
function show_sub(show_which_sub, var_array, mode) {

  if (mode == "preloader") {
    for (i = 0; i < eval(var_array + ".length"); i++) {
      if (eval(var_array + "[i]") != show_which_sub) {
        hide_sub(eval(var_array + "[i]"), mode);
      }
    }
  }

  if (show_which_sub != "") {
    if (browser == "netscape") {
      if (document.getElementById(show_which_sub).style.display == 'block') {
        document.getElementById(show_which_sub).style.display = 'none';
      }
      else {
        document.getElementById(show_which_sub).style.display = 'block';
      }
    }
    else if (browser == "ie") {
      show_menu = eval(show_which_sub);
      if(show_menu.style.display == 'block'){
        show_menu.style.display = 'none';
      }
      else {
        show_menu.style.display = 'block';
      }
    }
  }

}

function hide_sub(which_sub, mode) {
  if (browser == "netscape") {
    document.getElementById(which_sub).style.display = 'none';
  }
  else if (browser == "ie") {
    sub_menu = eval(which_sub);
    sub_menu.style.display = 'none';
  }
}

function auto_hide() {
  show_sub("");
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function scroll_up() {
  current_pos = document.getElementById('scroll_clipper').scrollTop;
  document.getElementById('scroll_clipper').scrollTop = current_pos + 20;
}

function scroll_down() {
  current_pos = document.getElementById('scroll_clipper').scrollTop;
  document.getElementById('scroll_clipper').scrollTop = current_pos - 20;
}

function char_count(eid, maxlen, max_lines) {

  var inputstr;
  var strlen;
  var charleft;
  var numcr;
  var temp = new Array();

  if (document.getElementById(eid).value != "") {
    inputstr = document.getElementById(eid).value;
    strlen = inputstr.length;

    if (strlen > maxlen) {
      document.getElementById(eid).value = document.getElementById(eid).value.substring(0,maxlen);
      charleft = 0;
      alert("Exceeds maximum number of characters!");
    }
    else {
      charleft = maxlen - strlen;
    }

    document.getElementById('charleft' + eid).innerHTML = charleft + " / " + maxlen;

  }

  if (max_lines > 0) {

    var temp2 = document.getElementById(eid).value.split('\r\n');
    var temp_val = "";
    counter = 0;
    if (temp2.length > max_lines) {
      alert("Exceeds maximum number of lines!");
      for (i = 0; i < max_lines; i++) {
        temp_val = temp_val + temp2[i];
        if (i < (max_lines - 1)) {
          temp_val = temp_val + "\n";
        }
      }
      document.getElementById(eid).value = temp_val;
    }

  }

}

function row_over(row_id, row_color) {
  document.getElementById(row_id).style.backgroundColor = row_color;
}

function add_to_favorite(url, title) {
  if (window.sidebar) {
    window.sidebar.addPanel(title, url, "");
  }
  else if( window.external ) {
    window.external.AddFavorite(url, title);
  }
  else if (window.opera && window.print) {
    return true;
  }
}


var w_width = w_height = 0;

function get_window_size() {
  if (parseInt(navigator.appVersion)>3) {
    if (navigator.appName=="Netscape") {
      w_width = window.innerWidth;
      w_height = window.innerHeight;
    }
    if (navigator.appName.indexOf("Microsoft")!=-1) {
      w_width = document.body.offsetWidth;
      w_height = document.body.offsetHeight;
    }
  }
}

active_image = "";

function show_image(img_id, pic, pic_width, pic_height) {

  //get_window_size();

  hide_image();

  var so = new SWFObject("flash/pop.swf", "pop_up", 330, 255, "6", "#FFFFFF");
  so.addParam("wmode", "transparent");
  so.addVariable("pic", pic);
  so.addVariable("pic_width", pic_width);
  so.addVariable("pic_height", pic_height);
  so.write('big_pic');

  document.getElementById(img_id).style.display = "block";

  active_image = img_id;

}

function hide_image() {

  if (document.getElementById(active_image)) {
    document.getElementById(active_image).style.display = "none";
  }

}

function youtube(youtube_code) {

  url = "youtube_viewer.php?youtube=" + youtube_code;
  window.open(url,'browser','toolbar=no,location=no,status=no,menubar=no,scrollbars=no,resizable=no,width=445,height=375')

}

function CreateBookmarkLink(title, url) {

  if (window.sidebar) { // Mozilla Firefox Bookmark
    window.sidebar.addPanel(title, url,"");
  }
  else if( window.external ) { // IE Favorite
    window.external.AddFavorite( url, title); }
    else if(window.opera && window.print) { // Opera Hotlist
      return true;
    }
  }

  if (window.external) {
    //document.write('<a href =\"javascript:CreateBookmarkLink()\");">Add to Favorites</a>');
  }
  else  if (window.sidebar) {
    //document.write('<a href =\"javascript:CreateBookmarkLink()\");">Bookmark Page</a>');
  }
  else if (window.opera && window.print) {
    //document.write('<a href =\"javascript:CreateBookmarkLink()\");">Add Bookmark</a>');
}

var active_faq = "";

function show_faq (eid) {

  if (active_faq != "") {
    document.getElementById(active_faq).style.display = "none";
  }
  document.getElementById(eid).style.display = "block";
  active_faq = eid;

}

function refresh_calendar() {
  cyear  = document.getElementById('cyear').value;
  cmonth = document.getElementById('cmonth').value;
  window.location = "index.php?year=" + cyear + "&month=" + cmonth;
}

var event_req = "";

function get_event(date) {

  var query = "&date=" + date;
  var url   = "ajax/events.ajx.php";

  document.getElementById('selected_event').innerHTML = "Loading event...";

  tmp_http_req   = new init_post_request();
  event_req      = tmp_http_req.fn_request;

  event_req.onreadystatechange = show_event;

  post_request(event_req, url, query);

  return;

}

function show_event() {

  if (event_req.readyState == 4 || event_req.readyState == "complete") {
    data = event_req.responseText;
    document.getElementById('selected_event').innerHTML = data;
  }

}

var active_answer = "";

function show_answer(eid) {

  if (active_answer != "") {
    document.getElementById(active_answer).style.display = "none";
  }
  document.getElementById(eid).style.display = "block";
  active_answer = eid;

}

function date_gui(day_name, month_name, year_name, day_val, month_val, year_val, mode, eid, css, start_year, end_year) {

  var months_1 = new Array("", "Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec");
  var months_2 = new Array("", "January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December");
  
  document.write("<select name=\"" + day_name + "\" id=\"" + day_name + "\"  class=\"" + css + "\">");
  if (mode == "full") { 
    document.write("<option value=\"\"> Day </option> ");
  }
  else { 
    document.write("<option value=\"\">dd</option> ");
  }
  for (i = 1; i <= 31; i++) {
    dsp = "";
    if (i == day_val) { 
      dsp = "selected";
    }
    document.write("<option value=\"" + i + "\" " + dsp + ">" + i + "</option>");
  }
  document.write("</select> ");
  
  document.write("<select name=\"" + month_name + "\" id=\"" + month_name + "\" class=\"" + css + "\">");
  if (mode == "full") { 
    document.write("<option value=\"\"> Month </option> ");
  }
  else { 
    document.write("<option value=\"\">mm</option> ");
  }
  for (i = 1; i < months_1.length; i++) {
    dsp = "";
    if (i == month_val) { 
      dsp = "selected";
    }
    month = months_1[i];
    if (mode == "full") { 
      month = months_2[i];
    }
    document.write("<option value=\"" + i + "\" " + dsp + ">" + month + "</option>");
  }
  document.write("</select> ");
  
  document.write("<select name=\"" + year_name + "\" id=\"" + year_name + "\" class=\"" + css + "\">");
  if (mode == "full") { 
    document.write("<option value=\"\"> Year </option> ");
  }
  else { 
    document.write("<option value=\"\">yy</option> ");
  }
  for (i = start_year; i <= end_year; i++) {
    dsp = "";
    if (i == year_val) { 
      dsp = "selected";
    }
    year = i;
    year = String(year);
    year = year.substring(2, 4);
    if (mode == "full") { 
      year = i;
    }
    document.write("<option value=\"" + i + "\" " + dsp + ">" + year + "</option>");
  }
  document.write("</select> ");

}

function addEvent(obj, evType, fn){
 if (obj.addEventListener){
    obj.addEventListener(evType, fn, false);
    return true;
 } else if (obj.attachEvent){
    var r = obj.attachEvent("on"+evType, fn);
    return r;
 } else {
    return false;
 }
}
function removeEvent(obj, evType, fn, useCapture){
  if (obj.removeEventListener){
    obj.removeEventListener(evType, fn, useCapture);
    return true;
  } else if (obj.detachEvent){
    var r = obj.detachEvent("on"+evType, fn);
    return r;
  } else {
    alert("Handler could not be removed");
  }
}

/**
 * Code below taken from - http://www.evolt.org/article/document_body_doctype_switching_and_more/17/30655/
 *
 * Modified 4/22/04 to work with Opera/Moz (by webmaster at subimage dot com)
 *
 * Gets the full width/height because it's different for most browsers.
 */
function getViewportHeight() {
  if (window.innerHeight!=window.undefined) return window.innerHeight;
  if (document.compatMode=='CSS1Compat') return document.documentElement.clientHeight;
  if (document.body) return document.body.clientHeight; 

  return window.undefined; 
}
function getViewportWidth() {
  var offset = 16;
  var width = null;
  if (window.innerWidth!=window.undefined) return window.innerWidth + offset; 
  if (document.compatMode=='CSS1Compat') return document.documentElement.clientWidth + offset; 
  if (document.body) return document.body.clientWidth + offset; 
}

/**
 * Gets the real scroll top
 */
function getScrollTop() {
  if (self.pageYOffset) // all except Explorer
  {
    return self.pageYOffset;
  }
  else if (document.documentElement && document.documentElement.scrollTop)
    // Explorer 6 Strict
  {
    return document.documentElement.scrollTop;
  }
  else if (document.body) // all other Explorers
  {
    return document.body.scrollTop;
  }
}
function getScrollLeft() {
  if (self.pageXOffset) // all except Explorer
  {
    return self.pageXOffset;
  }
  else if (document.documentElement && document.documentElement.scrollLeft)
    // Explorer 6 Strict
  {
    return document.documentElement.scrollLeft;
  }
  else if (document.body) // all other Explorers
  {
    return document.body.scrollLeft;
  }
}

function show_sub_menus(menu_number){
	for(i = 0; i < 4; i++){
		if(document.getElementById("sub_" + i))	{
			if(i == menu_number){
				document.getElementById("sub_" + i).style.display = 'block';
			}else{
				document.getElementById("sub_" + i).style.display = 'none';
			}
		}
	}	
}
function is_child_of(parent, child) {
	if( child != null ) {			
		while( child.parentNode ) {
			if( (child = child.parentNode) == parent ) {
				return true;
			}
		}
	}
	return false;
}
function fixOnMouseOut(element, event, JavaScript_code) {
	var current_mouse_target = null;
	if( event.toElement ) {				
		current_mouse_target 			 = event.toElement;
	} else if( event.relatedTarget ) {				
		current_mouse_target 			 = event.relatedTarget;
	}
	if( !is_child_of(element, current_mouse_target) && element != current_mouse_target ) {
		eval(JavaScript_code);
	}
}
function hide_all_subs(){
	for(i = 0; i < 4; i++){
		if(document.getElementById("sub_" + i))	{
			document.getElementById("sub_" + i).style.display = 'none';
		}
	}	
}
function change_class(el_id, cl_name_1, cl_name_2){
	document.getElementById("menu_" + el_id).className = cl_name_1;
	document.getElementById("arrow_" + el_id).className = cl_name_2;
}
function check_source() {
  document.getElementById('other_source').style.display = "none";
  if (document.getElementById('source').value == "Other") {
    document.getElementById('other_source').style.display = "block";
  }
}
function fill_text(el_id, el_text){
	val = document.getElementById(el_id).value
	if(val == ""){
		document.getElementById(el_id).value = el_text;
	}
}

var min = 8;
var max = 20;
var el_arr = ["body", "h3", "span", "h2", "p", "a"];
function font_up() {
	for(x = 0; x < el_arr.length; x++){
	
		var p = document.getElementsByTagName(el_arr[x]);
		for(i=0;i<p.length;i++) {
			if(p[i].style.fontSize) {
				 var s = parseInt(p[i].style.fontSize.replace("px",""));
			}else if(el_arr[x] == "h2"){
				 var s = 20;	
			 
			}else {
				 var s = 12;
			}
			if(s!=max) {
				 s += 1;
			}
			p[i].style.fontSize = s+"px"
		}
	
	}
	
}

function font_down() {
	for(x = 0; x < el_arr.length; x++){
		var p = document.getElementsByTagName(el_arr[x]);
		for(i=0;i<p.length;i++) {
			if(p[i].style.fontSize) {
				 var s = parseInt(p[i].style.fontSize.replace("px",""));
			}else if(el_arr[x] == "h2"){
				 var s = 20;	
			 
			} else {
				 var s = 10;
			}
			if(s!=min) {
				 s -= 1;
			}
			p[i].style.fontSize = s+"px"
		}
		
	}

}

function ScrollDiv(id){
  if(this==window)
	  return new ScrollDiv(id); //ScrollDiv() called as a Function
	var elt=document.getElementById(id);
  var w=elt.offsetWidth;
  var s=elt.parentNode.offsetWidth;
	if(!w || !s || s>w){
		this.scroll=Function(""); return;}
	var divStyle=elt.style;
	var offset=0;
	var maxOffset=s-w;
	var timer=null;
	var self=this;
 
	this.scroll= function(dir,speed){
		var coef=1, S=speed;
		while(S--)coef*=2;
		if (timer)window.clearTimeout(timer);
		switch (dir){
			case 's': //stop
				break;
			case 'l': //left
				if(offset>maxOffset){
					offset-=coef;
					divStyle.left=Math.min(offset,0)+"px";
					timer=window.setTimeout(function(){self.scroll('l',speed)},25)}
				break;
			case 'r': //right
				if(offset<0){
					offset+=coef;
					divStyle.left=Math.max(offset,maxOffset)+"px";
					timer=window.setTimeout(function(){self.scroll('r',speed)},25)}
		}
	}
}


function changePhotoSrc_1(newSrc, newWidth, newHeight, newtitle){	
	document.getElementById("pic_div_inner").style.paddingTop = (440 - newHeight) / 2 + "px"; 
	document.getElementById("pic_div_inner").innerHTML = "<img src=" + newSrc + " border='0' width='" + newWidth + "' height='" + newHeight + "' alt='" + newtitle + "' title='" + newtitle + "' />";
	document.getElementById("pic_title").innerHTML = newtitle;
}


function changePhotoSrc(img_id, num_images, newSrc, newWidth, newHeight, newtitle){	
	for(i = 0; i < num_images; i++){
		if(i == img_id){
			if(document.getElementById("img_" + i).innerHTML == ""){
				var padtop = (440 - newHeight) / 2; 
				document.getElementById("img_" + i).innerHTML = "<img src=" + newSrc + " border='0' width='" + newWidth + "' height='" + newHeight + "' alt='" + newtitle + "' title='" + newtitle + "'  style='padding-top:" + padtop + "px;' />";
			}
			document.getElementById("img_" + i).style.display = 'block';
		}else{
			document.getElementById("img_" + i).style.display = 'none';
		}
		
	}
}

function loadGmap(div_id, company_name, address, x, y) {
	var map = null;
	if (GBrowserIsCompatible()) {
		map = new GMap2(document.getElementById(div_id));
		var center = new GLatLng(x, y);
		map.setCenter(center, 15);
			
		map.addControl(new GSmallMapControl());
		map.addControl(new GMapTypeControl());
				
		var marker = new GMarker(center, {draggable: false});
		map.addOverlay(marker);
		GEvent.addListener(marker, "click", function() {
			marker.openInfoWindowHtml("<div align='center'  style='width:200px;'><strong>" + company_name + "</strong><br>" + address +"</div>");
		});
			 
	}
} /**
 * SWFObject v1.4.4: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2006 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 * **SWFObject is the SWF embed script formerly known as FlashObject. The name was changed for
 *   legal reasons.
 */
if(typeof deconcept=="undefined"){var deconcept=new Object();}
if(typeof deconcept.util=="undefined"){deconcept.util=new Object();}
if(typeof deconcept.SWFObjectUtil=="undefined"){deconcept.SWFObjectUtil=new Object();}
deconcept.SWFObject=function(_1,id,w,h,_5,c,_7,_8,_9,_a,_b){if(!document.getElementById){return;}
this.DETECT_KEY=_b?_b:"detectflash";
this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
this.params=new Object();
this.variables=new Object();
this.attributes=new Array();
if(_1){this.setAttribute("swf",_1);}
if(id){this.setAttribute("id",id);}
if(w){this.setAttribute("width",w);}
if(h){this.setAttribute("height",h);}
if(_5){this.setAttribute("version",new deconcept.PlayerVersion(_5.toString().split(".")));}
this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
if(c){this.addParam("bgcolor",c);}
var q=_8?_8:"high";
this.addParam("quality",q);
this.setAttribute("useExpressInstall",_7);
this.setAttribute("doExpressInstall",false);
var _d=(_9)?_9:window.location;
this.setAttribute("xiRedirectUrl",_d);
this.setAttribute("redirectUrl","");
if(_a){this.setAttribute("redirectUrl",_a);}};
deconcept.SWFObject.prototype={setAttribute:function(_e,_f){
this.attributes[_e]=_f;
},getAttribute:function(_10){
return this.attributes[_10];
},addParam:function(_11,_12){
this.params[_11]=_12;
},getParams:function(){
return this.params;
},addVariable:function(_13,_14){
this.variables[_13]=_14;
},getVariable:function(_15){
return this.variables[_15];
},getVariables:function(){
return this.variables;
},getVariablePairs:function(){
var _16=new Array();
var key;
var _18=this.getVariables();
for(key in _18){_16.push(key+"="+_18[key]);}
return _16;},getSWFHTML:function(){var _19="";
if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length){
if(this.getAttribute("doExpressInstall")){
this.addVariable("MMplayerType","PlugIn");}
_19="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
_19+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
var _1a=this.getParams();
for(var key in _1a){_19+=[key]+"=\""+_1a[key]+"\" ";}
var _1c=this.getVariablePairs().join("&");
if(_1c.length>0){_19+="flashvars=\""+_1c+"\"";}_19+="/>";
}else{if(this.getAttribute("doExpressInstall")){this.addVariable("MMplayerType","ActiveX");}
_19="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
_19+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
var _1d=this.getParams();
for(var key in _1d){_19+="<param name=\""+key+"\" value=\""+_1d[key]+"\" />";}
var _1f=this.getVariablePairs().join("&");
if(_1f.length>0){_19+="<param name=\"flashvars\" value=\""+_1f+"\" />";}_19+="</object>";}
return _19;
},write:function(_20){
if(this.getAttribute("useExpressInstall")){
var _21=new deconcept.PlayerVersion([6,0,65]);
if(this.installedVer.versionIsValid(_21)&&!this.installedVer.versionIsValid(this.getAttribute("version"))){
this.setAttribute("doExpressInstall",true);
this.addVariable("MMredirectURL",escape(this.getAttribute("xiRedirectUrl")));
document.title=document.title.slice(0,47)+" - Flash Player Installation";
this.addVariable("MMdoctitle",document.title);}}
if(this.skipDetect||this.getAttribute("doExpressInstall")||this.installedVer.versionIsValid(this.getAttribute("version"))){
var n=(typeof _20=="string")?document.getElementById(_20):_20;
n.innerHTML=this.getSWFHTML();return true;
}else{if(this.getAttribute("redirectUrl")!=""){document.location.replace(this.getAttribute("redirectUrl"));}}
return false;}};
deconcept.SWFObjectUtil.getPlayerVersion=function(){
var _23=new deconcept.PlayerVersion([0,0,0]);
if(navigator.plugins&&navigator.mimeTypes.length){
var x=navigator.plugins["Shockwave Flash"];
if(x&&x.description){_23=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."));}
}else{try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");}
catch(e){try{var axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
_23=new deconcept.PlayerVersion([6,0,21]);axo.AllowScriptAccess="always";}
catch(e){if(_23.major==6){return _23;}}try{axo=new ActiveXObject("ShockwaveFlash.ShockwaveFlash");}
catch(e){}}if(axo!=null){_23=new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));}}
return _23;};
deconcept.PlayerVersion=function(_27){
this.major=_27[0]!=null?parseInt(_27[0]):0;
this.minor=_27[1]!=null?parseInt(_27[1]):0;
this.rev=_27[2]!=null?parseInt(_27[2]):0;
};
deconcept.PlayerVersion.prototype.versionIsValid=function(fv){
if(this.major<fv.major){return false;}
if(this.major>fv.major){return true;}
if(this.minor<fv.minor){return false;}
if(this.minor>fv.minor){return true;}
if(this.rev<fv.rev){
return false;
}return true;};
deconcept.util={getRequestParameter:function(_29){
var q=document.location.search||document.location.hash;
if(q){var _2b=q.substring(1).split("&");
for(var i=0;i<_2b.length;i++){
if(_2b[i].substring(0,_2b[i].indexOf("="))==_29){
return _2b[i].substring((_2b[i].indexOf("=")+1));}}}
return "";}};
deconcept.SWFObjectUtil.cleanupSWFs=function(){if(window.opera||!document.all){return;}
var _2d=document.getElementsByTagName("OBJECT");
for(var i=0;i<_2d.length;i++){_2d[i].style.display="none";for(var x in _2d[i]){
if(typeof _2d[i][x]=="function"){_2d[i][x]=function(){};}}}};
deconcept.SWFObjectUtil.prepUnload=function(){__flash_unloadHandler=function(){};
__flash_savedUnloadHandler=function(){};
if(typeof window.onunload=="function"){
var _30=window.onunload;
window.onunload=function(){
deconcept.SWFObjectUtil.cleanupSWFs();_30();};
}else{window.onunload=deconcept.SWFObjectUtil.cleanupSWFs;}};
if(typeof window.onbeforeunload=="function"){
var oldBeforeUnload=window.onbeforeunload;
window.onbeforeunload=function(){
deconcept.SWFObjectUtil.prepUnload();
oldBeforeUnload();};
}else{window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload;}
if(Array.prototype.push==null){
Array.prototype.push=function(_31){
this[this.length]=_31;
return this.length;};}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;
/* do not change */

function init_post_request() {

  this.fn_request = false;

  if (window.XMLHttpRequest) { // Mozilla, Safari,...
    this.fn_request = new XMLHttpRequest();
    if (this.fn_request.overrideMimeType) {
      this.fn_request.overrideMimeType('text/html');
    }
  }
  else if (window.ActiveXObject) { // IE
    try {
      this.fn_request = new ActiveXObject("Msxml2.XMLHTTP");
    } catch (e) {
       try {
         this.fn_request = new ActiveXObject("Microsoft.XMLHTTP");
       } catch (e) {}
    }
  }
  if (!this.fn_request) {
    alert('Cannot create XMLHTTP instance');
    return false;
  }

}

function post_request(obj, url, parameters) {

  obj.open('POST', url, true);
  obj.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
  obj.setRequestHeader("Content-length", parameters.length);
  obj.setRequestHeader("Connection", "close");
  obj.send(parameters);

}

function build_query(frm) {
  var str = "";
  var element, i = 0;
  while ((element = document.getElementById(frm).elements[i++]) != null) {
      var qc = toQueryComponent(element);
      if (qc != "") str += "&" + qc;
  }
  return str.substring(1);
}

function toQueryComponent(input) {
    if (!input.name || input.disabled)
        return "";

    var n = urlencode(input.name);

    switch (input.type) {
    case "text":
    case "password":
    case "submit":
    case "hidden":
        return n + "=" + urlencode(input.value);
    case "textarea":
        // normalize line breaks as CR LF pairs as per RFC 1866
        var v = input.value.split(/\r\n|\r|\n/).join("\r\n");
        return n + "=" + urlencode(v);
    case "checkbox":
    case "radio":
        if (!input.checked)
            return "";
        //var v = getRealValue(input);
        var v = input.value;
        if (v === null) v = "on";
        return n + "=" + urlencode(v);
    case "select-one":
    case "select-multiple":
        var nvp = [];
        var opt, i = 0;
        while ((opt = input.options[i++]) != null) {
            if (opt.selected) {
                var v = getRealValue(opt);
                if (v === null) v = opt.text;
                // older versions of IE do not support Array.push
                nvp[nvp.length] = n + "=" + urlencode(v);
            }
        }
        return nvp.join("&");
    default:
        // input types reset, button, image, and file not implemented
        return "";
    }
}

function urlencode(str) {
    var v;
    try { v = encodeURIComponent(str); } catch (e) { v = escape(str); }
    return v.replace(/%20/g,"+");
}

function getRealValue(input) {
    var attr = input.getAttributeNode("value");
    return (attr && attr.specified) ? input.getAttribute("value") : null;
}

function launch_js(data) {
  // RegExp from prototype.sonio.net

  data = data.replace("<!--", "");
  data = data.replace("-->", "");

  var ScriptFragment = '(?:<script.*?>)((\n|\r|.)*?)(?:<\/script>)';

  var match    = new RegExp(ScriptFragment, 'img');
  var scripts  = data.match(match);

    if(scripts) {
        var js = '';
        for(var s = 0; s < scripts.length; s++) {
            var match = new RegExp(ScriptFragment, 'im');
            js += scripts[s].match(match)[1];
        }
        eval(js);
    }
}

/* end of do not change  */

function change_opacity(id, opacStart, opacEnd, millisec) {
	//speed for each frame
	var speed = Math.round(millisec / 100);
	var timer = 0;

	//determine the direction for the blending, if start and end are the same nothing happens
	if(opacStart > opacEnd) {
		for(i = opacStart; i >= opacEnd; i--) {
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
			
	} else if(opacStart < opacEnd) {
		for(i = opacStart; i <= opacEnd; i++)
			{
			setTimeout("changeOpac(" + i + ",'" + id + "')",(timer * speed));
			timer++;
		}
	}
	
}

//change the opacity for different browsers
function changeOpac(opacity, id) {
	var object = document.getElementById(id).style;
	object.opacity = (opacity / 100); 
	//object.MozOpacity = (opacity / 100);    
	object.filter = "alpha(opacity=" + opacity + ")";
}

var featured_req ="";
function show_featured(doc_id) {  	
  var url   = "/ajax/featured_articles.ajx.php?doc_id=" + doc_id;
	query = "";	
	tmp_http_req = new init_post_request();
	featured_req  = tmp_http_req.fn_request;
	featured_req.onreadystatechange = update_featured;		
	post_request(featured_req, url, query);
	 
}

function update_featured() {
  if (featured_req.readyState == 4 || featured_req.readyState == "complete")  {  			    			
		data = featured_req.responseText;
		change_opacity('featured_div', 100, 0, 500);	
		setTimeout("document.getElementById(\"featured_div\").innerHTML = data; change_opacity('featured_div', 0, 100, 200);",500);							
  }
}

var subscribe_req ="";
function subscribe(){
	email_add = document.getElementById("subscribe_email").value;
	subscriber = document.getElementById("subscribe_name").value;
	if(subscriber == "" || subscriber == "Name"){
		alert("Please enter your name.")
		return false;
	}
	if (email_add.search(/^\w+((-\w+)|(\.\w+))*\@[A-Za-z0-9]+((\.|-)[A-Za-z0-9]+)*\.[A-Za-z0-9]+$/) == -1){
		alert("Please enter a valid email address.")
		return false;
	}else{
		var url   = "/index.php?cmd=subscribe&email=" + email_add + "&name=" + subscriber;
		query = "";
		//document.getElementById("subscribe_td").innerHTML = "Saving...";		
		tmp_http_req = new init_post_request();
		subscribe_req  = tmp_http_req.fn_request;
		subscribe_req.onreadystatechange = update_subscribe;		
		post_request(subscribe_req, url, query);
	}	
}
function update_subscribe() {
  if (subscribe_req.readyState == 4 || subscribe_req.readyState == "complete")  {  			    			
		data = subscribe_req.responseText;			
		//document.getElementById("subscribe_td").innerHTML = data;	
		document.getElementById("subscribe_email").value = "Email address";
		document.getElementById("subscribe_name").value = "Name";
		alert("You have successfully subscribed to our newsletter.");
		
  }
}

var map_update_req = ""

function update_map(map_id) {	

	var url   = "/ajax/maps.ajx.php?map_id=" + map_id;
  var query = "";
	document.getElementById('map_details').innerHTML = "Loading...";
  tmp_http_req    = new init_post_request();
  map_update_req = tmp_http_req.fn_request;

  map_update_req.onreadystatechange = update_map_details;

  post_request(map_update_req, url, query);

}

function update_map_details() {

	if (map_update_req.readyState == 4 || map_update_req.readyState == "complete") {
    data = map_update_req.responseText;
		document.getElementById('map_details').innerHTML = data;
		launch_js(data);
	}

}/*****************************************************
* ypSlideOutMenu
* 3/04/2001
*
* a nice little script to create exclusive, slide-out
* menus for ns4, ns6, mozilla, opera, ie4, ie5 on 
* mac and win32. I've got no linux or unix to test on but 
* it should(?) work... 
*
* Revised:
* - 08/29/2002 : added .hideAll()
*
* --youngpup--
*
* revised by ed for centering in browser and submenus (merged youngpup centering code and aveda submenu code)
* ed - i TRIED to comment for others to see what i did... but it is not very detailed or well commented
*****************************************************/
ypSlideOutMenu.Registry = []
ypSlideOutMenu.aniLen = 200
ypSlideOutMenu.hideDelay = 300
ypSlideOutMenu.minCPUResolution = 10

ypSlideOutMenu.styleMod = '';

function ypSlideOutMenu(id, dir, left, top, width, height, parentid, degrade, debug)
{
	this.ie = document.all ? 1 : 0
	this.ns4 = document.layers ? 1 : 0
	this.dom = document.getElementById ? 1 : 0
	
	if (this.ie || this.ns4 || this.dom) {
		this.degrade = degrade;
		this.debug = debug;
		this.sliding = false;
		this.id = id
		this.parentid = parentid
		this.dir = dir
		this.orientation = dir == "left" || dir == "right" ? "h" : "v"
		this.dirType = dir == "right" || dir == "down" ? "-" : "+"
		this.dim = this.orientation == "h" ? width : height
		this.hideTimer = false
		this.aniTimer = false
		this.open = false
		this.over = false
		this.startTime = 0
		
		// global reference to this object
		this.gRef = "ypSlideOutMenu_"+id
		eval(this.gRef+"=this")
		
		// add this menu object to an internal list of all menus
		ypSlideOutMenu.Registry[id] = this
		
		//ed - these 5 lines were in aveda but arent being used anymore.. i hope
		//this.initleft = left
		//this.inittop = top
		//this.initwidth = width
		//this.initheight = height
		//this.showcount = 0;

		var d = document
		
		//var strCSS = '<style type="text/css">';
		var strCSS = "";
		strCSS += '#' + this.id + 'Container { visibility:hidden; '
		strCSS += 'left:' + left + 'px; '
		strCSS += 'top:' + top + 'px; '
		strCSS += 'overflow:hidden; z-index:10000; }'
		strCSS += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; '
		strCSS += 'width:' + width + 'px; '
		strCSS += 'height:' + height + 'px; '
		strCSS += 'clip:rect(0 ' + width + ' ' + height + ' 0); '
		strCSS += '}'
		//strCSS += '</style>'
		//d.write(strCSS)
		this.css = strCSS;
		
		//this.load()
// The following code originally invoked "document.write" but it caused
// a crash in IE (but not NS) when there were
// more than 31 menus total.  What crashed is that the styles that were
// declared in the css disappeared with 31 menus, where 32 menus caused
// the d.write call to fail entirely.  When I changed
// it so that the style changes were accumulated into one string
// (then at the end that string was written into the document,
// so that document.write was only called once) this solved the problem.

		ypSlideOutMenu.styleMod += '#' + this.id + 'Container { visibility:hidden; ';
		ypSlideOutMenu.styleMod += 'left:' + left + 'px; ';
		ypSlideOutMenu.styleMod += 'z-index:50; ';
		ypSlideOutMenu.styleMod += 'top:' + top + 'px; ';
		ypSlideOutMenu.styleMod += 'overflow:hidden; }';
		ypSlideOutMenu.styleMod += '#' + this.id + 'Container, #' + this.id + 'Content { position:absolute; ';
		ypSlideOutMenu.styleMod += 'height:' + height + 'px; ';
		ypSlideOutMenu.styleMod += 'width:' + width + 'px; ';
		ypSlideOutMenu.styleMod += 'z-index:50; ';
		ypSlideOutMenu.styleMod += 'clip:rect(0 ' + width + ' ' + height + ' 0); ';
		ypSlideOutMenu.styleMod += '}  ';
		
		this.load()
	}
}

ypSlideOutMenu.writeCSS = function() {
	document.writeln('<style type="text/css">');

	for (var id in ypSlideOutMenu.Registry) {
		document.writeln(ypSlideOutMenu.Registry[id].css);
	}

	document.writeln('</style>');
}

ypSlideOutMenu.prototype.load = function() {
	var d = document
	var lyrId1 = this.id + "Container"
	var lyrId2 = this.id + "Content"
	var obj1 = this.dom ? d.getElementById(lyrId1) : this.ie ? d.all[lyrId1] : d.layers[lyrId1]
	if (obj1) var obj2 = this.ns4 ? obj1.layers[lyrId2] : this.ie ? d.all[lyrId2] : d.getElementById(lyrId2)
	if (!obj1 || !obj2) {
		window.setTimeout(this.gRef + ".load()", 1000);
	} else {
		this.container = obj1
		this.menu = obj2
		this.style = this.ns4 ? this.menu : this.menu.style
		// SEE NOTE ABOVE.  The following function call for the 31 menus bug.
		//this.setStyle()
		this.homePos = eval("0" + this.dirType + this.dim)
		this.outPos = 0
		this.accelConst = (this.outPos - this.homePos) / ypSlideOutMenu.aniLen / ypSlideOutMenu.aniLen 
		if (this.ns4) this.menu.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT);
		this.menu.onmouseover = new Function("ypSlideOutMenu.showMenu('" + this.id + "')")
		this.menu.onmouseout = new Function("ypSlideOutMenu.hideMenu('" + this.id + "')")
		this.endSlide()
	}
}
ypSlideOutMenu.showMenu = function(id, e)
{
	var reg = ypSlideOutMenu.Registry
	var obj = ypSlideOutMenu.Registry[id]
	
	//document.getElementById('new_qq').style.display = "none";
	
	//hide_all_drop_down();
	
	if (obj.container) {
//		if (obj.ie) alert('showing: ' + id);
		obj.over = true
		if (obj.hideTimer) { reg[id].hideTimer = window.clearTimeout(reg[id].hideTimer) }
		obj.showcount++;
		if (!obj.open && !obj.aniTimer) reg[id].startSlide(true)
	}
	if (obj.ns4) obj.menu.routeEvent(Event.MOUSEOVER);
}

ypSlideOutMenu.hideMenu = function(id, e)
{
	var obj = ypSlideOutMenu.Registry[id]
	
	show_all_drop_down();
	
	if (obj.container) {
//		if (obj.ie) alert('hiding: ' + id);
		if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
		obj.showcount--;
		obj.hideTimer = window.setTimeout("ypSlideOutMenu.hide('" + id + "')", ypSlideOutMenu.hideDelay);
	}
	if (obj.ns4) obj.menu.routeEvent(Event.MOUSEOUT);
}

ypSlideOutMenu.hideAll = function()
{
var reg = ypSlideOutMenu.Registry
for (menu in reg) {
ypSlideOutMenu.hide(menu);
if (menu.hideTimer) window.clearTimeout(menu.hideTimer);
}
}

ypSlideOutMenu.hide = function(id) {
	var obj = ypSlideOutMenu.Registry[id]
	var reg = ypSlideOutMenu.Registry
	obj.over = false
	if (obj.hideTimer) window.clearTimeout(obj.hideTimer)
	obj.hideTimer = 0
	var close = true;
	for (menu in reg) {
		// for each child, if either
		//  1. the child is open or
		//  2. the child is closing (but hasn't closed yet)
		// then we don't close this menu.
		var pid = ypSlideOutMenu.Registry[menu].parentid
		if (pid == id) {
			if (ypSlideOutMenu.Registry[menu].open) close = false;
			if (!ypSlideOutMenu.Registry[menu].open && ypSlideOutMenu.Registry[menu].sliding) close = false;
		}
	}
	if (obj.open && !obj.aniTimer && close && !obj.showcount) obj.startSlide(false);
}

ypSlideOutMenu.prototype.startSlide = function(open) {
//ed - had to add this line below to make centering work
this[open ? "onactivate" : "ondeactivate"]()
	this.open = open
	if (open) this.setVisibility(true)
	this.startTime = (new Date()).getTime() 
	this.sliding = true;
	this.aniTimer = window.setInterval(this.gRef + ".slide()", ypSlideOutMenu.minCPUResolution)
}

ypSlideOutMenu.prototype.slide = function() {
	var elapsed = (new Date()).getTime() - this.startTime
	if (elapsed > ypSlideOutMenu.aniLen) this.endSlide()
	else {
		var d = Math.round(Math.pow(ypSlideOutMenu.aniLen-elapsed, 2) * this.accelConst)
		if (this.open && this.dirType == "-") d = -d
		else if (this.open && this.dirType == "+") d = -d
		else if (!this.open && this.dirType == "-") d = -this.dim + d
		else d = this.dim + d
		this.moveTo(d)
	}
}


ypSlideOutMenu.prototype.endSlide = function() {
	this.aniTimer = window.clearTimeout(this.aniTimer)
	this.moveTo(this.open ? this.outPos : this.homePos)
	if (!this.open) this.setVisibility(false)
	this.sliding = false;
	if (((this.open && !this.over) || (!this.open && this.over)) && (!this.parent || this.parent.open)) {
		this.startSlide(this.over)
	} else {
		var overchild = false;
		var reg = ypSlideOutMenu.Registry
		for (menu in reg) {
			var pid = ypSlideOutMenu.Registry[menu].parentid
			if (pid == this.id) overchild = ypSlideOutMenu.Registry[menu].over ? true : overchild		
		}
//		if (!overchild && this.parentid && !ypSlideOutMenu.Registry[this.parentid].over) ypSlideOutMenu.hideMenu(this.parentid);
		if (!overchild && this.parentid && !ypSlideOutMenu.Registry[this.parentid].over) ypSlideOutMenu.hide(this.parentid);
	}
}

ypSlideOutMenu.prototype.setVisibility = function(bShow) { 
	var s = this.ns4 ? this.container : this.container.style
	s.visibility = bShow ? "visible" : "hidden"
}

ypSlideOutMenu.prototype.moveTo = function(p) { 
// ed - without   = this.ns4 ? p : p + "px"   it gave me problems in netscape.. it wouldnt slide.
this.style[this.orientation == "h" ? "left" : "top"] = this.ns4 ? p : p + "px"
}

ypSlideOutMenu.prototype.getPos = function(c) {
	return parseInt(this.style[c])
}

//ed - had to add these 2 lines below to make centering work
ypSlideOutMenu.prototype.onactivate = function() { }
ypSlideOutMenu.prototype.ondeactivate = function() { }

function hide_all_drop_down() {

  for (i = 0; i < document.forms.length; i++) {
    var frm = document.forms[i];
    for(x=0; x< frm.length; x++){		  
      if (frm.elements[x].type == "select-one" && frm.elements[x].name != "new_pro_id") {
  		  frm.elements[x].style.visibility = "hidden"; 
      }
      if (frm.elements[x].type == "select-multiple" && frm.elements[x].name != "new_pro_id") {
        frm.elements[x].style.visibility = "hidden";
      }
    }   
  }

}

function show_all_drop_down () {

  for (i = 0; i < document.forms.length; i++) {
    var frm = document.forms[i];
    for(x=0; x< frm.length; x++){
      if (frm.elements[x].type == "select-one") {
			  /*
			  if (!qq_interface_on) {
				  frm.elements[x].style.visibility = "visible"; 
				} 
				*/        
	    }
      if (frm.elements[x].type == "select-multiple") {
			  /*
			  if (!qq_interface_on) {
          frm.elements[x].style.visibility = "visible";
				}
				*/
      }
    }   
  }

}
