try {
	// IE6 flicker fix
	document.execCommand("BackgroundImageCache", false, true);
} catch(err) {}


startStack=function() { };  // A stack of functions to run onload/domready

registerOnLoad = function(func) {
   var orgOnLoad = startStack;
   startStack = function () {
      orgOnLoad();
      func();
      return;
   }
}

var ranOnload=false; // Flag to determine if we've ran the starting stack already.

if (document.addEventListener) {
  // Mozilla actually has a DOM READY event.
   document.addEventListener("DOMContentLoaded", function(){if (!ranOnload) {ranOnload=true; startStack();}}, false);
}  else if (document.all && !window.opera) {
  // This is the IE style which exploits a property of the (standards defined) defer attribute
  document.write("<scr" + "ipt id='DOMReady' defer=true " + "src=//:><\/scr" + "ipt>");  
  document.getElementById("DOMReady").onreadystatechange=function(){
    if (this.readyState=="complete"&&(!ranOnload)){
      ranOnload=true;
      startStack();
    }
  }
}

var orgOnLoad=window.onload;
window.onload=function() {
   if (typeof(orgOnLoad)=='function') {
      orgOnLoad();
   }
   if (!ranOnload) {
     ranOnload=true;
     startStack();
   }
}

function did(string) {
	return document.getElementById(string);
}

function xhr()
{
	if ( window.XMLHttpRequest ) {
		request = new XMLHttpRequest();
	} else if ( window.ActiveXObject ) {
		try {
			request = new ActiveXObject( "Msxml2.XMLHTTP" );
		} catch ( error ) {
			try {
				request = new ActiveXObject( "Microsoft.XMLHTTP" );
			} catch ( error2 ) {
				return alert("Fatal Error: No XMLHttp Interface Available");
			}
		}
	} else {
		return alert("Fatal Error: No XMLHttp Interface Available");
	}
	return request;
}

function rpc(path, input)
{
	var requestType = "POST";
	
	if ( !input ) {
		requestType = "GET";
		input = null;
	}
	
	var request = xhr();
	
	request.open(requestType, 'rpc/'+path, false);
	request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");		
	request.send(input);
	eval("var res="+request.responseText);
	return res;
}

function async_rpc(path, callback, input)
{
	this.requestType = "POST";
	this.myCallback = callback;
	
	this.callback = function () {
		if (4 == this.request.readyState && 200 == this.request.status) {
			eval("var res="+this.request.responseText);
			//res.callback(res.retval);
			this.myCallback(res);
		}
	}
	
	this.abort = function (){
		this.request.abort();
	}
	
	if ( !input ) {
		this.requestType = "GET";
		this.input = null;
	}
	
	var request = xhr();

	this.request.onreadystatechange = createDelegate(this, 'callback');

	this.request.open(this.requestType, 'rpc/'+path, true);
	this.request.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	this.request.send(input);
	
}

function activaX(element, url, input)
{
	this.element = domcheck(element);
	this.url = url;
	
	var request = xhr();
	this.request.onreadystatechange = createDelegate(this, 'callback');
	this.request.open("GET", this.url, true);
	this.request.send(null);
	
	this.callback = function() {
		this.element.innerHTML = this.request.responseText;
		this.element.innerHTML = this.element.innerHTML //ie fix
	}
}

function createDelegate(oObject, sMethodName)
{
	return function () {
		return oObject[sMethodName].apply(oObject, arguments);
	};
}

function domcheck(elem)
{
	if ( typeof(elem) == 'object' ) {
		return elem;
	}
	
	return did(elem);
}

function registerEvent(elem, event, callback, capture)
{
	elem = domcheck(elem);
	
	if ( typeof(capture) != 'undefined' ) {
		capture = true;
	}
	
	if ( event == 'allchange' ) {
		registerEvent(elem, 'change', callback, capture);
		registerEvent(elem, 'click', callback, capture);
		registerEvent(elem, 'keyup', callback, capture);
		return;
	}
	
	if ( elem.addEventListener ) {
		elem.addEventListener(event, callback, capture);
	} else {
		elem.attachEvent('on'+event, callback, capture); 
	}
}

function unregisterEvent(elem, event, callback, capture)
{
	elem = domcheck(elem);
	
	if ( typeof(capture) != 'undefined' ) {
		capture = true;
	}
	
	if ( event == 'allchange' ) {
		unregisterEvent(elem, 'change', callback, capture);
		unregisterEvent(elem, 'click', callback, capture);
		unregisterEvent(elem, 'keyup', callback, capture);
		return;
	}
	
	if ( elem.removeEventListener ) {
		elem.removeEventListener(event, callback, capture);
	} else {
		elem.detachEvent('on'+event, callback, capture); 
	}
}

function NewWindow(mypage, myname, w, h, scroll)
{
	var winl = (screen.width - w) / 2;
	var wint = (screen.height - h) / 2;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable=yes'
	win = window.open(mypage, myname, winprops)
	if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
	return win;
}

function getNextSibling(elem)
{
	elem = domcheck(elem);
	if ( !elem.nextSibling ) {
		return false;
	}
	if ( elem.nextSibling.nodeName == '#text' ) {
		return getNextSibling(elem.nextSibling);
	}
	return elem.nextSibling;
}

function getPreviousSibling(elem)
{
	elem = domcheck(elem);
	if ( !elem.previousSibling ) {
		return false;
	}
	if ( elem.previousSibling.nodeName == '#text' ) {
		return getPreviousSibling(elem.previousSibling);
	}
	return elem.previousSibling;
}

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 var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function hideID(name)
{
	if ( did(name) ) {
		did(name).style.display = 'none';
	}
}

function showID(name)
{
	if( did(name) ) {
		did(name).style.display = '';
	}
}

function toggleDisplayID(name, roll)
{
	if( did(name) ) {
		if(did(name).style.display == 'none') {
			//if(roll == 'updown') {
			//	new Activa_FX('RollDown', name, 200);
			//} else {
				showID(name);
			//}
		} else {
			//if(roll == 'updown') {
			//	new Activa_FX('RollUp', name, 200);
			//} else {
				hideID(name);
			//}
		}
	}
}

function rollDisplayID(name, roll)
{
	var targ = domcheck(name);
	if ( targ.style.display == 'none' ) {
		new Activa_FX('RollDown', targ, 250, function() { did('rollTrigger').innerHTML = 'Close Sign In' });
	} else {
		new Activa_FX('RollUp', targ, 250, function() { did('rollTrigger').innerHTML = 'Sign In Here' });
	}
}

function rollFadeLogin()
{
	new Activa_FX('RollDown', 'side_signin_container', 500, function(){}, 0.349)._height = 149;
	new Activa_FX('FadeOut', 'side_signin_control', 250, function() { new Activa_FX('FadeIn', 'side_signin_form', 250, function() {}, 0.2); }, 0, 0.8);
}

function rollLogin(control, form)
{
	var targControl = domcheck(control);
	var targForm = domcheck(form);
	
	if ( targForm.style.display == 'none' ) {
		new Activa_FX('RollUp', targControl, 250);
		new Activa_FX('RollDown', targForm, 250);
	} else {
		new Activa_FX('RollUp', targForm, 250);
		new Activa_FX('RollDown', targControl, 250);
	}
}

function changeCreditCardCountry()
{
	if ( did('cc_country').value == '213' || did('cc_country').value == 'US' ) {
		showID('cc_state');
		hideID('cc_province');
		hideID('cc_other');
	} else if ( did('cc_country').value == '38' || did('cc_country').value == 'CA' ) {
		hideID('cc_state');
		showID('cc_province');
		hideID('cc_other');
	} else {
		hideID('cc_state');
		hideID('cc_province');
		showID('cc_other');
	}
}

function updateCountry()
{
	if ( did('country').value == '' ) {
		return;
	}
	
	did('state').style.display = 'none';
	did('province').style.display = 'none';
	did('other').style.display = 'none';
	
	if ( did('country').value == 'US' || did('country').value == '213' ) {
		did('state').style.display = '';
	} else if ( did('country').value == 'CA' || did('country').value == '38' ) {
		did('province').style.display = '';
	} else {
		did('other').style.display = '';
	}
}

/*function updateCountry() {
	if ( did('country').value == '' ) {
		return;
	}
	
	did('us_row').style.display = 'none';
	did('can_row').style.display = 'none';
	did('other_row').style.display = 'none';
	
	if ( did('country').value == 'US' || did('country').value == '213' ) {
		did('us_row').style.display = '';
	} else if ( did('country').value == 'CA' || did('country').value == '38' ) {
		did('can_row').style.display = '';
	} else {
		did('other_row').style.display = '';
	}
}*/

function moneyFormat(n)
{
	return n.toFixed(2);
}

var editingOp = 0;
function modifyOp( opId ) {
	if(editingOp == 0 || editingOp == opId) {
		showID('editRow1op'+opId);
		showID('editRow2op'+opId);
		editingOp = opId;
	} else {
		alert("You may only edit one operator at a time.");
	}
}

function changeClientStyle(image, alt)
{
	did('client_style_image').src = 'images/client_styles/'+image;
	did('client_style_image').alt = alt;
}

function allOperators(func)
{
	elems = document.getElementsByName('operators['+dept_id+'][]');
	
	if ( func == 'select') {
		for ( var x=0; x<elems.length; x++ ) {
			elems[x].checked = true;
		}
	} else if ( func == 'deselect' ) {
		for ( var x=0; x<elems.length; x++ ) {
			elems[x].checked = false;
		}
	}
	
	return false;
}


function allAdmins(func)
{
	elems = document.getElementsByName('admins[]');
	
	if ( func == 'select') {
		for ( var x=0; x<elems.length; x++ ) {
			elems[x].checked = true;
		}
	} else if ( func == 'deselect' ) {
		for ( var x=0; x<elems.length; x++ ) {
			elems[x].checked = false;
		}
	}
	
	return false;
}

function allSubAdmins(func, dept_id)
{
	elems = document.getElementsByName('subadmins[]');
	
	if ( func == 'select') {
		for ( var x=0; x<elems.length; x++ ) {
			elems[x].checked = true;
		}
	} else if ( func == 'deselect' ) {
		for ( var x=0; x<elems.length; x++ ) {
			elems[x].checked = false;
		}
	}
	
	return false;
}

function chooseAction(action, dept_id)
{
	hideID('department_'+dept_id);
	
	switch ( action ) {
		case 'activate':
			did('form_'+dept_id).submit();
			break;
		case 'deactivate':
			var answer = confirm("Are you sure you want to deactivate the selected operator accounts?");
			if ( answer ) {
				did('form_'+dept_id).submit();
			} else {
				did('action_'+dept_id).selectedIndex = 0;
			}
			break;
		case 'transfer':
			showID('department_'+dept_id);
			break;
		case 'delete':
			var answer = confirm("Are you sure you want to delete the selected operator accounts?");
			if ( answer ) {
				did('form_'+dept_id).submit();
			} else {
				did('action_'+dept_id).selectedIndex = 0;
			}
			break;
	}
}

function chooseAdminAction(action,whichform)
{
	switch ( action ) {
		case 'activate':
			did(whichform).submit();
			break;
		case 'deactivate':
			var answer = confirm("Are you sure you want to deactivate the selected admin accounts?");
			if ( answer ) {
				did(whichform).submit();
			} else {
				did('action_'+whichform).selectedIndex = 0;
			}
			break;
		case 'delete':
			var answer = confirm("Are you sure you want to delete the selected admin accounts?");
			if ( answer ) {
				did(whichform).submit();
			} else {
				did('action_'+whichform).selectedIndex = 0;
			}
			break;
	}
}

