// JavaScript Document
/*global alert, document, self, window*/

/*
 * $RCSfile: XmlHttp.js,v $
 *
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2005 Bharat Mediratta
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

function GetXmlHttp() {
    var xmlHttp = null;
    try {
		xmlHttp = new XMLHttpRequest();
    } catch (e) {
		try {
			xmlHttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e) {
	    	try {
		    	xmlHttp = new ActiveXObject("Microsoft.XMLHTTP");
	    	} catch (e) {
				xmlHttp = false;
	    	}
		}
    }

    if (!xmlHttp && typeof XMLHttpRequest != 'undefined') {
		xmlHttp = new XMLHttpRequest();
    }

    return xmlHttp;
}

function SendHttpPost(xmlHttp, url, args, callback) {
    xmlHttp.open("POST", url, /* async */ true);
    xmlHttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
    xmlHttp.onreadystatechange = function() { callback(xmlHttp); }
    xmlHttp.send(args);
}

function SendHttpGet(xmlHttp, url, callback) {
	try {
		xmlHttp.open("GET", url, /* async */ true);
    } catch (e) {
    }
    xmlHttp.onreadystatechange = function() { callback(xmlHttp); }
    xmlHttp.send("FOO");
}
/*** end xmlHTTP.js**/
/*
 * $RCSfile: AutoComplete.js,v $
 *
 * Gallery - a web based photo album viewer and editor
 * Copyright (C) 2000-2005 Bharat Mediratta
 * 
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU General Public License as published by
 * the Free Software Foundation; either version 2 of the License, or (at
 * your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful, but
 * WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 * General Public License for more details.
 * 
 * You should have received a copy of the GNU General Public License
 * along with this program; if not, write to the Free Software
 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA  02111-1307, USA.
 */

/*
 * Inspired by code from:
 * - Guyon Roche (http://www.webreference.com/programming/javascript/gr/column5/)
 * - Zichun (http://codeproject.com/jscript/jsactb.asp)
 */

var autoCompleteContexts = new Array();
var immediateSubmit = true;
var g_PopupIFrame;

function isIE()
{
	return ( navigator.appName=="Microsoft Internet Explorer" );
}

function hidePopupDiv(divPopup)
{
	divPopup.style.visibility = "hidden";

    if (isIE() && g_PopupIFrame != null)
    {
	    document.body.removeChild(g_PopupIFrame);
        g_PopupIFrame = null;
    }
}

function showPopupDiv(divPopup)
{
    if (!isIE())
    {
    	//Just display the div
        divPopup.style.visibility = "visible";
        return;
    }

    //Increase default zIndex of div by 1, so that DIV appears before IFrame
    divPopup.style.zIndex = divPopup.style.zIndex+1;

    var iFrame = document.createElement("IFRAME");
    iFrame.setAttribute("src", "");

    //Match IFrame position with divPopup
    iFrame.style.position = "absolute";
    iFrame.style.left = divPopup.offsetLeft + 'px';
    iFrame.style.top = divPopup.offsetTop + 'px';
    iFrame.style.width = divPopup.offsetWidth + 'px';
    iFrame.style.height = divPopup.offsetHeight + 'px';

    document.body.appendChild(iFrame);

    //Store iFrame in global variable, so it can get removed when divPopup is hidden 
    if (g_PopupIFrame != null)
	{
		document.body.removeChild(g_PopupIFrame);
    }
    g_PopupIFrame = iFrame;
    divPopup.style.visibility = "visible";
}

String.prototype.trim = function () {
    return this.replace(/^\s*/, "").replace(/\s*$/, "");
}

function autoCompleteTrigger(id) 
{
    var responseCallback = function(response) {
		if (response.readyState != 4) {
		    return;
		}
	
		if (response.responseText.trim().length > 0) {
			results = response.responseText.split("\n");
			autoCompleteContexts[id]['results'] = new Array();
			for (i = 0; i < results.length; i++) {
			    autoCompleteContexts[id]['results'][i] = results[i];
			}
			autoCompleteRender(id);
		}
		else
		{
		    autoCompleteContexts[id]['results'] = new Array();
		    autoCompleteHide(id);
	    }
    }

    if (document.getElementById(id).value.trim().length > 0) {
    	var url = autoCompleteContexts[id]['url'].replace(
    	    /__VALUE__/,
    	    escape(document.getElementById(id).value));
    	// encodeURI(document.getElementById(id).value));
    	SendHttpGet(autoCompleteContexts[id]['connection'], url, responseCallback);
    	//autoCompleteContexts[id]['results'] = new Array();
		//for (i = 0; i < 10; i++) {
		//  autoCompleteContexts[id]['results'][i] = "Accountancy BA Honours Degree "+i;
		//}
		autoCompleteRender(id);

    }
    else
    {
    	autoCompleteContexts[id]['results'] = new Array();
    	autoCompleteHide(id);
    }
}

