// Identity Developments					           //
// www.i-devs.com							               //
// Copyright (c)2005 Identity Developments.	 //
// All rights reserved.						           //
///////////////////////////////////////////////

// View Source of external web page.  /////////
// -- Original:  Alfie Pugh (alfiep@lineone.net) --
// -- This script and many more are available free online at --
// -- The JavaScript Source!! http://javascript.internet.com --

function viewSource() {
document.getSource.view.value="Please wait...";
setTimeout("document.getSource.view.value='View Source!'",6000);
window.location.href= "view-source:" + document.getSource.url.value;
return false;
}


// Stylesheet switcher ////////////////////////
function setActiveStyleSheet(title) {
  var i, a, main;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title")) {
      a.disabled = true;
      if(a.getAttribute("title") == title) a.disabled = false;
    }
  }
}

function getActiveStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1 && a.getAttribute("title") && !a.disabled) return a.getAttribute("title");
  }
  return null;
}

function getPreferredStyleSheet() {
  var i, a;
  for(i=0; (a = document.getElementsByTagName("link")[i]); i++) {
    if(a.getAttribute("rel").indexOf("style") != -1
       && a.getAttribute("rel").indexOf("alt") == -1
       && a.getAttribute("title")
       ) return a.getAttribute("title");
  }
  return null;
}

function createCookie(name,value,days) {
  if (days) {
    var date = new Date();
    date.setTime(date.getTime()+(days*24*60*60*1000));
    var expires = "; expires="+date.toGMTString();
  }
  else expires = "";
  document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
  var nameEQ = name + "=";
  var ca = document.cookie.split(';');
  for(var i=0;i < ca.length;i++) {
    var c = ca[i];
    while (c.charAt(0)==' ') c = c.substring(1,c.length);
    if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
  }
  return null;
}

window.onload = function(e) {
  var cookie = readCookie("style");
  var title = cookie ? cookie : getPreferredStyleSheet();
  setActiveStyleSheet(title);
}

window.onunload = function(e) {
  var title = getActiveStyleSheet();
  createCookie("style", title, 365);
}

var cookie = readCookie("style");
var title = cookie ? cookie : getPreferredStyleSheet();
setActiveStyleSheet(title);


// Auto copyright /////////////////////////////
function copyright() {
var d=new Date();
yr=d.getFullYear();
if (yr!=2003)
	    document.write("-"+yr+" ");
}


// Smooth Scroller ////////////////////////////
function ss_fixAllLinks() { 
 var allLinks = document.getElementsByTagName('a'); 
 for (var i=0;i<allLinks.length;i++) { 
   var lnk = allLinks[i]; 
   if ((lnk.href && lnk.href.indexOf('#') != -1) &&  
       ( (lnk.pathname == location.pathname) || 
   ('/'+lnk.pathname == location.pathname) ) &&  
       (lnk.search == location.search)) { 
     ss_addEvent(lnk,'click',smoothScroll); 
   } 
 }
} 
function smoothScroll(e) { 
 if (window.event) { 
   target = window.event.srcElement; 
 } else if (e) { 
   target = e.target; 
 } else return; 
 if (target.nodeType == 3) { 
   target = target.parentNode; 
 } 
 if (target.nodeName.toLowerCase() != 'a') return; 
 anchor = target.hash.substr(1); 
 var allLinks = document.getElementsByTagName('a'); 
 var destinationLink = null; 
 for (var i=0;i<allLinks.length;i++) { 
   var lnk = allLinks[i]; 
   if (lnk.name && (lnk.name == anchor)) { 
     destinationLink = lnk; 
     break; 
   } 
 } 
 if (!destinationLink) return true; 
 var destx = destinationLink.offsetLeft;  
 var desty = destinationLink.offsetTop; 
 var thisNode = destinationLink; 
 while (thisNode.offsetParent &&  
       (thisNode.offsetParent != document.body)) { 
   thisNode = thisNode.offsetParent;
   destx += thisNode.offsetLeft; 
   desty += thisNode.offsetTop; 
 } 
 clearInterval(ss_INTERVAL); 
 cypos = ss_getCurrentYPos(); 
 ss_stepsize = parseInt((desty-cypos)/ss_STEPS); 
 ss_INTERVAL = setInterval('ss_scrollWindow('+ss_stepsize+','+desty+',"'+anchor+'")',10);
 if (window.event) { 
   window.event.cancelBubble = true; 
   window.event.returnValue = false; 
 } 
 if (e && e.preventDefault && e.stopPropagation) { 
   e.preventDefault(); 
   e.stopPropagation(); 
 } 
} 
function ss_scrollWindow(scramount,dest,anchor) { 
 wascypos = ss_getCurrentYPos(); 
 isAbove = (wascypos < dest); 
 window.scrollTo(0,wascypos + scramount); 
 iscypos = ss_getCurrentYPos(); 
 isAboveNow = (iscypos < dest); 
 if ((isAbove != isAboveNow) || (wascypos == iscypos)) { 
   window.scrollTo(0,dest);
   clearInterval(ss_INTERVAL); 
   location.hash = anchor; 
 } 
} 
function ss_getCurrentYPos() { 
 if (document.body && document.body.scrollTop) 
   return document.body.scrollTop; 
 if (document.documentElement && document.documentElement.scrollTop) 
   return document.documentElement.scrollTop; 
 if (window.pageYOffset) 
   return window.pageYOffset; 
 return 0; 
}
function ss_addEvent(elm, evType, fn, useCapture) 
{ 
 if (elm.addEventListener){ 
   elm.addEventListener(evType, fn, useCapture); 
   return true;
 } else if (elm.attachEvent){ 
   var r = elm.attachEvent("on"+evType, fn); 
   return r; 
 } 
}
var ss_INTERVAL; 
var ss_STEPS = 25; 
ss_addEvent(window,"load",ss_fixAllLinks);