function chooseDepartment(new_dept_id, dept_id)
{
	if ( new_dept_id != '' ) {
		var answer = confirm("Are you sure you want to transfer the selected operator accounts to the new department?");
		if ( answer ) {
			did('form_'+dept_id).submit();
		} else {
			did('action_'+dept_id).selectedIndex = 0;
			hideID('department_'+dept_id);
		}
	}
}

function moveOptionHoriz(from, to)
{
	var fromElement = did(from);
	var toElement = did(to);
	
	var selectOptions = new Array();
	var i;
	
	for ( i=0; i<fromElement.length; i++ ) {
		if ( fromElement.options[i].selected == true ) {
			selectOptions.push(i);
			newOption = new Option(fromElement.options[i].text, fromElement.options[i].value);
			toElement.options[toElement.options.length] = newOption;
		}
	}
	
	for ( i=selectOptions.length-1; i>=0; i-- ) {
		fromElement.remove(selectOptions[i]);
	}
}

function moveOptionVert(elem, direction)
{
	var elem = did(elem);
	var currPos;
	var newPos;
	
	if ( elem.selectedIndex != -1 ) {
		currPos = elem.selectedIndex;

		switch ( direction ) {
			case 'up':
				newPos = currPos - 1;
				
				if ( newPos < 0 ) {
					elem.selectedIndex = currPos;
					return false;
				}
				break;
			case 'down':
				newPos = currPos + 1;
				
				if ( newPos >= elem.length ) {
					elem.selectedIndex = currPos;
					return false;
				}
				break;
		}
		
		currOption = elem.options[currPos];
		oldOption = elem.options[newPos];
		
		newCurrOption = new Option(currOption.text, currOption.value);
		newOldOption = new Option(oldOption.text, oldOption.value);
		
		elem.options[currPos] = newOldOption;
		elem.options[newPos] = newCurrOption;
		
		elem.selectedIndex = newPos;
	}
}

function selectAll(form, element)
{
	try {
		if ( form.elements[element] ) {
			var myElement = form.elements[element];
			var count = myElement.options.length;
			
			for ( var i=0; i<count; i++ ) {
				myElement.options[i].selected = true;
			}
		}
	} catch (e) {
		return false;
	}
}

function checkAll(name)
{
	elems = document.getElementsByName(name);
	
	for ( var x=0; x<elems.length; x++ ) {
		elems[x].checked = true;
	}
	
	return false;
}

function uncheckAll(name)
{
	elems = document.getElementsByName(name);
	
	for ( var x=0; x<elems.length; x++ ) {
		elems[x].checked = false;
	}
	
	return false;
}

function passCheck() {
	var pass1 = did('pass1').value;
	var pass2 = did('pass2').value;
	
	var numPat = /\d/;
	var strPat = /([A-Za-z]+)/;
	
	if ( pass1 == '' ) {
		did('pass2').value = '';
		did('pass2').disabled = true;
		pass2 = '';
		
		if ( pass2 != '' ) {
			did('pass_error1').innerHTML = '&laquo; Your password must contain at least 8 characters';
			did('pass_error2').innerHTML = '';
		} else {
			did('pass_error1').innerHTML = '';
			did('pass_error2').innerHTML = '';
		}
	} else {
		if ( pass1.length < 8 ) {
			did('pass_error1').innerHTML = '&laquo; Your password must contain at least 8 characters';
			did('pass_error2').innerHTML = '';
			
			did('pass2').value = '';
			did('pass2').disabled = true;
			pass2 = '';
			
			return
		} else if ( !numPat.test(pass1) ) {
			did('pass_error1').innerHTML = '&laquo; Your password must contain at least 1 number';
			did('pass_error2').innerHTML = '';
			
			did('pass2').value = '';
			did('pass2').disabled = true;
			pass2 = '';
			
			return
		} else if ( !strPat.test(pass1) ) {
			did('pass_error1').innerHTML = '&laquo; Your password must contain at least 1 letter';
			did('pass_error2').innerHTML = '';
			
			did('pass2').value = '';
			did('pass2').disabled = true;
			pass2 = '';
			
			return
		}
		
		did('pass2').disabled = false;
		
		if ( pass2 != pass1 ) {
			did('pass_error1').innerHTML = '';
			did('pass_error2').innerHTML = '&laquo; Your passwords must match';
		} else {
			did('pass_error1').innerHTML = '';
			did('pass_error2').innerHTML = '';
		}
	}
}

/*
	Prototypes - Reserve the area below for prototype methods
*/

String.prototype.toProperCase = function()
{
	return this.toLowerCase().replace(/\w+/g,function(s){
		return s.charAt(0).toUpperCase() + s.substr(1);
	})
}

String.prototype.ltrim = function()
{
	return this.replace(/^\s*/, '');
}

String.prototype.rtrim = function()
{
	return this.replace(/\s*$/, '');
}

String.prototype.trim = function()
{
	return this.rtrim().ltrim();
}