function autoCompleteGetLeft(element)
{
    var offset = 0;
    while (element) {
		offset += element.offsetLeft;
		element = element.offsetParent;
    }
    return offset;
}

function autoCompleteGetTop(element)
{
    var offset = 0;
    while (element) {
		offset += element.offsetTop;
		element = element.offsetParent;
    }
    return offset;
}

function autoCompleteIsVisible(id)
{
    var autoCompleteId = id + '_autocomplete';
    var ac = document.getElementById(autoCompleteId);
    if (!ac) {
		return false;
    }
    return ac.style.visibility == 'visible';
}

function autoCompleteRender(id)
{
    var autoCompleteId = id + '_autocomplete';
    var source = document.getElementById(id);
    var ac = document.getElementById(autoCompleteId);
    if (!ac) {
		ac = document.createElement('div');
		ac.className = 'autoCompleteBackground';
		ac.style.position = 'absolute';
    	ac.style.zIndex = 2000;
		ac.id = autoCompleteId;
		document.body.appendChild(ac);
    }
    ac.style.top = eval(autoCompleteGetTop(source) + source.offsetHeight) + 'px';
    ac.style.left = autoCompleteGetLeft(source) + 'px';

    var matches = autoCompleteFindMatches(source.value, autoCompleteContexts[id]['results']);

    // Windows gives us backslashes in the path which break the regex, so escape them.
    escapedValue = source.value.replace(/\\([^u])/g, '\\\\$1');
    var regexp = new RegExp("("+escapedValue+")", "i");
    if (matches.length > 0) {
		for (i = 0; i < Math.min(matches.length, 15); i++) {
		    var row;
		    var newHTML = 
			matches[i].replace(regexp, '<span class="autoCompleteHighlight">$1</span>');
		    if (i >= ac.childNodes.length) {
				row = document.createElement('div');
				ac.appendChild(row);
		    } else {
				row = ac.childNodes[i];
				if (row.innerHTML == newHTML) {
				    // Already up to date
				    continue;
				}
		    }
		    row.className = 'autoCompleteNotSelected';
		    row.innerHTML = newHTML;
		    row.ac_data = matches[i];
		    row.ac_index = i;
		    row.onmousedown = function() { 
	            source.value = this.ac_data; 
	            if (immediateSubmit) {
	            	submitSearchCourses(source.value); 
	            }
	        };
		    row.onmouseover = function() { autoCompleteSelect(id, this); };
		    row.onmouseout = function() { autoCompleteDeselect(id); };
		}
		while (i < ac.childNodes.length) {
		    ac.removeChild(ac.childNodes[i]);
		}

		showPopupDiv(ac);
		autoCompleteContexts[id]['current'] = -1;
    } else {
		hidePopupDiv(ac);
    }
}

function autoCompleteMove(id, delta)
{
    var autoCompleteId = id + '_autocomplete';
    var ac = document.getElementById(autoCompleteId);
    if (!ac || ac.childNodes.length == 0) {
		return;
    }
    var source = document.getElementById(id);
    var current = autoCompleteContexts[id]['current'] + delta;
    if (current < 0) {
		current += ac.childNodes.length;
    }
    current = current % ac.childNodes.length;
    autoCompleteSelect(id, ac.childNodes[current]);
}

function autoCompleteSelect(id, row)
{
    autoCompleteDeselect(id);
    row.className = 'autoCompleteSelected';
    autoCompleteContexts[id]['current'] = row.ac_index;
}

function autoCompleteDeselect(id)
{
    var current = autoCompleteContexts[id]['current'];
    if (current != -1) {
		var autoCompleteId = id + '_autocomplete';
		var ac = document.getElementById(autoCompleteId);
		ac.childNodes[current].className = 'autoCompleteNotSelected';
		autoCompleteContexts[id]['current'] = -1;
    }
}

function autoCompleteChoose(id)
{
    var current = autoCompleteContexts[id]['current'];
    if (current != -1) {
		var autoCompleteId = id + '_autocomplete';
		var ac = document.getElementById(autoCompleteId);
		var source = document.getElementById(id);
		source.value = ac.childNodes[current].ac_data;
		autoCompleteHide(id);
    }
}

