﻿//		bostonkendo.js
//		boston kendo kyokai javascript library
//		david harrison
//

function ajaxRequest()
{
 var activexmodes=["Msxml2.XMLHTTP", "Microsoft.XMLHTTP"] //activeX versions to check for in IE
 if (window.ActiveXObject){ //Test for support for ActiveXObject in IE first (as XMLHttpRequest in IE7 is broken)
  for (var i=0; i<activexmodes.length; i++){
   try{
    return new ActiveXObject(activexmodes[i])
   }
   catch(e){
    //suppress error
   }
  }
 }
 else if (window.XMLHttpRequest) // if Mozilla, Safari etc
  return new XMLHttpRequest()
 else
  return false
}	

function bkklogin(){

var processText="<span class='LoginText' style='position:absolute; left:250px; top: 10px;'><img src='images/main/loading.gif' />&nbsp;&nbsp;&nbsp; Processing... Please Wait.</span>"
var xhttp_request=new ajaxRequest()
xhttp_request.onreadystatechange=function(){
 if (xhttp_request.readyState==4){
  if (xhttp_request.status==200 || window.location.href.indexOf("http")==-1){
   document.getElementById("Login").innerHTML=xhttp_request.responseText
  }
  else{
   alert("An error has occured making the request")
  }
 }
}
var uservalue=encodeURIComponent(document.getElementById("user").value)
var passvalue=encodeURIComponent(document.getElementById("pass").value)
var ctrlvalue=encodeURIComponent(document.getElementById("ctrl").value)
var parameters="ctrl="+ctrlvalue+"&user="+uservalue+"&pass="+passvalue

xhttp_request.open("POST", "login.php", true)
xhttp_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded")      
xhttp_request.setRequestHeader("Content-length", parameters.length)
xhttp_request.setRequestHeader("Connection", "close")
xhttp_request.send(parameters)

document.getElementById("Login").innerHTML=processText


parameters=""
uservalue=""
passvalue=""
ctrlvalue=""
}

function getpage(elementID, ctrlvalue){
var xhttp_request=new ajaxRequest()
xhttp_request.onreadystatechange=function(){
 if (xhttp_request.readyState==4){
  if (xhttp_request.status==200 || window.location.href.indexOf("http")==-1){
   document.getElementById(elementID).innerHTML=xhttp_request.responseText
  }
  else{
   alert("An error has occured making the request")
  }
 }
}

var parameters="ctrl="+ctrlvalue

xhttp_request.open("POST", "pagecontroller.php", true)
xhttp_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded")      
xhttp_request.setRequestHeader("Content-length", parameters.length)
xhttp_request.setRequestHeader("Connection", "close")
xhttp_request.send(parameters)
parameters=""
crtlvalue=""
}

function bkklogout(){
var xhttp_request=new ajaxRequest()
xhttp_request.onreadystatechange=function(){
 if (xhttp_request.readyState==4){
  if (xhttp_request.status==200 || window.location.href.indexOf("http")==-1){
   document.getElementById("Login").innerHTML=xhttp_request.responseText
  }
  else{
   alert("An error has occured making the request")
  }
 }
}
var ctrlvalue=encodeURIComponent(document.getElementById("ctrl").value)
var parameters="ctrl="+ctrlvalue

xhttp_request.open("POST", "login.php", true)
xhttp_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded")      
xhttp_request.setRequestHeader("Content-length", parameters.length)
xhttp_request.setRequestHeader("Connection", "close")
xhttp_request.send(parameters)
parameters=""
crtlvalue=""
}

function bkkforgot()
{
	document.getElementById("LoginMessage").innerHTML="<a href='forgot.php' target='_blank'>Forgot your Password?</a>"
}

function FP_swapImg() {//v1.0
	 var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
	 n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
	 elm.$src=elm.src; elm.src=args[n+1]; } }
}

function FP_preloadImgs() {//v1.0
 var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
 for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
}

function FP_getObjectByID(id,o) {//v1.0
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function zg_insert_badge() {
var zg_bg_color = 'ffffff';
var zgi_url = 'http://www.flickr.com/apps/badge/badge_iframe.gne?zg_bg_color='+zg_bg_color+'&zg_person_id=27961109%40N05';
document.write('<iframe style="background-color:#'+zg_bg_color+'; border-color:#'+zg_bg_color+'; border:none;" width="113" height="151" frameborder="0" scrolling="no" src="'+zgi_url+'" title="Flickr Badge"><\/iframe>');
if (document.getElementById) document.write('<div id="zg_whatlink"><a href="http://www.flickr.com/badge.gne"	style="color:#3993ff;" onclick="zg_toggleWhat(); return false;">What is this?<\/a><\/div>');
}
function zg_toggleWhat() {
document.getElementById('zg_whatdiv').style.display = (document.getElementById('zg_whatdiv').style.display != 'none') ? 'none' : 'block';
document.getElementById('zg_whatlink').style.display = (document.getElementById('zg_whatdiv').style.display != 'none') ? 'none' : 'block';
return false;
}

//============================================================
//Script:     Print Current Window From A Link
//Function:   Opens printer dialogue to print current page
//Browsers:   Version 4 and later (others degrade gracefully)
//Author:     etLux
//============================================================

// (C) 2000 www.CodeLifter.com
// http://www.codelifter.com
// Free for all users, but leave in this  header

function printWindow(){
   bV = parseInt(navigator.appVersion)
   if (bV >= 4) window.print()
}

function printPage(){

	printWindow();
}

<!--
function na_open_window(name, url, left, top, width, height, toolbar, menubar, statusbar, scrollbar, resizable)
{
  toolbar_str = toolbar ? 'yes' : 'no';
  menubar_str = menubar ? 'yes' : 'no';
  statusbar_str = statusbar ? 'yes' : 'no';
  scrollbar_str = scrollbar ? 'yes' : 'no';
  resizable_str = resizable ? 'yes' : 'no';

  cookie_str = document.cookie;
  cookie_str.toString();

  pos_start  = cookie_str.indexOf(name);
  pos_end    = cookie_str.indexOf('=', pos_start);

  cookie_name = cookie_str.substring(pos_start, pos_end);

  pos_start  = cookie_str.indexOf(name);
  pos_start  = cookie_str.indexOf('=', pos_start);
  pos_end    = cookie_str.indexOf(';', pos_start);
  
  if (pos_end <= 0) pos_end = cookie_str.length;
  cookie_val = cookie_str.substring(pos_start + 1, pos_end);
  if (cookie_name == name && cookie_val  == "done")
    return;

  window.open(url, name, 'left='+left+',top='+top+',width='+width+',height='+height+',toolbar='+toolbar_str+',menubar='+menubar_str+',status='+statusbar_str+',scrollbars='+scrollbar_str+',resizable='+resizable_str);
}

function showBox (elementID)
{
	document.getElementById(elementID).style.visibility="visible";
}

function hideBox (elementID)
{
	document.getElementById(elementID).style.visibility="hidden";
}

// -->