String.prototype.addslashes = function()
{
	var str = this;
	
	str = str.replace(/\'/g,'\\\'');
	str = str.replace(/\"/g,'\\"');
	str = str.replace(/\\/g,'\\\\');
	str = str.replace(/\0/g,'\\0');
	
	return str;
}

String.prototype.stripslashes = function()
{
	var str = this;
	
	str = str.replace(/\\'/g,'\'');
	str = str.replace(/\\"/g,'"');
	str = str.replace(/\\\\/g,'\\');
	str = str.replace(/\\0/g,'\0');
	
	return str;
}

Array.prototype.find = function(targ)
{
	for(x in this) {
		if ( this[x] == targ ) {
			return x;
		}
	}
	return false;
}

Array.prototype.inArray = function(targ)
{
	if( this.find(targ) ) {
		return true;
	} else {
		return false;
	}
}

Array.prototype.remove = function(pos)
{
	if ( pos ) {
		this.splice(pos, 1);
	}
}
var debugMode = false;

function ActivaUpdater( uri, data, handlerFunc, postFunc, target )
{
	var toolkit 		= new nodeHelper();
	var uri 			= uri;
	var data 			= data;
	var handlerFunc 	= handlerFunc;
	var postFunc		= postFunc;
	var xmlBaseTag 		= "lu";
	
	if ( !target ) {
		var target = document;
	} else {
		var target = target;
	}
	
	function getRequester() 
	{	
		if ( window.XMLHttpRequest ) {
			return new XMLHttpRequest();
	
		} else if ( window.ActiveXObject ) {
			try {
				
				return new ActiveXObject( "Msxml2.XMLHTTP" );
				/*axo.preserveWhiteSpace = false;
				return axo;*/
	
			} catch ( error ) {
				try {
					return new ActiveXObject( "Microsoft.XMLHTTP" );
					/*axo.preserveWhiteSpace = false;
					return axo;*/
	
				} catch ( error2 ) {
					return false;
				}
			}
		}
	}
	
	
	function getReadyStateHandler( requester, xmlHandler ) 
	{
		return function () 
		{
			if ( requester.readyState == 4 ) {     
				if ( requester.status == 200 ) {
					try {
						var xml = requester.responseXML;        
						//xml.preserveWhiteSpace = false;
					} catch( e ) {
						if ( debugMode ) {
							alert (requester.responseText);  		
						}   
						
						return false;
					}						
					//alert (requester.responseText);
					xmlHandler( xml );
	
				} else {
					if ( debugMode == true ) {
						alert( "An error occurred: "+requester.status );
					}
				}
			}
		}
	}
	

	function makeXMLRequest() 
	{
		var requester = getRequester();
			
		var handlerFunction = getReadyStateHandler( requester, handleXML );
		
		requester.onreadystatechange = handlerFunction;
		
		requester.open( "POST", uri, true );
		requester.setRequestHeader( "Content-Type", "application/x-www-form-urlencoded" );		
		requester.send( "junk=1"+data );
	}
	
	
	function handleXML( xml )
	{		
		
		var body = xml.getElementsByTagName(xmlBaseTag);
		    
		if ( body.length > 0 ) {
			var nodes = body[0].childNodes;			
			for ( var i=0; i < nodes.length; i++ ) {
				
				if ( nodes[i].nodeType == 1 && nodes[i].getAttribute("id") != null ) {
					var id = nodes[i].getAttribute("id");
	          		
					if ( handlerFunc ) {
						handlerFunc( nodes[i], id );
							
					} else if ( nodes[i].nodeName == "select" ) {
						toolkit.handleSelect( nodes[i], id );
						
					} else if ( nodes[i].nodeName == "optionSelect" ) {
						toolkit.optionSelect( id, nodes[i].nodeType );
					
					} else if ( nodes[i].nodeName == "input" ) {
						toolkit.handleInput(id, nodes[i]);
						
					} else if ( document.all && nodes[i].nodeName == 'tr' ) {
						toolkit.handleTr( id, nodes[i] );
						
					} else {
						element = document.getElementById(id);
											
						if ( nodes[i].getAttribute("append") ) {
							if ( nodes[i].getAttribute("append") == "true" ) {
								// do nothing
							} else {
								while (element.firstChild) {
							  		element.removeChild(element.firstChild);
								}
							}
						} else if ( nodes[i].getAttribute("delete") ) {
							if ( nodes[i].getAttribute("delete") == "true" ) {
								element.parentNode.removeChild(element);
								return;
							}
						} else {

							if ( element ) {
								while (element.firstChild) {
							  		element.removeChild(element.firstChild);
								}
							}
						}
						
						toolkit.walk(nodes[i], element);
					}
					
				} else if ( nodes[i].nodeName == "script" ) {
					toolkit.handleScripts( nodes[i] );
				}	
			}
		}

		if ( postFunc ) {	
			postFunc();	
		}
	}
	
	makeXMLRequest();
}


function nodeHelper()
{	
	this.flatten = function( node )
	{
		var returnStr = "";
		
		if ( node.nodeType == 1 ) {
			switch ( node.nodeName ) {
				case "br":
					returnStr += "<br />";	
					break;
					
				case "img":
					returnStr += '<' + node.nodeName + this.flattenAttributes( node ) + ' />';
					break;
					
				case "input":
					returnStr += '<' + node.nodeName + this.flattenAttributes(node) + ' />';
					break;
					
				default:			
					returnStr += '<' + node.nodeName + this.flattenAttributes( node ) + '>';					
					returnStr += this.flattenChildren( node.childNodes );					
					returnStr += '</' + node.nodeName + '>';
					break;
			}
			
		} else if ( node.nodeType == 3 ) {
			returnStr += node.nodeValue;
		}
		
		return returnStr;
	}
	
	this.flattenChildren = function( nodes )
	{
		var buffer = '';
		
		if ( nodes.length > 0 ) {
			for ( var i=0; i < nodes.length; i++ ) {				
				buffer += this.flatten(nodes[i]);
			}
		}
		
		return buffer;
	}	
	
	this.flattenAttributes = function( node )
	{
		var buffer = "";
	  
		for ( var i=0; i < node.attributes.length; i++ ) {
			var attribute = node.attributes[i];
			buffer += ' '+attribute.name+'="'+attribute.value+'"'
		}
		
		return buffer;
	}
	
	this.copyAttributes = function( source, destination )
	{
		for ( var i=0; i < source.attributes.length; i++ ) {
			var attribute = source.attributes[i];
			destination.setAttribute( attribute.name, attribute.value );
		}
		
		destination.className = source.getAttribute('class');
	}
	
	this.handleTr = function( id, subtree )
	{
		var parentElement = document.getElementById( id );
		
		for ( var i=parentElement.childNodes.length-1; i >= 0; i-- ) {
			parentElement.removeChild( parentElement.childNodes[i] );
		}
	
		for ( var i=0; i < subtree.childNodes.length; i++ ) {
			var cell = document.createElement( subtree.childNodes[i].nodeName );
			
			copyAttributes( subtree.childNodes[i], cell );
			cell.innerHTML = urldecode( flattenChildren( subtree.childNodes[i].childNodes ) );
			parentElement.appendChild(cell);
		}
	}
	
	this.handleInput = function(id, node)
	{
		if ( document.getElementById(id) ) {
			if ( node.firstChild ) {
				document.getElementById(id).value = this.urldecode(node.firstChild.nodeValue);
			} else {
				document.getElementById(id).value = '';
			}
		}
	}
	
	this.handleSelect = function( node, id )
	{
		optNodes = node.getElementsByTagName( 'option' );
		targetBox = document.getElementById( id );
		targetBox.length = 0;
		
		if ( optNodes.length == 0 ) {
			var newOption = document.createElement( 'option' );

			targetBox.appendChild( newOption );
			newOption.value = "";
			newOption.text = "None found...";              		
			targetBox.disabled=true;
			
		} else {
			for ( var x=0; x < optNodes.length; x++ ) {
				var loadingOption = document.createElement( 'option' );

				targetBox.appendChild( loadingOption );
				loadingOption.value = this.urldecode( optNodes[x].getAttribute( "value" ) );
				loadingOption.text = this.urldecode( optNodes[x].firstChild.nodeValue );   
	
				targetBox.disabled=false;	 
			}
		}		
	}	
	
	this.handleScripts = function( node )
	{		
		if ( node.firstChild != null ) {
			var script = node.firstChild.nodeValue;
					
			if ( script != null ) {
				scriptArr = script.split( ";" );
				for ( var i=0; i < scriptArr.length - 1; i++ ) {
					eval( scriptArr[i]+";" );
				}
			}
		}

	}

	this.urlencode = function( str ) 
	{
		return escape( str ).replace( /[+]/g, '%2B' );
	}

 	this.urldecode = function( str ) 
 	{
		return unescape( str ).replace( /[+]/g, ' ' );
	}
	
	this.optionSelect = function( id, value )
	{
		var box = document.getElementById( id );
		var boxSize = box.options.length;
		
		for ( var i=0; i < boxSize; i++ ) {
			if (  box.options[i].value == value ) {
				box.options[i].selected = true;
			}
		}
	}
	

	this.compressData = function( field, value ) 
	{
		return "&"+field+"="+this.urlencode( value );
	}
	
	this.walk = function(node, element)
	{
		var nodes = node.childNodes;
		
		for ( var i=0; i < nodes.length; i++ ) {
			if ( nodes[i].nodeType != 3 ) {
				if ( nodes[i].nodeName == "a" ) {
					var attribs = "";
					for ( var j=0; j < nodes[i].attributes.length; j++ ) {
						attribs += " "+nodes[i].attributes[j].name+"='"+this.urldecode(nodes[i].attributes[j].value)+"'";
					}
					var ele = "<"+nodes[i].nodeName+attribs+"></"+nodes[i].nodeName+">";
					
					try {
						var newnode = document.createElement(ele);
						}
					catch ( err ) {
						var newnode = document.createElement(nodes[i].nodeName);
					}
				} else {
					var newnode = document.createElement(nodes[i].nodeName);
				}
				
				for ( var j=0; j < nodes[i].attributes.length; j++ ) {
					if ( nodes[i].attributes[j].name == 'class' ) {
						newnode.className = this.urldecode(nodes[i].attributes[j].value);
					} else if ( nodes[i].attributes[j].name == 'onchange' ) {
						newnode.onchange = this.urldecode(nodes[i].attributes[j].value);
					} else if ( nodes[i].attributes[j].name == 'colspan' ) {
						newnode.colSpan = this.urldecode(nodes[i].attributes[j].value);
					} else {
						newnode.setAttribute(nodes[i].attributes[j].name, this.urldecode(nodes[i].attributes[j].value));
					}
				}
				
				element.appendChild(newnode);
				
				/* For some reason, IE doesn't respect the checked attribute until
				   after you append the node, so the current workaround is to loop
				   through it at again and check it manually.
				 */
				if ( nodes[i].attributes ) {
					for ( var j=0; j < nodes[i].attributes.length; j++ ) {
						if ( nodes[i].attributes[j].name == 'onclick' && typeof(attachEvent) != 'undefined' && nodes[i].nodeName == 'img' ) {
							eval("var callback = function() { "+nodes[i].attributes[j].value+"};");
							newnode.attachEvent('onclick', callback)
							
						} else if ( nodes[i].attributes[j].name == 'checked' ) {
							newnode.checked = true;
						} else if ( nodes[i].attributes[j].name == 'style' ) {
							var parts = new String(this.urldecode(nodes[i].attributes[j].value)).split(';');
							
							for ( var n=0; n<parts.length; n++ ) {
								var vals = parts[n].split(':');
								
								if ( vals.length == 2 ) {
									eval('newnode.style.'+vals[0].replace("-", "_")+' = "'+trim(vals[1])+'";');
								}
							}
							
							/*for ( z in parts ) {
								console.log(z);
								var vals = z.split(':');
								console.log(vals);
								eval('newnode.style.'+z+' = "'+parts[z]+'";');
							}*/
							//newnode.style = this.urldecode(nodes[i].attributes[j].value);
						}
					}
				}
				
				if ( nodes[i].childNodes.length > 0 ) {
					if ( nodes[i].nodeName == 'table' ) {
						if ( nodes[i].childNodes.length > 0 ) {
							var hasTbody = false;
							for ( var n = 0; n < nodes[i].childNodes.length; n++ ) {
								if ( nodes[i].childNodes[n].nodeName == 'tbody' ) {
									hasTbody = true;
									
									break;
								}
							}
							
							if ( !hasTbody ) {
								var tbody = document.createElement('TBODY');
									
								newnode.appendChild(tbody);
								newnode = tbody;
							}
						}
					}
					this.walk(nodes[i], newnode);
				}
			} else {
				if ( element ) {
					var newnode = document.createTextNode(this.urldecode(nodes[i].nodeValue));
					element.appendChild(newnode);
				}
			}
		}
	}
}

nh = new nodeHelper();
/*
	@elem: Field to validate, required
	@message: Message to display upon failure, required
	@type: Method of validation to use, defaults to 'text'
	@match: What the field should match during certain types of validation, defaults to null
	@required: Whether a value is required or not, defaults to true
	@alert_type: inline or popup, defaults to false and uses ActivaValidate alert handling
	@message_box: Element to display message in for inline alerts, defaults to false
*/
function ActivaRule(elem, message, type, match, required, alert_type, message_box)
{
	this.elem = elem;
	this.dom_elem = null;
	this.message = message;
	this.type = type;
	this.match = match;
	this.required = required;
	this.alert_type = alert_type;
	this.message_box = message_box;
	
	this.validate = function() {
		this.dom_elem = domcheck(this.elem);
		
		if ( this.dom_elem.type != 'select-multiple' ) {
			// Begin by trimming the value
			this.dom_elem.value = this.trim(this.dom_elem.value);
		}
		
		if ( !this.required ) {
			if ( !this.dom_elem.value ) {
				return true;
			}
		}
		
		switch ( this.type ) {
			// Field must have any kind of value
			case "text":
				if ( this.dom_elem.type == 'radio' ) {
					var rgroup = document.getElementsByName(this.dom_elem.name);
					for ( var i=0; i<rgroup.length; i++ ) {
						if ( rgroup[i].checked ) {
							return true;
						}
					}
					return false;
				} else if ( !this.dom_elem.value ) {
					return false;
				}
				break;
			// Field must be checked
			case "checkbox":
				if ( !this.dom_elem.checked ) {
					return false;
				}
				break;
			// Field must match email regex
			case "email":
				var reg = /^[A-Za-z0-9._%+-]+@(?:[A-Za-z0-9-]+\.)+[A-Za-z]{2,4}$/;

				if ( !reg.test(this.dom_elem.value) ) {
					return false;
				}
				break;
			// Field must match phone regex
			case "phone":
				this.dom_elem.value = this.trim(this.dom_elem.value);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /\s/);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /-/);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /\(/);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /\)/);

				var reg = /^([\d]{10})$/;

				if ( !reg.test(this.dom_elem.value) ) {
					return false;
				}
				break;
			// Field must match intl phone regex
			case "intl_phone":
				this.dom_elem.value = this.trim(this.dom_elem.value);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /\s/);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /-/);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /\(/);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /\)/);
				
				var reg = /^((\+)?[\d]{10,16})$/;

				if ( !reg.test(this.dom_elem.value) ) {
					return false;
				}
				break;
			// Field must match US zip code regex
			case 'us_zip':
				this.dom_elem.value = this.trim(this.dom_elem.value);
				this.dom_elem.value = this.trimChar(this.dom_elem.value, /\s/);

				var reg = /^((\d){5})((-(\d){4}){1}$|$)/;

				if ( !reg.test(this.dom_elem.value) ) {
					return false;
				}
				break;
			// Field must match Canadian zip code regex
			case 'can_zip':
				this.dom_elem.value = this.trim(this.dom_elem.value);

				var reg = /^([A-Za-z0-9]{3})((\s|-){1})([A-Za-z0-9]{3})$/;

				if ( !reg.test(this.dom_elem.value) ) {
					return false;
				}
				break;
			// Field must be checked
			case "checkbox":
				if ( !this.dom_elem.checked ) {
					return false;
				}
				break;
			// Field must have at least one item in selectbox
			case 'transferbox':
				if ( this.dom_elem.options.length == 0 ) {
					return false;
				}
				break;
			// Field must contain an equal or lesser amount of characters
			case "shorter":
				if ( parseInt(this.dom_elem.value.length) > parseInt(this.match) ) {
					return false;
				}
				break;
			// Field must contain an equal or greater amount of characters
			case "longer":
				if ( parseInt(this.dom_elem.value.length) < parseInt(this.match) ) {
					return false;
				}
				break;
			// Field must contain amount of characters within valid range
			case "between":
				var ranges = this.match.split('-');
				var min = parseFloat(ranges[0]);
				var max = parseFloat(ranges[1]);
				
				if ( isNaN(parseFloat(this.dom_elem.value.length)) || parseFloat(this.dom_elem.value.length) > max || parseFloat(this.dom_elem.value.length) < min ) {
					return false;
				}
				break;
			// Field must match amount of characters
			case "length":
				if ( parseInt(this.dom_elem.value.length) != parseInt(this.match) ) {
					return false;
				}
				break;
			// Field must be less than or equal to requirement
			case "less":
				var max = parseFloat(this.match);
				
				if ( isNaN(parseFloat(this.dom_elem.value)) || parseFloat(this.dom_elem.value) > max ) {
					return false;
				}
				break;
			// Field must be greater than or equal to requirement
			case "greater":
				var min = parseFloat(this.match);
				
				if ( isNaN(parseFloat(this.dom_elem.value)) || parseFloat(this.dom_elem.value) < min ) {
					return false;
				}
				break;
			// Field must contain value within valid range
			case "range":
				var ranges = this.match.split('-');
				var min = parseFloat(ranges[0]);
				var max = parseFloat(ranges[1]);
				
				if ( isNaN(parseFloat(this.dom_elem.value)) || parseFloat(this.dom_elem.value) > max || parseFloat(this.dom_elem.value) < min ) {
					return false;
				}
				break;
			// Field must match passed regex
			case "match":
				if(this.dom_elem.type == 'radio'){
					var rgroup = document.getElementsByName(this.dom_elem.name);
					for(var i = 0; i < rgroup.length; i++){
						if(rgroup[i].checked && this.match == rgroup[i].value){ return true; }
					}
					return false;
				} else {
					if ( !this.match.test(this.dom_elem.value) ) {
						return false;
					}
				}
				break;
			// Field must match exactly
			case 'equals':
				if ( this.dom_elem.value != this.match ) {
					return false;
				}
				break;
				
			case 'notequal':
				if ( this.dom_elem.value == this.match ) {
					return false;
				}
				break;
		}
		
		return true;
	}
	
	// Must pass default ActivaValidate message box, in case rule does not have its own message box
	this.alert = function(message_box) {
		switch ( this.alert_type ) {
			case "inline":
				if ( this.message_box ) {
					this.message_box.innerHTML = this.message;
					this.message_box.style.display = '';
				} else {
					message_box.innerHTML = this.message;
					message_box.style.display = '';
				}
				break;
			case "popup":
			case "alert":
				alert(this.message);
				break;
		}
	}
	
	this.ltrim = function(string)
	{
		return string.replace(/^\s*/, '');
	}
	
	this.rtrim = function(string)
	{
		return string.replace(/\s*$/, '');
	}
	
	this.trim = function(string)
	{
		if ( typeof(string) == 'undefined' ) {
			return false;
		}
		return this.rtrim(this.ltrim(string));
	}
	
	this.trimChar = function(str, reg) {
		var reg = reg;
		while (reg.test(str)) {
			str = str.replace(reg, '');
		}
		
		return str;
	}
}