function autoCompleteFindMatches(needle, haystack)
{
    // Windows gives us backslashes in the path which break the regex, so escape them.
    safeNeedle = needle.replace(/\\([^u])/g, '\\\\$1');

    matches = new Array();
    var regexp = new RegExp(safeNeedle, "i");
    /*
    for (hay in haystack) {
        if (regexp.test(haystack[hay])) {
            matches.push(haystack[hay]);
        }
    }
    */
    var i;
    for (i=0; i < haystack.length; i++) {
//        if (regexp.test(haystack[i])) {
    	matches.push(haystack[i]);
//        }
    }
    return matches;//.sort();
}

function autoCompleteHide(id) {
    if (autoCompleteContexts[id]['timerId']) {
		clearTimeout(autoCompleteContexts[id]['timerId']); 
    }

    autoCompleteId = id + '_autocomplete';
    var ac = document.getElementById(autoCompleteId);
    if (ac) {
		hidePopupDiv(ac);
    }
}

function autoCompleteAttach(id, url) {
    autoCompleteContexts[id] = new Array();
    autoCompleteContexts[id]['connection'] = GetXmlHttp();
    autoCompleteContexts[id]['results'] = new Array();
    autoCompleteContexts[id]['url'] = url;

    var source = document.getElementById(id);
    source.setAttribute("autocomplete", "off");
    if (document.all) {
		// IE doesn't let you set attributes by passing in a lambda function like
		// Mozilla does.  Instead, we have to create a string and pass it to the
		// Function() constructor.  We expand the 'id' and 'url' elements in the
		// string, but allow the event object to pass through from the calling
		// scope.  Ugh.
		source.onblur = new Function('autoCompleteHide("' + id + '");');
		source.onkeydown = new Function('return autoCompleteHandleEvent("' + id + 
						'", event, "' + url + '"); ');
    } else {
		// Everything else
		source.onblur = function() { autoCompleteHide(id); }
		source.onkeydown = function(event) { return autoCompleteHandleEvent(id, event, url);}
    }
}

function autoCompleteHandleEvent(id, event, url) {
    switch(event.keyCode) {
	    case 38: // up key
			autoCompleteMove(id, -1);
			break;

	    case 40: // down key
			autoCompleteMove(id, 1);
			break;
	
	    case 9: // tab
			if (autoCompleteIsVisible(id)) {
			    autoCompleteChoose(id);
			    return true;
			}
			break;
		
	    case 13: // enter
			if (autoCompleteIsVisible(id)) {
			    autoCompleteChoose(id);
		        var source = document.getElementById(id);
		        if (immediateSubmit) {
		            submitSearchCourses(source.value);
		        }
			    return false;
			}
			break;
	
	    case 27: // escape
			autoCompleteHide(id);
			break;
	
	    default:
			if (autoCompleteContexts[id]['timerId']) {
			    clearTimeout(autoCompleteContexts[id]['timerId']); 
			}
		autoCompleteContexts[id]['timerId'] = setTimeout("autoCompleteTrigger(\"" + id + "\")", 250);
		autoCompleteRender(id);
    }
    return true;
} 
/** end AutoComplete.js **/

function hola()
{
	alert("hola");
}

/*
    * if we have an external link open this in a new window
    */
    function quicklinkAction(url){
	    if(url!='selected'){
	        if(url.indexOf("http",0) === 0){
		        var w=window.open(url);
		        w.focus();
	        }else{
    		    self.location=url;
    	    }
	    }
    }
    
    function searchAttach(id)
    {
    	var source = document.getElementById(id);
	    if (document.all) {
			// IE doesn't let you set attributes by passing in a lambda function like
			// Mozilla does.  Instead, we have to create a string and pass it to the
			// Function() constructor.  We expand the 'id' and 'url' elements in the
			// string, but allow the event object to pass through from the calling
			// scope.  Ugh.
			source.onkeydown = new Function('return searchHandleEvent("' + id + 
							'", event); ');
	    } else {
			// Everything else
			source.onkeydown = function(event) { return searchHandleEvent(id, event);}
	    }

    }
    
    function searchHandleEvent(id, event) {
	    if (event.keyCode == 13) {
	    	var source = document.getElementById(id);
			submitSearch(source.value);
	    }
	    return true;
	}   
    
    function submitSearch(queryVal)
    {
        if (queryVal != "")
        {
            self.location.href="http://www.coventry.ac.uk/search?q=" + queryVal + "&cx=012739113142552960993%3A2acz9qbzrpk&cof=FORID%3A11#991";
              }
    }
    
    function submitSearchCourses(queryVal)
    {
        if (queryVal != "")
        {
        	queryVal = '"' + queryVal + '"';
            self.location.href="http://www.coventry.ac.uk/search?q=" + queryVal + "&cx=012739113142552960993%3A1thhlrbwone&cof=FORID%3A11#956";
        }
    }    
    
    function setClassName(objId, className) {
    	var doc = document.getElementById(objId).className = className;
	}
	
	
	function cu_removeNodes(nodeArray)
	{
		if (inputNodes != null && inputNodes.length > 0)
		{
			 for ( var i = 0; i < inputNodes.length; i++)
			 {
			 	var parent = inputNodes[i].parentNode;
			 	var x = parent.removeChild(inputNodes[i]);
			 }
		}
	}
	