//-----------------------

// image Popitup windows
// Based on JavaScript provided by Peter Curtis at www.pcurtis.com
// Routine for popup windows with title, size and background colour parameter (5 parameters)
// with mods by Identity Developments - www.i-devs.com

var newwindow;
var wheight = 0, wwidth = 0;

function popitup5(url, title, iwidth, iheight) {
var pwidth, pheight;

if ( !newwindow || newwindow.closed ) {
	pwidth=iwidth+40;
	pheight=iheight+100;
	newwindow=window.open('','htmlname','width=' + pwidth +',height=' + pheight + ',resizable=1,top=50,left=10,status=1,scrollbars=1 ');
	wheight=iheight;
	wwidth=iwidth;
}
 
if (wheight!=iheight || wwidth!=iwidth ) {
	pwidth=iwidth+40;
	pheight=iheight+100;
	if (version.substring(0,1)>3) { 	// check browser v4+ supporting JavaScript 1.2	
		newwindow.resizeTo(pwidth, pheight);
	}
	wheight=iheight;
	wwidth=iwidth;
}

newwindow.document.clear();
newwindow.focus();
newwindow.document.writeln('<!DOCTYPE html PUBLIC \"-\/\/W3C\/\/DTD XHTML 1.0 Transitional\/\/EN\" \"http:\/\/www.w3.org\/TR\/xhtml1\/DTD\/xhtml1-transitional.dtd\">');
newwindow.document.writeln('<html xmlns=\"http:\/\/www.w3.org\/1999\/xhtml\">');
newwindow.document.writeln('<head> <title>' + title + '<\/title>');
newwindow.document.writeln('<base href=\"http:\/\/www.identitydevelopments.com\/\" \/>');
newwindow.document.writeln('<meta http-equiv=\"imagetoolbar\" content=\"no\" \/>');
newwindow.document.writeln('<link href=\"style\/id-pop.css\" rel=\"stylesheet\" type=\"text\/css\" media=\"screen\" \/>');
newwindow.document.writeln('<\/head> <body id=\"pop\">');
newwindow.document.writeln('<div id=\"popHolder\">');
newwindow.document.writeln('<img src=\"' + url + '\" title=\"' + title + '\" alt=\"' + title + '\" \/>');
newwindow.document.writeln('<div id=\"popCopy\">Copyright Identity Developments. All rights reserved.<\/div><\/div>');
newwindow.document.writeln('<a href=\"javascript:window.close();\">{Close window}<\/a> <\/body> <\/html>');
newwindow.document.close();
newwindow.focus();
}

//Routine to tidy up popup windows when page is left
window.onunload = function tidy5() {
if (newwindow && !newwindow.closed) { newwindow.close(); }
}


// Clear default form value script- By Ada Shimar (ada@chalktv.com)
function clearText(thefield){
if (thefield.defaultValue==thefield.value)
thefield.value = ""
}


//toggler - by dreamlettes.net
function tgClasses(c) {
var ael,a=new Array(),j=0;
if(document.all)ael=document.all;
else if(document.getElementsByTagName && !document.all)ael=document.getElementsByTagName("*");
for(i=0;i<ael.length;i++) {
if(ael[i].className==c) { a[j]=ael[i]; j++; }
} return a;
}
function toggler() {
var h=tgClasses('handler');
var t=tgClasses('toggle');
var sall=tgClasses('showall')
var hall=tgClasses('hideall')
for (var i = 0; i < sall.length; i++) sall[i].onclick = function() {showall()}; 
for (var i = 0; i < hall.length; i++) hall[i].onclick = function() {hideall()}; 
for (var i = 0; i < h.length; i++) { h[i].someProperty = i; h[i].onclick = function() {toggle(this)}; }
for (var i = 0; i < t.length; i++) t[i].style.display = 'none';
}
function toggle(el) {
var i= el.someProperty;
var t=tgClasses('toggle')[i];
if (t.style.display == 'none') {t.style.display = ''; el.className = 'handler_down';}
else {t.style.display = 'none'; el.className = 'handler'}
} 
function showall() {
var h=tgClasses('handler');
for (var i = 0; i < h.length; i++)  h[i].className = 'handler_down';
var t=tgClasses('toggle');
for (var i = 0; i < t.length; i++)  t[i].style.display = '';
}
function hideall() {
var h=tgClasses('handler_down');
for (var i = 0; i < h.length; i++)  h[i].className = 'handler';
var t=tgClasses('toggle');
for (var i = 0; i < t.length; i++)  t[i].style.display = 'none';
}

window.onload=toggler;