/*
	@form: ActivaForm that this applies to
	@elem: Field determining conditional outcome
	@matches: Array of possible values of elem
*/
function ActivaConditional(form, elem, matches, target)
{
	this.form = form;
	this.elem = elem;
	this.dom_elem = null;
	this.matches = matches;
	
	if ( typeof(target) == 'undefined' ) {
		this.target = 'id';
	} else {
		this.target = target;
	}
	
	this.rules = new Object();
	/*
		@match: Value in matches array that you want to assign this rule to
	*/
	this.addRule = function(condition, elem, message, type, match, required, alert_type, message_box) {
		if ( typeof(type) == 'undefined' ) {
			type = 'text';
		}
			
		if ( typeof(match) == 'undefined' ) {
			match = '';
		}
		
		if ( typeof(required) == 'undefined' ) {
			required = true;
		}
		
		if ( typeof(alert_type) == 'undefined' ) {
			alert_type = false;
		}
		
		if ( typeof(message_box) == 'undefined' ) {
			message_box = false;
		}
		
		var rule = new ActivaRule(elem, message, type, match, required, alert_type, message_box);
		
		if ( !this.rules[condition] ) {
			this.rules[condition] = new Array();
		}
		this.rules[condition].push(rule); 
	}
	
	this.validate = function(rules) {
		switch ( this.target ) {
			case 'id':
				this.dom_elem = domcheck(this.elem);
				var value = this.dom_elem.value;
				break;
			case 'radio':
				for ( var i=0; i<document.forms[this.form.form.id][this.elem].length; i++)  {
					if ( document.forms[this.form.form.id][this.elem][i].checked) {
						var value = document.forms[this.form.form.id][this.elem][i].value;
					}
				}
				break
		}
		
		if ( this.rules[value] ) {
			for ( var x=0; x<this.rules[value].length; x++ ) {
				if ( !this.rules[value][x].validate() ) {
					this.message = this.rules[value][x].message;
					this.dom_elem = this.rules[value][x].dom_elem;
					
					return false; 
				}
			}		
		}
		
		return true;
	}
	
	this.reset = function() {
		this.form.rules = new Array();
		this.form.rules = this.rules;
	}
}

/*
	@form: Form that will be validated
*/
function ActivaForm(form)
{
	this.form = form;
	this.rules = new Array();
	this.extra = new Array();
	this.active = true;
	
	// Manually add onload event so it can grab reference to DOM object, and not a string
	registerEvent(window, 'load', createDelegate(this, 'load'));

	this.load = function() {
		this.form = domcheck(this.form);
	}
	
	this.addRule = function(elem, message, type, match, required, alert_type, message_box) {
		if ( typeof(type) == 'undefined' ) {
			type = 'text';
		}
			
		if ( typeof(match) == 'undefined' ) {
			match = '';
		}
		
		if ( typeof(required) == 'undefined' ) {
			required = true;
		}
		
		if ( typeof(alert_type) == 'undefined' ) {
			alert_type = false;
		}
		
		if ( typeof(message_box) == 'undefined' ) {
			message_box = false;
		}
		
		var rule = new ActivaRule(elem, message, type, match, required, alert_type, message_box);
		this.rules.push(rule);
	}
	
	this.addConditional = function(elem, matches, target) {
		var conditional = new ActivaConditional(this, elem, matches, target);
		this.rules.push(conditional);
		
		return this.rules[this.rules.length-1];
	}
	
	this.addExtra = function(func) {
		this.extra.push(func);
	}
}

/*
	@form: ActivaForm, required
	@alert_type: Style of alerts, inline or popup, defaults to popup
	@message_box: Element to display message in for inline alerts, defaults to null
*/
function ActivaValidate(form, alert_type, message_box)
{
	this.form = form;
	
	if ( typeof(alert_type) == 'undefined' ) {
		alert_type = 'popup';
	}
		
	if ( typeof(message_box) == 'undefined' ) {
		message_box = false;
	} else {
		this.message_box = domcheck(message_box);
	}
	
	this.alert_type = alert_type;
	
	// Manually add onsubmit event so that form HTML does not require it
	registerEvent(this.form.form, 'submit', createDelegate(this, 'validate'));
	
	this.validate = function(e) {
		if ( !this.form.active ) {
			return true;
		}
		
		// Always reset message box to nothing
		if ( this.message_box ) {
			this.message_box.style.display = 'none';
			this.message_box.innerHTML = '';
		}
		
		// Validate rules
		for ( var i=0; i<this.form.rules.length; i++ ) {
			var rule = this.form.rules[i];
			
			if ( !rule.validate() ) {
				if ( rule.alert_type ) {
					// ActivaRule has override alert handling
					rule.alert(this.message_box);
				} else {
					// ActivaValidate is handling the alert
					switch ( this.alert_type ) {
						case "inline":
							this.message_box.innerHTML = rule.message;
							this.message_box.style.display = '';
							break;
						case "popup":
						case "alert":
							alert(rule.message);
							break;
					}
				}
				
				if ( typeof(rule.dom_elem) != 'undefined' && rule.dom_elem ) { 
					rule.dom_elem.focus();
				}
				
				// Prevents form from posting (required when you manually register onsubmit event)
				if ( e.preventDefault ) {
					e.preventDefault();
				}
				
				return false;
			}
		}
		
		// Validate extra functions
		for ( var i=0; i<this.form.extra.length; i++ ) {
			var result = this.form.extra[i].call();
			
			if ( !result ) {
				// Prevents form from posting (required when you manually register onsubmit event)
				if ( e.preventDefault ) {
					e.preventDefault();
				}
				
				return false;
			}
		}
		
		// Form has successfully validated
		return true;
	}
}
var currentEffects = new Array();

function Activa_FX(engine, target, duration, endCallback, startAt, endAt) {
		target = domcheck(target);
		if( currentEffects.inArray(target) ) {
			return;
		} else {
			currentEffects.push(target);
		}
		if ( typeof(endCallback) != 'undefined' ) {
			this.endCallback = endCallback;
		}
		if ( typeof(startAt) == 'undefined' ) {
			startAt = 0;
		}
		if ( typeof(endAt) == 'undefined' ) {
			endAt = 1;
		}
		
		this.startAt = startAt;
		this.endAt = endAt;
		
		this.resolution = 30;
		this.target = target;
		this.duration = typeof(duration) == 'undefined' ? 1000 : duration;
		this.start = new Date().getTime();
		this.end = this.start + this.duration;
		this.engine = this[engine];
		this.engine();
		
		this.timer = window.setTimeout(createDelegate(this, 'framecalc'), this.resolution);
	
	this.framecalc = function() {
			
		var time = new Date().getTime();
		if ( time > this.end ) {
			time = this.end;
		}
		this.engine.frame.call(this, startAt + ((time - this.start) / (this.end - this.start) * (endAt-startAt)) );
		if ( time < this.end ) {
			this.timer = window.setTimeout(createDelegate(this, 'framecalc'), this.resolution);
		} else {
			this.engine.end.call(this);
			currentEffects.remove(currentEffects.find(this.target));
			if ( typeof(this.endCallback) != 'undefined' ) {
				this.endCallback();
			}
		}
	}
}

Activa_FX.prototype.startRoll = function() {
	this.width = this.target.clientWidth;
	this._width = this.target.style.width;
	this.height = this.target.clientHeight;
	this._height = this.target.style.height;
	
	this._overflow = this.target.style.overflow;
	this.target.style.overflow = 'hidden';
	for(x=0; x<this.target.childNodes.length; x++) {
		if ( this.target.childNodes[x].nodeType == 1 ) {
			this.target.childNodes[x]._width = this.target.childNodes[x].style.width;
			if ( this.target.childNodes[x].clientWidth != 0 ) {
				this.target.childNodes[x].style.width = this.target.childNodes[x].clientWidth + 'px';
			}
		}
	}
	
}

Activa_FX.prototype.endRoll = function() {
	this.target.style.width = this._width;
	this.target.style.height = this._height;
	this.target.style.overflow = this._overflow;
	for(x=0; x<this.target.childNodes.length; x++) {
		if ( this.target.childNodes[x].nodeType == 1 && this.target.childNodes[x]._width) {
			this.target.childNodes[x].style.width = this.target.childNodes[x]._width;
		}
	}
	
	
}

Activa_FX.prototype.RollInLeft = function() {
	this.startRoll();
}

Activa_FX.prototype.RollInLeft.frame = function(scale) {
	this.target.style.width = Math.round(( (1 - scale) *  this.width)) + 'px';
}

Activa_FX.prototype.RollInLeft.end = function() {
	this.target.style.display = 'none';
	this.endRoll();
}

Activa_FX.prototype.RollUp = function() {
	this.startRoll();
}

Activa_FX.prototype.RollUp.frame = function(scale) {
	this.target.style.height = Math.round(( (1 - scale) *  this.height)) + 'px';
}

Activa_FX.prototype.RollUp.end = function() {
	this.target.style.display = 'none';
	this.endRoll();
}