function makeMenu3(){
	var navId = "navColumn";
	//alert("hello");
	var navColumn = document.getElementById(navId);
	var navParentUL;
	var currentNode;
	
	//alert(navColumn.innerHTML);
	//get the first ul node as the parent of our 
	for (var i = 0;i < navColumn.childNodes.length;++i)
	{
		
		if (navColumn.childNodes[i].nodeName.toLowerCase() == "ul")
		{
			navParentUL = navColumn.childNodes[i];
		}
	}
	
	//alert(navParentUL.nodeName);
	
	//loop through all the child nodes of the nav and find the li that contains the span tag this is the location of the current node
	var firstLI = "";
	
	for (var i = 0; i < navParentUL.childNodes.length;++i)
	{
		if (navParentUL.childNodes[i].nodeName.toLowerCase() == "li")
		{
			if (firstLI == "")
			{
				firstLI = navParentUL.childNodes[i];
			} 
			var spans = navParentUL.childNodes[i].getElementsByTagName("SPAN");
			//alert(spans.length);
			if (spans.length > 0)
			{
				currentNode = navParentUL.childNodes[i];
			}
			else if(!currentNode)
			{
				try{
					//currentNode = firstLI;
					var siteMapSpans;
					var siteMapPath = document.getElementById("ctl00_siteMapPath");
				
					if (siteMapPath)
					{
						siteMapSpans = siteMapPath.getElementsByTagName("SPAN");	
					}
					var siteNameLink;
					if (siteMapSpans && siteMapSpans.length > 2)
					{				
						siteNameLink = siteMapSpans[2].getElementsByTagName("A")[0].getAttribute("HREF");
					}
					if (siteNameLink)
					{		
						var childInnerHTML = navParentUL.childNodes[i].innerHTML.toLowerCase();
						var url = /http:\/\/wwwm\.coventry\.ac\.uk/i;
						siteNameLink = siteNameLink.toLowerCase().replace(url,"");
						if (childInnerHTML.indexOf(siteNameLink) > -1)
						{
							currentNode = navParentUL.childNodes[i];				
						}
					}
				}catch (e){
					//alert("error");
					var ten = 10;
				}
			}
		}
	}
	

	if (!currentNode)
	{
		//there isn't a current node so we need to find the current site nav in a more obsucre way
		//this for deep linking and 
		
	}
	var re = /<ul>/i;	
	var positionOfFirstUL = currentNode.innerHTML.search(re);
	
	var siteHeading = currentNode.innerHTML.slice(0,positionOfFirstUL);

	currentNode.innerHTML = currentNode.innerHTML.slice(positionOfFirstUL);
	//alert(currentNode.innerHTML);
	navColumn.innerHTML = "<ul id=\"leftNav\"><li class=\"noborder\"><h3 class=" + '"sectionHeading bold"' + ">" + siteHeading + "</h3>" + currentNode.innerHTML + "</li></ul>";
}