Activa_FX.prototype.RollDown = function() {

	this.target.style.display = '';
	if ( this.startAt == 0 ) {
		this.target.style.height = '0px';
	}
	this.startRoll();
}

Activa_FX.prototype.RollDown.frame = function(scale) {
	this.target.style.height = Math.round(( scale * this._height)) + 'px';
}

Activa_FX.prototype.RollDown.end = function() {
	this.endRoll();
}

Activa_FX.prototype.FadeOut = function() {
	
}

Activa_FX.prototype.FadeOut.frame = function(scale) {
	this.target.style.opacity = 1 - scale;
	
	this.target.style.filter = 'alpha(opacity='+((1 - scale) * 100)+')';
}

Activa_FX.prototype.FadeOut.end = function() {
	this.target.style.display = 'none';
}

Activa_FX.prototype.FadeIn = function() {
	this.target.style.opacity = 0;
	this.target.style.filter = 'alpha(opacity=0)';
	this.target.style.display = '';
}

Activa_FX.prototype.FadeIn.frame = function(scale) {
	this.target.style.opacity = scale;
	this.target.style.filter = 'alpha(opacity='+(scale * 100)+')';
}

Activa_FX.prototype.FadeIn.end = function() {
	
}

function draggable(elem, handle) {
	this.elem = domcheck(elem);
	if ( typeof(handle) != 'undefined' ) {
		this.handle = domcheck(handle);
	} else {
		this.handle = domcheck(elem);
	}
	this.dragging = false;
	registerEvent(this.handle, 'mousedown', createDelegate(this, 'mousedown'));
	this.offsetLeft = 0;
	this.offsetTop = 0;
	
	this.mousedown = function(e) {
		this.offsetLeft = e.clientX - getX(this.elem);
		this.offsetTop = e.clientY - getY(this.elem) + 10;
		this.dragging = this.elem.cloneNode(true);
		this.dragging.style.position = 'absolute';
		this.dragging.style.top = (e.clientY - this.offsetTop)+'px';
		this.dragging.style.left = (e.clientX - this.offsetLeft)+'px';
		this.dragging.style.width = this.elem.clientWidth+'px';
		this.dragging.style.height = this.elem.clientHeight+'px';
		this.dragging.style.opacity = 0.5;
		this.elem.parentNode.appendChild(this.dragging);
		this.mousemovedelegate = createDelegate(this, 'mousemove');
		this.mouseupdelegate = createDelegate(this, 'mouseup');
		registerEvent(document, 'mousemove', this.mousemovedelegate);
		registerEvent(document, 'mouseup', this.mouseupdelegate);
		if ( e.preventDefault ) {
			e.preventDefault();
		}
		document.body.focus();
		if ( this.start ) {
			this.start();
		}
		return false;
	}
	
	this.mousemove = function(e) {
		this.dragging.style.top = (e.clientY-this.offsetTop)+'px';
		this.dragging.style.left = (e.clientX-this.offsetLeft)+'px';
		if ( this.moved ) {
			this.moved(e);
		}
	}
	
	this.mouseup = function(e) {
		if ( this.stop ) {
			this.stop();
		}
		unregisterEvent(document, 'mousemove', this.mousemovedelegate);
		unregisterEvent(document, 'mouseup', this.mouseupdelegate);
		this.dragging.parentNode.removeChild(this.dragging);
	}
	
}

function getX(elem) {
	if ( elem.offsetParent ) {
		return getX(elem.offsetParent) + elem.offsetLeft;
	} else {
		return elem.offsetLeft;
	}
}

function getY(elem) {
	if ( elem.offsetParent ) {
		return getY(elem.offsetParent) + elem.offsetTop;
	} else {
		return elem.offsetTop;
	}
}
// Correctly handle PNG transparency in Win IE 5.5 or higher.
// http://homepage.ntlworld.com/bobosola. Updated 31-May-2004

// *************************************************
// This extended version includes imagemap
// and input image functionality.
// It also requires a 1px transparent GIF
// *************************************************
var arVersion = navigator.appVersion.split("MSIE")
var version = parseFloat(arVersion[1])

function correctPNG() {
	if ((version >= 5.5) && (document.body.filters))
	{
		for(var i=0; i<document.images.length; i++)
		{
			var img = document.images[i]
			var imgName = img.src.toUpperCase()
			if (imgName.substring(imgName.length-3, imgName.length) == "PNG")
			{
				var imgID = (img.id) ? "id='" + img.id + "' " : ""
				var imgClass = (img.className) ? "class='" + img.className + "' " : ""
				var imgTitle = (img.title) ? "title='" + img.title + "' " : "title='" + img.alt + "' "
				var imgStyle = "display:inline-block;" + img.style.cssText
				if (img.align == "left") imgStyle = "float:left;" + imgStyle
				if (img.align == "right") imgStyle = "float:right;" + imgStyle
				if (img.parentElement.href) imgStyle = "cursor:hand;" + imgStyle
				var strNewHTML = "<span " + imgID + imgClass + imgTitle
				+ " style=\"" + "width:" + img.width + "px; height:" + img.height + "px;" + imgStyle + ";"
				+ "filter:progid:DXImageTransform.Microsoft.AlphaImageLoader"
				+ "(src=\'" + img.src + "\', sizingMethod='scale');\"></span>"
				img.outerHTML = strNewHTML
				i = i-1
			}
		}
	}
}


//-- Google Analytics Urchin Module
//-- Copyright 2005 Google, All Rights Reserved.

//-- Urchin On Demand Settings ONLY
var _uacct="";			// set up the Urchin Account
var _userv=1;			// service mode (0=local,1=remote,2=both)

//-- UTM User Settings
var _ufsc=1;			// set client info flag (1=on|0=off)
var _udn="auto";		// (auto|none|domain) set the domain name for cookies
var _uhash="on";		// (on|off) unique domain hash for cookies
var _utimeout="1800";   	// set the inactive session timeout in seconds
var _ugifpath="/__utm.gif";	// set the web path to the __utm.gif file
var _utsp="|";			// transaction field separator
var _uflash=1;			// set flash version detect option (1=on|0=off)
var _utitle=1;			// set the document title detect option (1=on|0=off)
var _ulink=0;			// enable linker functionality (1=on|0=off)
var _uanchor=0;			// enable use of anchors for campaign (1=on|0=off)
var _utcp="/";			// the cookie path for tracking
var _usample=100;		// The sampling % of visitors to track (1-100).

//-- UTM Campaign Tracking Settings
var _uctm=1;			// set campaign tracking module (1=on|0=off)
var _ucto="15768000";		// set timeout in seconds (6 month default)
var _uccn="utm_campaign";	// name
var _ucmd="utm_medium";		// medium (cpc|cpm|link|email|organic)
var _ucsr="utm_source";		// source
var _uctr="utm_term";		// term/keyword
var _ucct="utm_content";	// content
var _ucid="utm_id";		// id number
var _ucno="utm_nooverride";	// don't override

//-- Auto/Organic Sources and Keywords
var _uOsr=new Array();
var _uOkw=new Array();
_uOsr[0]="google";	_uOkw[0]="q";
_uOsr[1]="yahoo";	_uOkw[1]="p";
_uOsr[2]="msn";		_uOkw[2]="q";
_uOsr[3]="aol";		_uOkw[3]="query";
_uOsr[4]="aol";		_uOkw[4]="encquery";
_uOsr[5]="lycos";	_uOkw[5]="query";
_uOsr[6]="ask";		_uOkw[6]="q";
_uOsr[7]="altavista";	_uOkw[7]="q";
_uOsr[8]="search";	_uOkw[8]="q";
_uOsr[9]="netscape";	_uOkw[9]="s";
_uOsr[10]="cnn";	_uOkw[10]="query";
_uOsr[11]="looksmart";	_uOkw[11]="qt";
_uOsr[12]="about";	_uOkw[12]="terms";
_uOsr[13]="mamma";	_uOkw[13]="query";
_uOsr[14]="alltheweb";	_uOkw[14]="q";
_uOsr[15]="gigablast";	_uOkw[15]="q";
_uOsr[16]="voila";	_uOkw[16]="kw";
_uOsr[17]="virgilio";	_uOkw[17]="qs";
_uOsr[18]="live";	_uOkw[18]="q";
_uOsr[19]="baidu";	_uOkw[19]="wd";
_uOsr[20]="alice";	_uOkw[20]="qs";
_uOsr[21]="seznam";	_uOkw[21]="w";
_uOsr[22]="yandex";	_uOkw[22]="text";
_uOsr[23]="najdi";	_uOkw[23]="q";

//-- Auto/Organic Keywords to Ignore
var _uOno=new Array();
//_uOno[0]="urchin";
//_uOno[1]="urchin.com";
//_uOno[2]="www.urchin.com";

//-- Referral domains to Ignore
var _uRno=new Array();
//_uRno[0]=".urchin.com";

//-- **** Don't modify below this point ***
var _uff,_udh,_udt,_ubl=0,_udo="",_uu,_ufns=0,_uns=0,_ur="-",_ufno=0,_ust=0,_ubd=document,_udl=_ubd.location,_udlh="",_uwv="1";
var _ugifpath2="http://www.google-analytics.com/__utm.gif";
if (_udl.hash) _udlh=_udl.href.substring(_udl.href.indexOf('#'));
if (_udl.protocol=="https:") _ugifpath2="https://ssl.google-analytics.com/__utm.gif";
if (!_utcp || _utcp=="") _utcp="/";
function urchinTracker(page) {
 if (_udl.protocol=="file:") return;
 if (_uff && (!page || page=="")) return;
 var a,b,c,xx,v,z,k,x="",s="",f=0;
 var nx=" expires=Sun, 18 Jan 2038 00:00:00 GMT;";
 var dc=_ubd.cookie;
 _udh=_uDomain();
 if (!_uVG()) return;
 _uu=Math.round(Math.random()*2147483647);
 _udt=new Date();
 _ust=Math.round(_udt.getTime()/1000);
 a=dc.indexOf("__utma="+_udh);
 b=dc.indexOf("__utmb="+_udh);
 c=dc.indexOf("__utmc="+_udh);
 if (_udn && _udn!="") { _udo=" domain="+_udn+";"; }
 if (_utimeout && _utimeout!="") {
  x=new Date(_udt.getTime()+(_utimeout*1000));
  x=" expires="+x.toGMTString()+";";
 }
 if (_ulink) {
  if (_uanchor && _udlh && _udlh!="") s=_udlh+"&";
  s+=_udl.search;
  if(s && s!="" && s.indexOf("__utma=")>=0) {
   if (!(_uIN(a=_uGC(s,"__utma=","&")))) a="-";
   if (!(_uIN(b=_uGC(s,"__utmb=","&")))) b="-";
   if (!(_uIN(c=_uGC(s,"__utmc=","&")))) c="-";
   v=_uGC(s,"__utmv=","&");
   z=_uGC(s,"__utmz=","&");
   k=_uGC(s,"__utmk=","&");
   xx=_uGC(s,"__utmx=","&");
   if ((k*1) != ((_uHash(a+b+c+xx+z+v)*1)+(_udh*1))) {_ubl=1;a="-";b="-";c="-";xx="-";z="-";v="-";}
   if (a!="-" && b!="-" && c!="-") f=1;
   else if(a!="-") f=2;
  }
 }
 if(f==1) {
  _ubd.cookie="__utma="+a+"; path="+_utcp+";"+nx+_udo;
  _ubd.cookie="__utmb="+b+"; path="+_utcp+";"+x+_udo;
  _ubd.cookie="__utmc="+c+"; path="+_utcp+";"+_udo;
 } else if (f==2) {
  a=_uFixA(s,"&",_ust);
  _ubd.cookie="__utma="+a+"; path="+_utcp+";"+nx+_udo;
  _ubd.cookie="__utmb="+_udh+"; path="+_utcp+";"+x+_udo;
  _ubd.cookie="__utmc="+_udh+"; path="+_utcp+";"+_udo;
  _ufns=1;
 } else if (a>=0 && b>=0 && c>=0) {
  _ubd.cookie="__utmb="+_udh+"; path="+_utcp+";"+x+_udo;
 } else {
  if (a>=0) a=_uFixA(_ubd.cookie,";",_ust);
  else a=_udh+"."+_uu+"."+_ust+"."+_ust+"."+_ust+".1";
  _ubd.cookie="__utma="+a+"; path="+_utcp+";"+nx+_udo;
  _ubd.cookie="__utmb="+_udh+"; path="+_utcp+";"+x+_udo;
  _ubd.cookie="__utmc="+_udh+"; path="+_utcp+";"+_udo;
  _ufns=1;
 }
 if (_ulink && xx && xx!="" && xx!="-") {
   xx=_uUES(xx);
   if (xx.indexOf(";")==-1) _ubd.cookie="__utmx="+xx+"; path="+_utcp+";"+nx+_udo;
 }
 if (_ulink && v && v!="" && v!="-") {
  v=_uUES(v);
  if (v.indexOf(";")==-1) _ubd.cookie="__utmv="+v+"; path="+_utcp+";"+nx+_udo;
 }
 _uInfo(page);
 _ufns=0;
 _ufno=0;
 _uff=1;
}
function _uInfo(page) {
 var p,s="",dm="",pg=_udl.pathname+_udl.search;
 if (page && page!="") pg=_uES(page,1);
 _ur=_ubd.referrer;
 if (!_ur || _ur=="") { _ur="-"; }
 else {
  dm=_ubd.domain;
  if(_utcp && _utcp!="/") dm+=_utcp;
  p=_ur.indexOf(dm);
  if ((p>=0) && (p<=8)) { _ur="0"; }
  if (_ur.indexOf("[")==0 && _ur.lastIndexOf("]")==(_ur.length-1)) { _ur="-"; }
 }
 s+="&utmn="+_uu;
 if (_ufsc) s+=_uBInfo();
 if (_uctm) s+=_uCInfo();
 if (_utitle && _ubd.title && _ubd.title!="") s+="&utmdt="+_uES(_ubd.title);
 if (_udl.hostname && _udl.hostname!="") s+="&utmhn="+_uES(_udl.hostname);
 s+="&utmr="+_ur;
 s+="&utmp="+pg;
 if ((_userv==0 || _userv==2) && _uSP()) {
  var i=new Image(1,1);
  i.src=_ugifpath+"?"+"utmwv="+_uwv+s;
  i.onload=function() {_uVoid();}
 }
 if ((_userv==1 || _userv==2) && _uSP()) {
  var i2=new Image(1,1);
  i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();
  i2.onload=function() { _uVoid(); }
 }
 return;
}
function _uVoid() { return; }
function _uCInfo() {
 if (!_ucto || _ucto=="") { _ucto="15768000"; }
 if (!_uVG()) return;
 var c="",t="-",t2="-",t3="-",o=0,cs=0,cn=0,i=0,z="-",s="";
 if (_uanchor && _udlh && _udlh!="") s=_udlh+"&";
 s+=_udl.search;
 var x=new Date(_udt.getTime()+(_ucto*1000));
 var dc=_ubd.cookie;
 x=" expires="+x.toGMTString()+";";
 if (_ulink && !_ubl) {
  z=_uUES(_uGC(s,"__utmz=","&"));
  if (z!="-" && z.indexOf(";")==-1) { _ubd.cookie="__utmz="+z+"; path="+_utcp+";"+x+_udo; return ""; }
 }
 z=dc.indexOf("__utmz="+_udh);
 if (z>-1) { z=_uGC(dc,"__utmz="+_udh,";"); }
 else { z="-"; }
 t=_uGC(s,_ucid+"=","&");
 t2=_uGC(s,_ucsr+"=","&");
 t3=_uGC(s,"gclid=","&");
 if ((t!="-" && t!="") || (t2!="-" && t2!="") || (t3!="-" && t3!="")) {
  if (t!="-" && t!="") c+="utmcid="+_uEC(t);
  if (t2!="-" && t2!="") { if (c != "") c+="|"; c+="utmcsr="+_uEC(t2); }
  if (t3!="-" && t3!="") { if (c != "") c+="|"; c+="utmgclid="+_uEC(t3); }
  t=_uGC(s,_uccn+"=","&");
  if (t!="-" && t!="") c+="|utmccn="+_uEC(t);
  else c+="|utmccn=(not+set)";
  t=_uGC(s,_ucmd+"=","&");
  if (t!="-" && t!="") c+="|utmcmd="+_uEC(t);
  else  c+="|utmcmd=(not+set)";
  t=_uGC(s,_uctr+"=","&");
  if (t!="-" && t!="") c+="|utmctr="+_uEC(t);
  else { t=_uOrg(1); if (t!="-" && t!="") c+="|utmctr="+_uEC(t); }
  t=_uGC(s,_ucct+"=","&");
  if (t!="-" && t!="") c+="|utmcct="+_uEC(t);
  t=_uGC(s,_ucno+"=","&");
  if (t=="1") o=1;
  if (z!="-" && o==1) return "";
 }
 if (c=="-" || c=="") { c=_uOrg(); if (z!="-" && _ufno==1)  return ""; }
 if (c=="-" || c=="") { if (_ufns==1)  c=_uRef(); if (z!="-" && _ufno==1)  return ""; }
 if (c=="-" || c=="") {
  if (z=="-" && _ufns==1) { c="utmccn=(direct)|utmcsr=(direct)|utmcmd=(none)"; }
  if (c=="-" || c=="") return "";
 }
 if (z!="-") {
  i=z.indexOf(".");
  if (i>-1) i=z.indexOf(".",i+1);
  if (i>-1) i=z.indexOf(".",i+1);
  if (i>-1) i=z.indexOf(".",i+1);
  t=z.substring(i+1,z.length);
  if (t.toLowerCase()==c.toLowerCase()) cs=1;
  t=z.substring(0,i);
  if ((i=t.lastIndexOf(".")) > -1) {
   t=t.substring(i+1,t.length);
   cn=(t*1);
  }
 }
 if (cs==0 || _ufns==1) {
  t=_uGC(dc,"__utma="+_udh,";");
  if ((i=t.lastIndexOf(".")) > 9) {
   _uns=t.substring(i+1,t.length);
   _uns=(_uns*1);
  }
  cn++;
  if (_uns==0) _uns=1;
  _ubd.cookie="__utmz="+_udh+"."+_ust+"."+_uns+"."+cn+"."+c+"; path="+_utcp+"; "+x+_udo;
 }
 if (cs==0 || _ufns==1) return "&utmcn=1";
 else return "&utmcr=1";
}
function _uRef() {
 if (_ur=="0" || _ur=="" || _ur=="-") return "";
 var i=0,h,k,n;
 if ((i=_ur.indexOf("://"))<0) return "";
 h=_ur.substring(i+3,_ur.length);
 if (h.indexOf("/") > -1) {
  k=h.substring(h.indexOf("/"),h.length);
  if (k.indexOf("?") > -1) k=k.substring(0,k.indexOf("?"));
  h=h.substring(0,h.indexOf("/"));
 }
 h=h.toLowerCase();
 n=h;
 if ((i=n.indexOf(":")) > -1) n=n.substring(0,i);
 for (var ii=0;ii<_uRno.length;ii++) {
  if ((i=n.indexOf(_uRno[ii].toLowerCase())) > -1 && n.length==(i+_uRno[ii].length)) { _ufno=1; break; }
 }
 if (h.indexOf("www.")==0) h=h.substring(4,h.length);
 return "utmccn=(referral)|utmcsr="+_uEC(h)+"|"+"utmcct="+_uEC(k)+"|utmcmd=referral";
}
function _uOrg(t) {
 if (_ur=="0" || _ur=="" || _ur=="-") return "";
 var i=0,h,k;
 if ((i=_ur.indexOf("://")) < 0) return "";
 h=_ur.substring(i+3,_ur.length);
 if (h.indexOf("/") > -1) {
  h=h.substring(0,h.indexOf("/"));
 }
 for (var ii=0;ii<_uOsr.length;ii++) {
  if (h.toLowerCase().indexOf(_uOsr[ii].toLowerCase()) > -1) {
   if ((i=_ur.indexOf("?"+_uOkw[ii]+"=")) > -1 || (i=_ur.indexOf("&"+_uOkw[ii]+"=")) > -1) {
    k=_ur.substring(i+_uOkw[ii].length+2,_ur.length);
    if ((i=k.indexOf("&")) > -1) k=k.substring(0,i);
    for (var yy=0;yy<_uOno.length;yy++) {
     if (_uOno[yy].toLowerCase()==k.toLowerCase()) { _ufno=1; break; }
    }
    if (t) return _uEC(k);
    else return "utmccn=(organic)|utmcsr="+_uEC(_uOsr[ii])+"|"+"utmctr="+_uEC(k)+"|utmcmd=organic";
   }
  }
 }
 return "";
}
function _uBInfo() {
 var sr="-",sc="-",ul="-",fl="-",cs="-",je=1;
 var n=navigator;
 if (self.screen) {
  sr=screen.width+"x"+screen.height;
  sc=screen.colorDepth+"-bit";
 } else if (self.java) {
  var j=java.awt.Toolkit.getDefaultToolkit();
  var s=j.getScreenSize();
  sr=s.width+"x"+s.height;
 }
 if (n.language) { ul=n.language.toLowerCase(); }
 else if (n.browserLanguage) { ul=n.browserLanguage.toLowerCase(); }
 je=n.javaEnabled()?1:0;
 if (_uflash) fl=_uFlash();
 if (_ubd.characterSet) cs=_uES(_ubd.characterSet);
 else if (_ubd.charset) cs=_uES(_ubd.charset);
 return "&utmcs="+cs+"&utmsr="+sr+"&utmsc="+sc+"&utmul="+ul+"&utmje="+je+"&utmfl="+fl;
}
function __utmSetTrans() {
 var e;
 if (_ubd.getElementById) e=_ubd.getElementById("utmtrans");
 else if (_ubd.utmform && _ubd.utmform.utmtrans) e=_ubd.utmform.utmtrans;
 if (!e) return;
 var l=e.value.split("UTM:");
 var i,i2,c;
 if (_userv==0 || _userv==2) i=new Array();
 if (_userv==1 || _userv==2) { i2=new Array(); c=_uGCS(); }

 for (var ii=0;ii<l.length;ii++) {
  l[ii]=_uTrim(l[ii]);
  if (l[ii].charAt(0)!='T' && l[ii].charAt(0)!='I') continue;
  var r=Math.round(Math.random()*2147483647);
  if (!_utsp || _utsp=="") _utsp="|";
  var f=l[ii].split(_utsp),s="";
  if (f[0].charAt(0)=='T') {
   s="&utmt=tran"+"&utmn="+r;
   f[1]=_uTrim(f[1]); if(f[1]&&f[1]!="") s+="&utmtid="+_uES(f[1]);
   f[2]=_uTrim(f[2]); if(f[2]&&f[2]!="") s+="&utmtst="+_uES(f[2]);
   f[3]=_uTrim(f[3]); if(f[3]&&f[3]!="") s+="&utmtto="+_uES(f[3]);
   f[4]=_uTrim(f[4]); if(f[4]&&f[4]!="") s+="&utmttx="+_uES(f[4]);
   f[5]=_uTrim(f[5]); if(f[5]&&f[5]!="") s+="&utmtsp="+_uES(f[5]);
   f[6]=_uTrim(f[6]); if(f[6]&&f[6]!="") s+="&utmtci="+_uES(f[6]);
   f[7]=_uTrim(f[7]); if(f[7]&&f[7]!="") s+="&utmtrg="+_uES(f[7]);
   f[8]=_uTrim(f[8]); if(f[8]&&f[8]!="") s+="&utmtco="+_uES(f[8]);
  } else {
   s="&utmt=item"+"&utmn="+r;
   f[1]=_uTrim(f[1]); if(f[1]&&f[1]!="") s+="&utmtid="+_uES(f[1]);
   f[2]=_uTrim(f[2]); if(f[2]&&f[2]!="") s+="&utmipc="+_uES(f[2]);
   f[3]=_uTrim(f[3]); if(f[3]&&f[3]!="") s+="&utmipn="+_uES(f[3]);
   f[4]=_uTrim(f[4]); if(f[4]&&f[4]!="") s+="&utmiva="+_uES(f[4]);
   f[5]=_uTrim(f[5]); if(f[5]&&f[5]!="") s+="&utmipr="+_uES(f[5]);
   f[6]=_uTrim(f[6]); if(f[6]&&f[6]!="") s+="&utmiqt="+_uES(f[6]);
  }
  if ((_userv==0 || _userv==2) && _uSP()) {
   i[ii]=new Image(1,1);
   i[ii].src=_ugifpath+"?"+"utmwv="+_uwv+s;
   i[ii].onload=function() { _uVoid(); }
  }
  if ((_userv==1 || _userv==2) && _uSP()) {
   i2[ii]=new Image(1,1);
   i2[ii].src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+c;
   i2[ii].onload=function() { _uVoid(); }
  }
 }
 return;
}
function _uFlash() {
 var f="-",n=navigator;
 if (n.plugins && n.plugins.length) {
  for (var ii=0;ii<n.plugins.length;ii++) {
   if (n.plugins[ii].name.indexOf('Shockwave Flash')!=-1) {
    f=n.plugins[ii].description.split('Shockwave Flash ')[1];
    break;
   }
  }
 } else if (window.ActiveXObject) {
  for (var ii=10;ii>=2;ii--) {
   try {
    var fl=eval("new ActiveXObject('ShockwaveFlash.ShockwaveFlash."+ii+"');");
    if (fl) { f=ii + '.0'; break; }
   }
   catch(e) {}
  }
 }
 return f;
}
function __utmLinker(l,h) {
 if (!_ulink) return;
 var p,k,a="-",b="-",c="-",x="-",z="-",v="-";
 var dc=_ubd.cookie;
 if (!l || l=="") return;
 var iq = l.indexOf("?"); 
 var ih = l.indexOf("#"); 
 if (dc) {
  a=_uES(_uGC(dc,"__utma="+_udh,";"));
  b=_uES(_uGC(dc,"__utmb="+_udh,";"));
  c=_uES(_uGC(dc,"__utmc="+_udh,";"));
  x=_uES(_uGC(dc,"__utmx="+_udh,";"));
  z=_uES(_uGC(dc,"__utmz="+_udh,";"));
  v=_uES(_uGC(dc,"__utmv="+_udh,";"));
  k=(_uHash(a+b+c+x+z+v)*1)+(_udh*1);
  p="__utma="+a+"&__utmb="+b+"&__utmc="+c+"&__utmx="+x+"&__utmz="+z+"&__utmv="+v+"&__utmk="+k;
 }
 if (p) {
  if (h && ih>-1) return;
  if (h) { _udl.href=l+"#"+p; }
  else {
   if (iq==-1 && ih==-1) _udl.href=l+"?"+p;
   else if (ih==-1) _udl.href=l+"&"+p;
   else if (iq==-1) _udl.href=l.substring(0,ih-1)+"?"+p+l.substring(ih);
   else _udl.href=l.substring(0,ih-1)+"&"+p+l.substring(ih);
  }
 } else { _udl.href=l; }
}
function __utmLinkPost(f,h) {
 if (!_ulink) return;
 var p,k,a="-",b="-",c="-",x="-",z="-",v="-";
 var dc=_ubd.cookie;
 if (!f || !f.action) return;
 var iq = f.action.indexOf("?"); 
 var ih = f.action.indexOf("#"); 
 if (dc) {
  a=_uES(_uGC(dc,"__utma="+_udh,";"));
  b=_uES(_uGC(dc,"__utmb="+_udh,";"));
  c=_uES(_uGC(dc,"__utmc="+_udh,";"));
  x=_uES(_uGC(dc,"__utmx="+_udh,";"));
  z=_uES(_uGC(dc,"__utmz="+_udh,";"));
  v=_uES(_uGC(dc,"__utmv="+_udh,";"));
  k=(_uHash(a+b+c+x+z+v)*1)+(_udh*1);
  p="__utma="+a+"&__utmb="+b+"&__utmc="+c+"&__utmx="+x+"&__utmz="+z+"&__utmv="+v+"&__utmk="+k;
 }
 if (p) {
  if (h && ih>-1) return;
  if (h) { f.action+="#"+p; }
  else {
   if (iq==-1 && ih==-1) f.action+="?"+p;
   else if (ih==-1) f.action+="&"+p;
   else if (iq==-1) f.action=f.action.substring(0,ih-1)+"?"+p+f.action.substring(ih);
   else f.action=f.action.substring(0,ih-1)+"&"+p+f.action.substring(ih);
  }
 }
 return;
}
function __utmSetVar(v) {
 if (!v || v=="") return;
 if (!_udo || _udo == "") {
  _udh=_uDomain();
  if (_udn && _udn!="") { _udo=" domain="+_udn+";"; }
 }
 if (!_uVG()) return;
 var r=Math.round(Math.random() * 2147483647);
 _ubd.cookie="__utmv="+_udh+"."+_uES(v)+"; path="+_utcp+"; expires=Sun, 18 Jan 2038 00:00:00 GMT;"+_udo;
 var s="&utmt=var&utmn="+r;
 if ((_userv==0 || _userv==2) && _uSP()) {
  var i=new Image(1,1);
  i.src=_ugifpath+"?"+"utmwv="+_uwv+s;
  i.onload=function() { _uVoid(); }
 }
 if ((_userv==1 || _userv==2) && _uSP()) {
  var i2=new Image(1,1);
  i2.src=_ugifpath2+"?"+"utmwv="+_uwv+s+"&utmac="+_uacct+"&utmcc="+_uGCS();
  i2.onload=function() { _uVoid(); }
 }
}
function _uGCS() {
 var t,c="",dc=_ubd.cookie;
 if ((t=_uGC(dc,"__utma="+_udh,";"))!="-") c+=_uES("__utma="+t+";+");
 if ((t=_uGC(dc,"__utmb="+_udh,";"))!="-") c+=_uES("__utmb="+t+";+");
 if ((t=_uGC(dc,"__utmc="+_udh,";"))!="-") c+=_uES("__utmc="+t+";+");
 if ((t=_uGC(dc,"__utmx="+_udh,";"))!="-") c+=_uES("__utmx="+t+";+");
 if ((t=_uGC(dc,"__utmz="+_udh,";"))!="-") c+=_uES("__utmz="+t+";+");
 if ((t=_uGC(dc,"__utmv="+_udh,";"))!="-") c+=_uES("__utmv="+t+";");
 if (c.charAt(c.length-1)=="+") c=c.substring(0,c.length-1);
 return c;
}
function _uGC(l,n,s) {
 if (!l || l=="" || !n || n=="" || !s || s=="") return "-";
 var i,i2,i3,c="-";
 i=l.indexOf(n);
 i3=n.indexOf("=")+1;
 if (i > -1) {
  i2=l.indexOf(s,i); if (i2 < 0) { i2=l.length; }
  c=l.substring((i+i3),i2);
 }
 return c;
}
function _uDomain() {
 if (!_udn || _udn=="" || _udn=="none") { _udn=""; return 1; }
 if (_udn=="auto") {
  var d=_ubd.domain;
  if (d.substring(0,4)=="www.") {
   d=d.substring(4,d.length);
  }
  _udn=d;
 }
 if (_uhash=="off") return 1;
 return _uHash(_udn);
}
function _uHash(d) {
 if (!d || d=="") return 1;
 var h=0,g=0;
 for (var i=d.length-1;i>=0;i--) {
  var c=parseInt(d.charCodeAt(i));
  h=((h << 6) & 0xfffffff) + c + (c << 14);
  if ((g=h & 0xfe00000)!=0) h=(h ^ (g >> 21));
 }
 return h;
}
function _uFixA(c,s,t) {
 if (!c || c=="" || !s || s=="" || !t || t=="") return "-";
 var a=_uGC(c,"__utma="+_udh,s);
 var lt=0,i=0;
 if ((i=a.lastIndexOf(".")) > 9) {
  _uns=a.substring(i+1,a.length);
  _uns=(_uns*1)+1;
  a=a.substring(0,i);
  if ((i=a.lastIndexOf(".")) > 7) {
   lt=a.substring(i+1,a.length);
   a=a.substring(0,i);
  }
  if ((i=a.lastIndexOf(".")) > 5) {
   a=a.substring(0,i);
  }
  a+="."+lt+"."+t+"."+_uns;
 }
 return a;
}
function _uTrim(s) {
  if (!s || s=="") return "";
  while ((s.charAt(0)==' ') || (s.charAt(0)=='\n') || (s.charAt(0,1)=='\r')) s=s.substring(1,s.length);
  while ((s.charAt(s.length-1)==' ') || (s.charAt(s.length-1)=='\n') || (s.charAt(s.length-1)=='\r')) s=s.substring(0,s.length-1);
  return s;
}
function _uEC(s) {
  var n="";
  if (!s || s=="") return "";
  for (var i=0;i<s.length;i++) {if (s.charAt(i)==" ") n+="+"; else n+=s.charAt(i);}
  return n;
}
function __utmVisitorCode(f) {
 var r=0,t=0,i=0,i2=0,m=31;
 var a=_uGC(_ubd.cookie,"__utma="+_udh,";");
 if ((i=a.indexOf(".",0))<0) return;
 if ((i2=a.indexOf(".",i+1))>0) r=a.substring(i+1,i2); else return "";  
 if ((i=a.indexOf(".",i2+1))>0) t=a.substring(i2+1,i); else return "";  
 if (f) {
  return r;
 } else {
  var c=new Array('A','B','C','D','E','F','G','H','J','K','L','M','N','P','R','S','T','U','V','W','X','Y','Z','1','2','3','4','5','6','7','8','9');
  return c[r>>28&m]+c[r>>23&m]+c[r>>18&m]+c[r>>13&m]+"-"+c[r>>8&m]+c[r>>3&m]+c[((r&7)<<2)+(t>>30&3)]+c[t>>25&m]+c[t>>20&m]+"-"+c[t>>15&m]+c[t>>10&m]+c[t>>5&m]+c[t&m];
 }
}
function _uIN(n) {
 if (!n) return false;
 for (var i=0;i<n.length;i++) {
  var c=n.charAt(i);
  if ((c<"0" || c>"9") && (c!=".")) return false;
 }
 return true;
}
function _uES(s,u) {
 if (typeof(encodeURIComponent) == 'function') {
  if (u) return encodeURI(s);
  else return encodeURIComponent(s);
 } else {
  return escape(s);
 }
}
function _uUES(s) {
 if (typeof(decodeURIComponent) == 'function') {
  return decodeURIComponent(s);
 } else {
  return unescape(s);
 }
}
function _uVG() {
 if((_udn.indexOf("www.google.") == 0 || _udn.indexOf(".google.") == 0 || _udn.indexOf("google.") == 0) && _utcp=='/') {
  return false;
 }
 return true;
}
function _uSP() {
 var s=100;
 if (_usample) s=_usample;
 if(s>=100 || s<=0) return true;
 return ((__utmVisitorCode(1)%10000)<(s*100));
}
function urchinPathCopy(p){
 var d=document,nx,tx,sx,i,c,cs,t,h,o;
 cs=new Array("a","b","c","v","x","z");
 h=_uDomain(); if (_udn && _udn!="") o=" domain="+_udn+";";
 nx="Sun, 18 Jan 2038 00:00:00 GMT;";
 tx=new Date(); tx.setTime(tx.getTime()+(_utimeout*1000));
 tx=tx.toGMTString()+";";
 sx=new Date(); sx.setTime(sx.getTime()+(_ucto*1000));
 sx=sx.toGMTString()+";";
 for (i=0;i<6;i++){
  t=" expires=";
  if (i==1) t+=tx; else if (i==2) t=""; else if (i==5) t+=sx; else t+=nx;
  c=_uGC(d.cookie,"__utm"+cs[i]+"="+h,";");
  if (c!="-") d.cookie="__utm"+cs[i]+"="+c+"; path="+p+";"+t+o;
 }
}
function _uCO() {
 if (!_utk || _utk=="" || _utk.length<10) return;
 _ubd.cookie="GASO="+_utk+"; path="+_utcp+";"+_udo;
 var sc=document.createElement('script');
 sc.type='text/javascript';
 sc.id="_gasojs";
 sc.src='https://www.google.com/analytics/reporting/overlay_js?gaso='+_utk+'&'+Math.random();
 document.getElementsByTagName('head')[0].appendChild(sc);  
}
function _uGT() {
 var h=location.hash, a;
 if (h && h!="" && h.indexOf("#gaso=")==0) {
  a=_uGC(h,"gaso=","&");
 } else {
  a=_uGC(_ubd.cookie,"GASO=",";");
 }
 return a;
}
var _utk=_uGT();
if (_utk && _utk!="" && _utk.length>10) {
 if (window.addEventListener) {
  window.addEventListener('load', _uCO, false); 
 } else if (window.attachEvent) { 
  window.attachEvent('onload', _uCO);
 }
}