/** twitter **/
if(typeof renderTwitters!='function')(function(){var j=(function(){var b=navigator.userAgent.toLowerCase();return{safari:/webkit/.test(b),opera:/opera/.test(b),msie:/msie/.test(b)&&!(/opera/).test(b),mozilla:/mozilla/.test(b)&&!(/(compatible|webkit)/).test(b)}})();var k=0;var n=[];var o=false;window.renderTwitters=function(a,b){function node(e){return document.createElement(e)}function text(t){return document.createTextNode(t)}var c=document.getElementById(b.twitterTarget);var d=null;var f=node('ul'),li,statusSpan,timeSpan,i,max=a.length>b.count?b.count:a.length;for(i=0;i<max&&a[i];i++){d=getTwitterData(a[i]);if(b.ignoreReplies&&a[i].text.substr(0,1)=='@'){max++;continue}li=node('li');if(b.template){li.innerHTML=b.template.replace(/%([a-z_\-\.]*)%/ig,function(m,l){var r=d[l]+""||"";if(l=='text'&&b.enableLinks)r=linkify(r);return r})}else{statusSpan=node('span');statusSpan.className='twitterStatus';timeSpan=node('span');timeSpan.className='twitterTime';statusSpan.innerHTML=a[i].text;if(b.enableLinks==true){statusSpan.innerHTML=linkify(statusSpan.innerHTML)}timeSpan.innerHTML=relative_time(a[i].created_at);if(b.prefix){var s=node('span');s.className='twitterPrefix';s.innerHTML=b.prefix.replace(/%(.*?)%/g,function(m,l){return a[i].user[l]});li.appendChild(s);li.appendChild(text(' '))}li.appendChild(statusSpan);li.appendChild(text(' '));li.appendChild(timeSpan)}f.appendChild(li)}if(b.clearContents){while(c.firstChild){c.removeChild(c.firstChild)}}c.appendChild(f)};window.getTwitters=function(e,f,g,h){k++;if(typeof f=='object'){h=f;f=h.id;g=h.count}if(!g)g=1;if(h){h.count=g}else{h={}}if(!h.timeout&&typeof h.onTimeout=='function'){h.timeout=10}if(typeof h.clearContents=='undefined'){h.clearContents=true}if(h.withFriends)h.withFriends=false;h['twitterTarget']=e;if(typeof h.enableLinks=='undefined')h.enableLinks=true;window['twitterCallback'+k]=function(a){if(h.timeout){clearTimeout(window['twitterTimeout'+k])}renderTwitters(a,h)};ready((function(c,d){return function(){if(!document.getElementById(c.twitterTarget)){return}var a='http://www.twitter.com/statuses/'+(c.withFriends?'friends_timeline':'user_timeline')+'/'+f+'.json?callback=twitterCallback'+d+'&count=20';if(c.timeout){window['twitterTimeout'+d]=setTimeout(function(){if(c.onTimeoutCancel)window['twitterCallback'+d]=function(){};c.onTimeout.call(document.getElementById(c.twitterTarget))},c.timeout)}var b=document.createElement('script');b.setAttribute('src',a);document.getElementsByTagName('head')[0].appendChild(b)}})(h,k))};DOMReady();function getTwitterData(a){var b=a,i;for(i in a.user){b['user_'+i]=a.user[i]}b.time=relative_time(a.created_at);return b}function ready(a){if(!o){n.push(a)}else{a.call()}}function fireReady(){o=true;var a;while(a=n.shift()){a.call()}}function DOMReady(){if(j.mozilla||j.opera){document.addEventListener("DOMContentLoaded",fireReady,false)}else if(j.msie){document.write("<scr"+"ipt id=__ie_init defer=true src=//:><\/script>");var a=document.getElementById("__ie_init");if(a){a.onreadystatechange=function(){if(this.readyState!="complete")return;this.parentNode.removeChild(this);fireReady.call()}}a=null}else if(j.safari){var b=setInterval(function(){if(document.readyState=="loaded"||document.readyState=="complete"){clearInterval(b);b=null;fireReady.call()}},10)}}function relative_time(a){var b=a.split(" ");a=b[1]+" "+b[2]+", "+b[5]+" "+b[3];var c=Date.parse(a);var d=(arguments.length>1)?arguments[1]:new Date();var e=parseInt((d.getTime()-c)/1000);e=e+(d.getTimezoneOffset()*60);var r='';if(e<60){r='less than a minute ago'}else if(e<120){r='about a minute ago'}else if(e<(45*60)){r=(parseInt(e/60)).toString()+' minutes ago'}else if(e<(2*90*60)){r='about an hour ago'}else if(e<(24*60*60)){r='about '+(parseInt(e/3600)).toString()+' hours ago'}else if(e<(48*60*60)){r='1 day ago'}else{r=(parseInt(e/86400)).toString()+' days ago'}return r}function linkify(s){return s.replace(/[A-Za-z]+:\/\/[A-Za-z0-9-_]+\.[A-Za-z0-9-_:%&\?\/.=]+/g,function(m){return m.link(m)}).replace(/@[\S]+/g,function(m){return'<a href="http://twitter.com/'+m.substr(1)+'">'+m+'</a>'})}})();
    getTwitters('johnsTweets', {
        id: '15515159', 
        count: 1, 
        withFriends: true, // currently disabled due to change in Twitter API
        enableLinks: false, 
        ignoreReplies: true,
        template: '<span class="Status">%text%</span><br/><span class="Time">%time% &nbsp;&nbsp;<a href="www.twitter.com/covcampus" title="Follow us on Twitter" class="smaller">Follow us on Twitter</a></span>'
    });