//v1.7
// Flash Player Version Detection
// Detect Client Browser type
// Copyright 2005-2007 Adobe Systems Incorporated.  All rights reserved.
var isIE  = (navigator.appVersion.indexOf("MSIE") != -1) ? true : false;
var isWin = (navigator.appVersion.toLowerCase().indexOf("win") != -1) ? true : false;
var isOpera = (navigator.userAgent.indexOf("Opera") != -1) ? true : false;

function ControlVersion()
{
	var version;
	var axo;
	var e;

	// NOTE : new ActiveXObject(strFoo) throws an exception if strFoo isn't in the registry

	try {
		// version will be set for 7.X or greater players
		axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		version = axo.GetVariable("$version");
	} catch (e) {
	}

	if (!version)
	{
		try {
			// version will be set for 6.X players only
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
			
			// installed player is some revision of 6.0
			// GetVariable("$version") crashes for versions 6.0.22 through 6.0.29,
			// so we have to be careful. 
			
			// default to the first public version
			version = "WIN 6,0,21,0";

			// throws if AllowScripAccess does not exist (introduced in 6.0r47)		
			axo.AllowScriptAccess = "always";

			// safe to call for 6.0r47 or greater
			version = axo.GetVariable("$version");

		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 4.X or 5.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = axo.GetVariable("$version");
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 3.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.3");
			version = "WIN 3,0,18,0";
		} catch (e) {
		}
	}

	if (!version)
	{
		try {
			// version will be set for 2.X player
			axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			version = "WIN 2,0,0,11";
		} catch (e) {
			version = -1;
		}
	}
	
	return version;
}

// JavaScript helper required to detect Flash Player PlugIn version information
function GetSwfVer(){
	// NS/Opera version >= 3 check for Flash plugin in plugin array
	var flashVer = -1;
	
	if (navigator.plugins != null && navigator.plugins.length > 0) {
		if (navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]) {
			var swVer2 = navigator.plugins["Shockwave Flash 2.0"] ? " 2.0" : "";
			var flashDescription = navigator.plugins["Shockwave Flash" + swVer2].description;
			var descArray = flashDescription.split(" ");
			var tempArrayMajor = descArray[2].split(".");			
			var versionMajor = tempArrayMajor[0];
			var versionMinor = tempArrayMajor[1];
			var versionRevision = descArray[3];
			if (versionRevision == "") {
				versionRevision = descArray[4];
			}
			if (versionRevision[0] == "d") {
				versionRevision = versionRevision.substring(1);
			} else if (versionRevision[0] == "r") {
				versionRevision = versionRevision.substring(1);
				if (versionRevision.indexOf("d") > 0) {
					versionRevision = versionRevision.substring(0, versionRevision.indexOf("d"));
				}
			}
			var flashVer = versionMajor + "." + versionMinor + "." + versionRevision;
		}
	}
	// MSN/WebTV 2.6 supports Flash 4
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.6") != -1) flashVer = 4;
	// WebTV 2.5 supports Flash 3
	else if (navigator.userAgent.toLowerCase().indexOf("webtv/2.5") != -1) flashVer = 3;
	// older WebTV supports Flash 2
	else if (navigator.userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 2;
	else if ( isIE && isWin && !isOpera ) {
		flashVer = ControlVersion();
	}	
	return flashVer;
}

// When called with reqMajorVer, reqMinorVer, reqRevision returns true if that version or greater is available
function DetectFlashVer(reqMajorVer, reqMinorVer, reqRevision)
{
	versionStr = GetSwfVer();
	if (versionStr == -1 ) {
		return false;
	} else if (versionStr != 0) {
		if(isIE && isWin && !isOpera) {
			// Given "WIN 2,0,0,11"
			tempArray         = versionStr.split(" "); 	// ["WIN", "2,0,0,11"]
			tempString        = tempArray[1];			// "2,0,0,11"
			versionArray      = tempString.split(",");	// ['2', '0', '0', '11']
		} else {
			versionArray      = versionStr.split(".");
		}
		var versionMajor      = versionArray[0];
		var versionMinor      = versionArray[1];
		var versionRevision   = versionArray[2];

        	// is the major.revision >= requested major.revision AND the minor version >= requested minor
		if (versionMajor > parseFloat(reqMajorVer)) {
			return true;
		} else if (versionMajor == parseFloat(reqMajorVer)) {
			if (versionMinor > parseFloat(reqMinorVer))
				return true;
			else if (versionMinor == parseFloat(reqMinorVer)) {
				if (versionRevision >= parseFloat(reqRevision))
					return true;
			}
		}
		return false;
	}
}

function AC_AddExtension(src, ext)
{
  if (src.indexOf('?') != -1)
    return src.replace(/\?/, ext+'?'); 
  else
    return src + ext;
}

function AC_Generateobj(objAttrs, params, embedAttrs) 
{ 
  var str = '';
  if (isIE && isWin && !isOpera)
  {
    str += '<object ';
    for (var i in objAttrs)
    {
      str += i + '="' + objAttrs[i] + '" ';
    }
    str += '>';
    for (var i in params)
    {
      str += '<param name="' + i + '" value="' + params[i] + '" /> ';
    }
    str += '</object>';
  }
  else
  {
    str += '<embed ';
    for (var i in embedAttrs)
    {
      str += i + '="' + embedAttrs[i] + '" ';
    }
    str += '> </embed>';
  }

  document.write(str);
}

function AC_FL_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".swf", "movie", "clsid:d27cdb6e-ae6d-11cf-96b8-444553540000"
     , "application/x-shockwave-flash"
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_SW_RunContent(){
  var ret = 
    AC_GetArgs
    (  arguments, ".dcr", "src", "clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
     , null
    );
  AC_Generateobj(ret.objAttrs, ret.params, ret.embedAttrs);
}

function AC_GetArgs(args, ext, srcParamName, classid, mimeType){
  var ret = new Object();
  ret.embedAttrs = new Object();
  ret.params = new Object();
  ret.objAttrs = new Object();
  for (var i=0; i < args.length; i=i+2){
    var currArg = args[i].toLowerCase();    

    switch (currArg){	
      case "classid":
        break;
      case "pluginspage":
        ret.embedAttrs[args[i]] = args[i+1];
        break;
      case "src":
      case "movie":	
        args[i+1] = AC_AddExtension(args[i+1], ext);
        ret.embedAttrs["src"] = args[i+1];
        ret.params[srcParamName] = args[i+1];
        break;
      case "onafterupdate":
      case "onbeforeupdate":
      case "onblur":
      case "oncellchange":
      case "onclick":
      case "ondblclick":
      case "ondrag":
      case "ondragend":
      case "ondragenter":
      case "ondragleave":
      case "ondragover":
      case "ondrop":
      case "onfinish":
      case "onfocus":
      case "onhelp":
      case "onmousedown":
      case "onmouseup":
      case "onmouseover":
      case "onmousemove":
      case "onmouseout":
      case "onkeypress":
      case "onkeydown":
      case "onkeyup":
      case "onload":
      case "onlosecapture":
      case "onpropertychange":
      case "onreadystatechange":
      case "onrowsdelete":
      case "onrowenter":
      case "onrowexit":
      case "onrowsinserted":
      case "onstart":
      case "onscroll":
      case "onbeforeeditfocus":
      case "onactivate":
      case "onbeforedeactivate":
      case "ondeactivate":
      case "type":
      case "codebase":
      case "id":
        ret.objAttrs[args[i]] = args[i+1];
        break;
      case "width":
      case "height":
      case "align":
      case "vspace": 
      case "hspace":
      case "class":
      case "title":
      case "accesskey":
      case "name":
      case "tabindex":
        ret.embedAttrs[args[i]] = ret.objAttrs[args[i]] = args[i+1];
        break;
      default:
        ret.embedAttrs[args[i]] = ret.params[args[i]] = args[i+1];
    }
  }
  ret.objAttrs["classid"] = classid;
  if (mimeType) ret.embedAttrs["type"] = mimeType;
  return ret;
}