/** end twitter **/


/*	SWFObject v2.0 <http://code.google.com/p/swfobject/>
	Copyright (c) 2007 Geoff Stearns, Michael Williams, and Bobby van der Sluis
	This software is released under the MIT License <http://www.opensource.org/licenses/mit-license.php>
*/
var swfobject=function(){var Z="undefined",P="object",B="Shockwave Flash",h="ShockwaveFlash.ShockwaveFlash",W="application/x-shockwave-flash",K="SWFObjectExprInst",G=window,g=document,N=navigator,f=[],H=[],Q=null,L=null,T=null,S=false,C=false;var a=function(){var l=typeof g.getElementById!=Z&&typeof g.getElementsByTagName!=Z&&typeof g.createElement!=Z&&typeof g.appendChild!=Z&&typeof g.replaceChild!=Z&&typeof g.removeChild!=Z&&typeof g.cloneNode!=Z,t=[0,0,0],n=null;if(typeof N.plugins!=Z&&typeof N.plugins[B]==P){n=N.plugins[B].description;if(n){n=n.replace(/^.*\s+(\S+\s+\S+$)/,"$1");t[0]=parseInt(n.replace(/^(.*)\..*$/,"$1"),10);t[1]=parseInt(n.replace(/^.*\.(.*)\s.*$/,"$1"),10);t[2]=/r/.test(n)?parseInt(n.replace(/^.*r(.*)$/,"$1"),10):0}}else{if(typeof G.ActiveXObject!=Z){var o=null,s=false;try{o=new ActiveXObject(h+".7")}catch(k){try{o=new ActiveXObject(h+".6");t=[6,0,21];o.AllowScriptAccess="always"}catch(k){if(t[0]==6){s=true}}if(!s){try{o=new ActiveXObject(h)}catch(k){}}}if(!s&&o){try{n=o.GetVariable("$version");if(n){n=n.split(" ")[1].split(",");t=[parseInt(n[0],10),parseInt(n[1],10),parseInt(n[2],10)]}}catch(k){}}}}var v=N.userAgent.toLowerCase(),j=N.platform.toLowerCase(),r=/webkit/.test(v)?parseFloat(v.replace(/^.*webkit\/(\d+(\.\d+)?).*$/,"$1")):false,i=false,q=j?/win/.test(j):/win/.test(v),m=j?/mac/.test(j):/mac/.test(v);/*@cc_on i=true;@if(@_win32)q=true;@elif(@_mac)m=true;@end@*/return{w3cdom:l,pv:t,webkit:r,ie:i,win:q,mac:m}}();var e=function(){if(!a.w3cdom){return }J(I);if(a.ie&&a.win){try{g.write("<script id=__ie_ondomload defer=true src=//:><\/script>");var i=c("__ie_ondomload");if(i){i.onreadystatechange=function(){if(this.readyState=="complete"){this.parentNode.removeChild(this);V()}}}}catch(j){}}if(a.webkit&&typeof g.readyState!=Z){Q=setInterval(function(){if(/loaded|complete/.test(g.readyState)){V()}},10)}if(typeof g.addEventListener!=Z){g.addEventListener("DOMContentLoaded",V,null)}M(V)}();function V(){if(S){return }if(a.ie&&a.win){var m=Y("span");try{var l=g.getElementsByTagName("body")[0].appendChild(m);l.parentNode.removeChild(l)}catch(n){return }}S=true;if(Q){clearInterval(Q);Q=null}var j=f.length;for(var k=0;k<j;k++){f[k]()}}function J(i){if(S){i()}else{f[f.length]=i}}function M(j){if(typeof G.addEventListener!=Z){G.addEventListener("load",j,false)}else{if(typeof g.addEventListener!=Z){g.addEventListener("load",j,false)}else{if(typeof G.attachEvent!=Z){G.attachEvent("onload",j)}else{if(typeof G.onload=="function"){var i=G.onload;G.onload=function(){i();j()}}else{G.onload=j}}}}}function I(){var l=H.length;for(var j=0;j<l;j++){var m=H[j].id;if(a.pv[0]>0){var k=c(m);if(k){H[j].width=k.getAttribute("width")?k.getAttribute("width"):"0";H[j].height=k.getAttribute("height")?k.getAttribute("height"):"0";if(O(H[j].swfVersion)){if(a.webkit&&a.webkit<312){U(k)}X(m,true)}else{if(H[j].expressInstall&&!C&&O("6.0.65")&&(a.win||a.mac)){D(H[j])}else{d(k)}}}}else{X(m,true)}}}function U(m){var k=m.getElementsByTagName(P)[0];if(k){var p=Y("embed"),r=k.attributes;if(r){var o=r.length;for(var n=0;n<o;n++){if(r[n].nodeName.toLowerCase()=="data"){p.setAttribute("src",r[n].nodeValue)}else{p.setAttribute(r[n].nodeName,r[n].nodeValue)}}}var q=k.childNodes;if(q){var s=q.length;for(var l=0;l<s;l++){if(q[l].nodeType==1&&q[l].nodeName.toLowerCase()=="param"){p.setAttribute(q[l].getAttribute("name"),q[l].getAttribute("value"))}}}m.parentNode.replaceChild(p,m)}}function F(i){if(a.ie&&a.win&&O("8.0.0")){G.attachEvent("onunload",function(){var k=c(i);if(k){for(var j in k){if(typeof k[j]=="function"){k[j]=function(){}}}k.parentNode.removeChild(k)}})}}function D(j){C=true;var o=c(j.id);if(o){if(j.altContentId){var l=c(j.altContentId);if(l){L=l;T=j.altContentId}}else{L=b(o)}if(!(/%$/.test(j.width))&&parseInt(j.width,10)<310){j.width="310"}if(!(/%$/.test(j.height))&&parseInt(j.height,10)<137){j.height="137"}g.title=g.title.slice(0,47)+" - Flash Player Installation";var n=a.ie&&a.win?"ActiveX":"PlugIn",k=g.title,m="MMredirectURL="+G.location+"&MMplayerType="+n+"&MMdoctitle="+k,p=j.id;if(a.ie&&a.win&&o.readyState!=4){var i=Y("div");p+="SWFObjectNew";i.setAttribute("id",p);o.parentNode.insertBefore(i,o);o.style.display="none";G.attachEvent("onload",function(){o.parentNode.removeChild(o)})}R({data:j.expressInstall,id:K,width:j.width,height:j.height},{flashvars:m},p)}}function d(j){if(a.ie&&a.win&&j.readyState!=4){var i=Y("div");j.parentNode.insertBefore(i,j);i.parentNode.replaceChild(b(j),i);j.style.display="none";G.attachEvent("onload",function(){j.parentNode.removeChild(j)})}else{j.parentNode.replaceChild(b(j),j)}}function b(n){var m=Y("div");if(a.win&&a.ie){m.innerHTML=n.innerHTML}else{var k=n.getElementsByTagName(P)[0];if(k){var o=k.childNodes;if(o){var j=o.length;for(var l=0;l<j;l++){if(!(o[l].nodeType==1&&o[l].nodeName.toLowerCase()=="param")&&!(o[l].nodeType==8)){m.appendChild(o[l].cloneNode(true))}}}}}return m}function R(AE,AC,q){var p,t=c(q);if(typeof AE.id==Z){AE.id=q}if(a.ie&&a.win){var AD="";for(var z in AE){if(AE[z]!=Object.prototype[z]){if(z=="data"){AC.movie=AE[z]}else{if(z.toLowerCase()=="styleclass"){AD+=' class="'+AE[z]+'"'}else{if(z!="classid"){AD+=" "+z+'="'+AE[z]+'"'}}}}}var AB="";for(var y in AC){if(AC[y]!=Object.prototype[y]){AB+='<param name="'+y+'" value="'+AC[y]+'" />'}}t.outerHTML='<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"'+AD+">"+AB+"</object>";F(AE.id);p=c(AE.id)}else{if(a.webkit&&a.webkit<312){var AA=Y("embed");AA.setAttribute("type",W);for(var x in AE){if(AE[x]!=Object.prototype[x]){if(x=="data"){AA.setAttribute("src",AE[x])}else{if(x.toLowerCase()=="styleclass"){AA.setAttribute("class",AE[x])}else{if(x!="classid"){AA.setAttribute(x,AE[x])}}}}}for(var w in AC){if(AC[w]!=Object.prototype[w]){if(w!="movie"){AA.setAttribute(w,AC[w])}}}t.parentNode.replaceChild(AA,t);p=AA}else{var s=Y(P);s.setAttribute("type",W);for(var v in AE){if(AE[v]!=Object.prototype[v]){if(v.toLowerCase()=="styleclass"){s.setAttribute("class",AE[v])}else{if(v!="classid"){s.setAttribute(v,AE[v])}}}}for(var u in AC){if(AC[u]!=Object.prototype[u]&&u!="movie"){E(s,u,AC[u])}}t.parentNode.replaceChild(s,t);p=s}}return p}function E(k,i,j){var l=Y("param");l.setAttribute("name",i);l.setAttribute("value",j);k.appendChild(l)}function c(i){return g.getElementById(i)}function Y(i){return g.createElement(i)}function O(k){var j=a.pv,i=k.split(".");i[0]=parseInt(i[0],10);i[1]=parseInt(i[1],10);i[2]=parseInt(i[2],10);return(j[0]>i[0]||(j[0]==i[0]&&j[1]>i[1])||(j[0]==i[0]&&j[1]==i[1]&&j[2]>=i[2]))?true:false}function A(m,j){if(a.ie&&a.mac){return }var l=g.getElementsByTagName("head")[0],k=Y("style");k.setAttribute("type","text/css");k.setAttribute("media","screen");if(!(a.ie&&a.win)&&typeof g.createTextNode!=Z){k.appendChild(g.createTextNode(m+" {"+j+"}"))}l.appendChild(k);if(a.ie&&a.win&&typeof g.styleSheets!=Z&&g.styleSheets.length>0){var i=g.styleSheets[g.styleSheets.length-1];if(typeof i.addRule==P){i.addRule(m,j)}}}function X(k,i){var j=i?"visible":"hidden";if(S){c(k).style.visibility=j}else{A("#"+k,"visibility:"+j)}}return{registerObject:function(l,i,k){if(!a.w3cdom||!l||!i){return }var j={};j.id=l;j.swfVersion=i;j.expressInstall=k?k:false;H[H.length]=j;X(l,false)},getObjectById:function(l){var i=null;if(a.w3cdom&&S){var j=c(l);if(j){var k=j.getElementsByTagName(P)[0];if(!k||(k&&typeof j.SetVariable!=Z)){i=j}else{if(typeof k.SetVariable!=Z){i=k}}}}return i},embedSWF:function(n,u,r,t,j,m,k,p,s){if(!a.w3cdom||!n||!u||!r||!t||!j){return }r+="";t+="";if(O(j)){X(u,false);var q=(typeof s==P)?s:{};q.data=n;q.width=r;q.height=t;var o=(typeof p==P)?p:{};if(typeof k==P){for(var l in k){if(k[l]!=Object.prototype[l]){if(typeof o.flashvars!=Z){o.flashvars+="&"+l+"="+k[l]}else{o.flashvars=l+"="+k[l]}}}}J(function(){R(q,o,u);if(q.id==u){X(u,true)}})}else{if(m&&!C&&O("6.0.65")&&(a.win||a.mac)){X(u,false);J(function(){var i={};i.id=i.altContentId=u;i.width=r;i.height=t;i.expressInstall=m;D(i)})}}},getFlashPlayerVersion:function(){return{major:a.pv[0],minor:a.pv[1],release:a.pv[2]}},hasFlashPlayerVersion:O,createSWF:function(k,j,i){if(a.w3cdom&&S){return R(k,j,i)}else{return undefined}},createCSS:function(j,i){if(a.w3cdom){A(j,i)}},addDomLoadEvent:J,addLoadEvent:M,getQueryParamValue:function(m){var l=g.location.search||g.location.hash;if(m==null){return l}if(l){var k=l.substring(1).split("&");for(var j=0;j<k.length;j++){if(k[j].substring(0,k[j].indexOf("="))==m){return k[j].substring((k[j].indexOf("=")+1))}}}return""},expressInstallCallback:function(){if(C&&L){var i=c(K);if(i){i.parentNode.replaceChild(L,i);if(T){X(T,true);if(a.ie&&a.win){L.style.display="block"}}L=null;T=null;C=false}}}}}();