﻿
(function($){$.fn.columnize=function(options){var defaults={width:400,columns:false,buildOnce:false,overflow:false};var options=$.extend(defaults,options);return this.each(function(){var $inBox=$(this);var maxHeight=$inBox.height();var $cache=$('<div></div>');var lastWidth=0;var columnizing=false;var kids=$inBox[0].childNodes;$inBox.append($(kids));$cache.append($inBox.children().clone());columnizeIt();if(!options.buildOnce){$(window).resize(function(){if(!options.buildOnce&&$.browser.msie){if($inBox.data("timeout")){clearTimeout($inBox.data("timeout"));}
$inBox.data("timeout",setTimeout(columnizeIt,200));}else if(!options.buildOnce){columnizeIt();}else{}});}
function columnize($putInHere,$pullOutHere,$parentColumn,height){while($parentColumn.height()<height&&$pullOutHere[0].childNodes.length){$putInHere.append($pullOutHere[0].childNodes[0]);}
if($putInHere[0].childNodes.length==0)return;var kids=$putInHere[0].childNodes;var lastKid=kids[kids.length-1];$putInHere[0].removeChild(lastKid);var $item=$(lastKid);if($item[0].nodeType==3){var oText=$item[0].nodeValue;var counter2=options.width/18;if(options.accuracy)
counter2=options.accuracy;var columnText;var latestTextNode=null;while($parentColumn.height()<height&&oText.length){if(oText.indexOf(' ',counter2)!='-1'){columnText=oText.substring(0,oText.indexOf(' ',counter2));}else{columnText=oText;}
latestTextNode=document.createTextNode(columnText);$putInHere.append(latestTextNode);if(oText.length>counter2){oText=oText.substring(oText.indexOf(' ',counter2));}else{oText="";}}
if($parentColumn.height()>=height&&latestTextNode!=null){$putInHere[0].removeChild(latestTextNode);oText=latestTextNode.nodeValue+oText;}
if(oText.length){$item[0].nodeValue=oText;}else{return false;}}
if($pullOutHere.children().length){$pullOutHere.prepend($item);}else{$pullOutHere.append($item);}
return $item[0].nodeType==3;}
function split($putInHere,$pullOutHere,$parentColumn,height){if($pullOutHere.children().length){$cloneMe=$pullOutHere.children(":first");$clone=$cloneMe.clone();if($clone.attr("nodeType")==1&&!$clone.hasClass("dontend")){$putInHere.append($clone);if($clone.is("img")&&$parentColumn.height()<height+20){$cloneMe.remove();}else if(!$cloneMe.hasClass("dontsplit")&&$parentColumn.height()<height+20){$cloneMe.remove();}else if($clone.is("img")||$cloneMe.hasClass("dontsplit")){$clone.remove();}else{$clone.empty();if(!columnize($clone,$cloneMe,$parentColumn,height)){if($cloneMe.children().length){split($clone,$cloneMe,$parentColumn,height);}}}}}}
function singleColumnizeIt(){if($inBox.data("columnized")&&$inBox.children().length==1){return;}
$inBox.data("columnized",true);$inBox.data("columnizing",true);$inBox.empty();$inBox.append($("<div class='first last column' style='width:98%; padding: 3px; float: left;'></div>"));$col=$inBox.children().eq($inBox.children().length-1);$destroyable=$cache.clone();if(options.overflow){targetHeight=options.overflow.height;columnize($col,$destroyable,$col,targetHeight);if(!$destroyable.children().find(":first-child").hasClass("dontend")){split($col,$destroyable,$col,targetHeight);}
while(checkDontEndColumn($col.children(":last").get(0))){var $lastKid=$col.children(":last");$lastKid.remove();$destroyable.prepend($lastKid);}
var html="";var div=document.createElement('DIV');while($destroyable[0].childNodes.length>0){var kid=$destroyable[0].childNodes[0];for(var i=0;i<kid.attributes.length;i++){if(kid.attributes[i].nodeName.indexOf("jQuery")==0){kid.removeAttribute(kid.attributes[i].nodeName);}}
div.innerHTML="";div.appendChild($destroyable[0].childNodes[0]);html+=div.innerHTML;}
var overflow=$(options.overflow.id)[0];overflow.innerHTML=html;}else{$col.append($destroyable);}
$inBox.data("columnizing",false);if(options.overflow){options.overflow.doneFunc();}}
function checkDontEndColumn(dom){if(dom.nodeType!=1)return false;if($(dom).hasClass("dontend"))return true;if(dom.childNodes.length==0)return false;return checkDontEndColumn(dom.childNodes[dom.childNodes.length-1]);}
function columnizeIt(){if(lastWidth==$inBox.width())return;lastWidth=$inBox.width();var numCols=Math.round($inBox.width()/options.width);if(options.columns)numCols=options.columns;if(numCols<=1){return singleColumnizeIt();}
if($inBox.data("columnizing"))return;$inBox.data("columnized",true);$inBox.data("columnizing",true);$inBox.empty();$inBox.append($("<div style='width:"+(Math.round(100/numCols)-2)+"%; padding: 3px; float: left;'></div>"));$col=$inBox.children(":last");$col.append($cache.clone());maxHeight=$col.height();$inBox.empty();var targetHeight=maxHeight/numCols;var firstTime=true;var maxLoops=3;var scrollHorizontally=false;if(options.overflow){maxLoops=1;targetHeight=options.overflow.height;}else if(options.height&&options.width){maxLoops=1;targetHeight=options.height;scrollHorizontally=true;}
for(var loopCount=0;loopCount<maxLoops;loopCount++){$inBox.empty();var $destroyable=$cache.clone();$destroyable.css("visibility","hidden");for(var i=0;i<numCols;i++){var className=(i==0)?"first column":"column";var className=(i==numCols-1)?("last "+className):className;$inBox.append($("<div class='"+className+"' style='width:"+(Math.round(100/numCols)-2)+"%; float: left;'></div>"));}
var i=0;while(i<numCols-(options.overflow?0:1)||scrollHorizontally&&$destroyable.children().length){if($inBox.children().length<=i){$inBox.append($("<div class='"+className+"' style='width:"+(Math.round(100/numCols)-2)+"%; float: left;'></div>"));}
var $col=$inBox.children().eq(i);columnize($col,$destroyable,$col,targetHeight);if(!$destroyable.children().find(":first-child").hasClass("dontend")){split($col,$destroyable,$col,targetHeight);}else{}
while(checkDontEndColumn($col.children(":last").get(0))){var $lastKid=$col.children(":last");$lastKid.remove();$destroyable.prepend($lastKid);}
i++;}
if(options.overflow&&!scrollHorizontally){var html="";var div=document.createElement('DIV');while($destroyable[0].childNodes.length>0){var kid=$destroyable[0].childNodes[0];for(var i=0;i<kid.attributes.length;i++){if(kid.attributes[i].nodeName.indexOf("jQuery")==0){kid.removeAttribute(kid.attributes[i].nodeName);}}
div.innerHTML="";div.appendChild($destroyable[0].childNodes[0]);html+=div.innerHTML;}
var overflow=$(options.overflow.id)[0];overflow.innerHTML=html;}else if(!scrollHorizontally){$col=$inBox.children().eq($inBox.children().length-1);while($destroyable.children().length)$col.append($destroyable.children(":first"));var afterH=$col.height();var diff=afterH-targetHeight;var totalH=0;var min=10000000;var max=0;$inBox.children().each(function($inBox){return function($item){var h=$inBox.children().eq($item).height();totalH+=h;if(h>max)max=h;if(h<min)min=h;}}($inBox));var avgH=totalH/numCols;if(max-min>30){targetHeight=avgH+30;}else if(Math.abs(avgH-targetHeight)>20){targetHeight=avgH;}else{loopCount=maxLoops;}}else{$inBox.children().each(function(i){$col=$inBox.children().eq(i);$col.width(options.width+"px");if(i==0){$col.addClass("first");}else if(i==$inBox.children().length-1){$col.addClass("last");}else{$col.removeClass("first");$col.removeClass("last");}});$inBox.width($inBox.children().length*options.width+"px");}
$inBox.append($("<br style='clear:both;'>"));}
$inBox.find('.column').find(':first.removeiffirst').remove();$inBox.find('.column').find(':last.removeiflast').remove();$inBox.data("columnizing",false);if(options.overflow){options.overflow.doneFunc();}}});};})(jQuery);
/**
 * Cookie plugin
 *
 * Copyright (c) 2006 Klaus Hartl (stilbuero.de)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 *
 */

/**
 * Create a cookie with the given name and value and other optional parameters.
 *
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Set the value of a cookie.
 * @example $.cookie('the_cookie', 'the_value', { expires: 7, path: '/', domain: 'jquery.com', secure: true });
 * @desc Create a cookie with all available options.
 * @example $.cookie('the_cookie', 'the_value');
 * @desc Create a session cookie.
 * @example $.cookie('the_cookie', null);
 * @desc Delete a cookie by passing null as value. Keep in mind that you have to use the same path and domain
 *       used when the cookie was set.
 *
 * @param String name The name of the cookie.
 * @param String value The value of the cookie.
 * @param Object options An object literal containing key/value pairs to provide optional cookie attributes.
 * @option Number|Date expires Either an integer specifying the expiration date from now on in days or a Date object.
 *                             If a negative value is specified (e.g. a date in the past), the cookie will be deleted.
 *                             If set to null or omitted, the cookie will be a session cookie and will not be retained
 *                             when the the browser exits.
 * @option String path The value of the path attribute of the cookie (default: path of page that created the cookie).
 * @option String domain The value of the domain attribute of the cookie (default: domain of page that created the cookie).
 * @option Boolean secure If true, the secure attribute of the cookie will be set and the cookie transmission will
 *                        require a secure protocol (like HTTPS).
 * @type undefined
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */

/**
 * Get the value of a cookie with the given name.
 *
 * @example $.cookie('the_cookie');
 * @desc Get the value of a cookie.
 *
 * @param String name The name of the cookie.
 * @return The value of the cookie.
 * @type String
 *
 * @name $.cookie
 * @cat Plugins/Cookie
 * @author Klaus Hartl/klaus.hartl@stilbuero.de
 */
jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        // CAUTION: Needed to parenthesize options.path and options.domain
        // in the following expressions, otherwise they evaluate to undefined
        // in the packed version for some reason...
        var path = options.path ? '; path=' + (options.path) : '';
        var domain = options.domain ? '; domain=' + (options.domain) : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "/images/loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
jQuery(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk) {
    jQuery(domChunk).click(function() {
        var t = this.title || this.name || null;
        var a = this.href || this.alt;
        var g = this.rel || false;

        tb_show(t, a, g);
        this.blur();
        return false;
    });
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link
    try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			jQuery("body","html").css({height: "100%", width: "100%"});
			jQuery("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				jQuery("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
			    jQuery("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
			    (url.indexOf('TB_iframe') != -1) ? jQuery("#TB_window").fadeIn("slow") : jQuery("#TB_window").addClass("sendToFriend");
				jQuery("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			jQuery("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			jQuery("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		jQuery("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		jQuery('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }

	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|\.ashx$/;
	   var urlType = baseURL.toLowerCase().match(urlString);
		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp' || urlType == '.ashx'){//code to show images
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = jQuery("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								if (urlType == '.ashx') {
								    TB_NextHTML = "<a href='#'>Next</a>"
								} else {
								    TB_NextHTML = "<a href='#'>Next &gt;</a>";
								};
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								if (urlType == '.ashx') {
								    TB_PrevHTML = "<a href='#'>Prev</a>";
								} else {
								    TB_PrevHTML = "<a href='#'>&lt; Prev</a>";
								};
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			jQuery("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='" + url + "' width='" + imageWidth + "' height='" + imageHeight + "' alt='" + caption + "'/></a>" + "<div id='TB_caption'><div id='TB_captionCopy'>" + caption + "</div><div id='TB_secondLine'>" + "<div id='TB_prev'>" + TB_PrevHTML + "</div><div id='TB_count'>"+TB_imageCount + "</div><div id='TB_next'>" + TB_NextHTML + "</div>" + "</div><div id='TB_closeWindow'><a href='#' class='TB_closeWindowButton' title='Close'>close</a></div></div>"); 		
			
			jQuery(".TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if(jQuery(document).unbind("click",goPrev)){jQuery(document).unbind("click",goPrev);}
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				jQuery("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					jQuery("#TB_window").remove();
					jQuery("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				jQuery("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			jQuery("#TB_load").remove();
			jQuery("#TB_ImageOff").click(tb_remove);
			jQuery("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					jQuery("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' class='TB_closeWindowButton' title='Close'>close</a></div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if(jQuery("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						jQuery("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' class='TB_closeWindowButton'>close</a></div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						jQuery("#TB_overlay").unbind();
						jQuery("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						jQuery("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						jQuery("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						jQuery("#TB_ajaxContent")[0].scrollTop = 0;
						jQuery("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			jQuery(".TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					jQuery("#TB_ajaxContent").append(jQuery('#' + params['inlineId']).children());
					jQuery("#TB_window").unload(function () {
						jQuery('#' + params['inlineId']).append( jQuery("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					jQuery("#TB_load").remove();
					jQuery("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						jQuery("#TB_load").remove();
						jQuery("#TB_window").css({display:"block"});
					}
				}else{
					jQuery("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						jQuery("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						jQuery("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}

//helper functions below
function tb_showIframe(){
	jQuery("#TB_load").remove();
	jQuery("#TB_window").css({display:"block"});
}

function tb_remove() {
 	jQuery("#TB_imageOff").unbind("click");
	jQuery(".TB_closeWindowButton").unbind("click");
	jQuery("#TB_window").fadeOut(250,function(){jQuery('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	jQuery("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		jQuery("body","html").css({height: "auto", width: "auto"});
		jQuery("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
jQuery("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		jQuery("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}



/// <reference name="MicrosoftAjax.js"/>
//Auto-Fill function accepts id of input and fills it with the given value.
function autoFill(el, text) {
    el = $(el);
    el.attr('autoFillText', text);
    el.focus(function() {
        if ($(this).val() == text) {
            $(this).css('color', '#000000').val('');
        }
    }).blur(function() {
        if ($(this).val() === '' || $(this).val() == text) {
            $(this).css('color', '#837870').val(text);
        }
    }).blur();
}

function unAutoFill(el) {
    var unFill = function(el) {
        if (el.val() == el.attr('autoFillText')) {
            el.val('');
        }
    };
    var els = arguments.length ? arguments : [el];
    jQuery.each(els, function() {
        unFill($(arguments[1]));
    });
}

jQuery.fn.extend({
    autoFill: function(text) {
        autoFill(this, text);
    },
    unAutoFill: function() {
        unAutoFill(this);
    }
});
$(document).ready(function() {
    // change a feature depending on theme
    embedAfeature();

    var isDesignMode = $('meta[name=\'X-Cms-DesignMode\']').attr('content');

    if (!isDesignMode) {
        // create the expand button for aFeature
        $('.header-wrapper').after('<div id="expandAFeature" class="grid_16_full"><a href="">expand</a></div>');

        // attach function and then hide the button for homepage
        $('#expandAFeature a').click(function() {
            foldUpAnimation(null, 'expand', 'mainpage', true);
            return false;
        });
    }

    $('.RadMenu a.rmLink').click(function() {
        removeAFeature();
    });

    // initial - hide the expand button if not on homepage (check to see if the a feature movie exists)
    ($('#aFeature').length > 0) ? jQuery('#expandAFeature').hide() : $('#expandAFeature').before('<div id="aFeature"></div>').prev().hide();

    // attach function for all other pages
    $('#expandAFeature a').click(function() {
        foldUpAnimation(null, 'expand', 'subpage', true);
        return false;
    });

    // remove borders from footer list by adding classes
    $('ul.footerNav').each(function() {
        $(this).find('li:first').addClass('first');
    });
    $('ul.footerNav').eq(1).css({ 'border-bottom': 'none' });
    //columnizer calls
    if ($('.latest-news-cols').columnize) {
        $('.latest-news-cols').columnize({ width: 220 });
        $('.homepageSupport .explained .text').columnize({ width: 195 });
        $('.homepageSupport .homepageEmergency .text').columnize({ width: 210 });
    }

    // Add zebra striping to ordinary content tables
    $('.striped tbody tr:odd').addClass('alt');

    // add rounded corners to issues pillar story boxes
    expandedStories = -1;
    roundCorners(expandedStories);
    // toggle button, hide/show other boxes and pass button index to roundCorners function
    $('.show-all').click(function() {
        if ($(this).hasClass('hide')) {
            $(this).parents('.story-boxes').find('li.hidden').css('display', 'none');
            expandedStories = $('.show-all').index($(this));
            $(this).removeClass('hide');
            $(this).text('+ Show all');
        } else {
            $(this).parents('.story-boxes').find('li.hidden').css('display', 'block');
            expandedStories = $('.show-all').index($(this));
            $(this).addClass('hide');
            $(this).text('- Show first six only');
        }
        roundCorners(expandedStories);
        return false;
    });

    // attach the current url to the facebook link
    //$('a.share-link[title=Facebook]').attr('href', jQuery('a.share-link[title=Facebook]').attr('href') + location.href);

    // set image title text to nothing to get rid of tooltips in IE.
    $("img").attr("title", "");

    var breadcrumb = $("div#breadcrumb");

    // remove last node from breadcrumbs
    breadcrumb.find("span.bc-list > span:last").remove();
    breadcrumb.find("span.bc-list > span:last").remove();

    // eliminate breadcrumb wrapping by truncating intermediate nodes
    if (breadcrumb.height() > 25) { // if breadcrumb is on 2 lines...
        breadcrumbArray = breadcrumb.find('a');

        // loop through each node
        for (i = 1; i < breadcrumbArray.length; i++) {

            // get text from each node link
            var curNode = breadcrumbArray.eq(i);
            var text = curNode.text();

            var indexOfSpace = text.indexOf(" ");
            if (indexOfSpace != -1) {
                // truncate after first space and add ellipsis
                curNode.text(text.substring(0, indexOfSpace) + "... ");
                curNode.attr("title", text);
            }
            // stop once breadcrumb is only one line high
            if (breadcrumb.height() == 25) { break; }
        }
    }

    // theme switcher
    // create dropdown
    $('#header').append('<div class="btnThemeSwitchContainer"><div class="btnThemeSwitch clearfix">' +
            '<a href="?theme=clean" class="btnThemeSwitchClean"><img alt="Classic" src="/Images/themeClassic.jpg" /> Classic</a>' +
            '<a href="?theme=rustic" class="btnThemeSwitchRustic"><img alt="Connect" src="/Images/themeConnect.jpg" /> Connect</a>' +
        '</div></div>')
    // set initial values
    var hideDelayTimer = null;
    var hideDelay = 500;
    // insert button into main top nav
    $('.RadMenu').append('<a href="" id="btnSwitchTheme" class="btnGray">Change theme</a> <a href="https://trans.worldvision.com.au/GeneralDonations/Donate.aspx" id="btnDonateNow" class="btnOrange">Donate now</a>');
    $('#btnSwitchTheme, .btnThemeSwitchContainer').hover(
        function() {
            // clear the setimeout if you go over the dropdown
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            // show dropdown
            $('.btnThemeSwitchContainer').show().css({ 'margin-left': '155px', 'left': '50%', "top": ($('#header').position().top + 53) + 'px' });
        },
        function() {
            if (hideDelayTimer) clearTimeout(hideDelayTimer);
            // set the setimeout for both button and dropdown
            hideDelayTimer = setTimeout(function() {
                hideDelayTimer = null;
                $('.btnThemeSwitchContainer').hide()
            }, hideDelay);
        });

    $('#btnSwitchTheme').click(function() { return false });

    // calling rounded buttons
    // gray rounded buttons
    $('.btnGray').corner();
    $('#btnSwitchTheme').arrow({ arrow: 'down' });
    // orange rounded buttons
    $('.btnOrange').corner();

    // adding send to a friend and print links
    $('div#breadcrumb').after('<div class="grid_4" id="page-tools"><a class="tools-print" href="#">Print page</a><a class="tools-friend thickbox" href="/SendToFriendLauncher.aspx?height=525&amp;width=474">Send to friend</a></div>');

    //Re-run thickbox
    tb_init('a.tools-friend'); //pass where to apply thickbox
    // setting the print function
    $('a.tools-print').click(function() {
        window.print();
        return false;
    });
    // embed the virtual ADP
    $("#VADP").media({
        id: "flashcontent",
        width: 940,
        height: 700,
        src: "/Swf/VADP/VADP.swf",
        bgColor: "transparent",
        flashvars: { xmlpath: "/Swf/VADP/data/virtualadp2.xml" },
        flashVersion: "9",
        autoplay: "true"
    });

    applyCustomEditorClasses();

});

function applyCustomEditorClasses() {
    applyCaptionsToWyiwygImages();
    applyImageClasses();    
};

function applyImageClasses() {
    $("img.ImgNowrapLeft").wrap('<div style="margin: 0pt; padding: 0pt; float: left; width: 100%;"></div>');
    $("img.ImgNowrapRight").wrap('<div style="margin: 0pt; padding: 0pt; float: right; width: 100%;"></div>');
}

function applyCaptionsToWyiwygImages() {
    var els = $("img.wysiwygimg");
    els.each(function(index) {
        var el = $(this);
        el.wrap('<div class="wysiwygimg"><div></div><div class="caption"><div class="captionText"></div></div></div>');
        el.removeClass('wysiwygimg');
        el.parents('div.wysiwygimg').each(function() {
            var parentEl = $(this);
            var altText = el.attr('alt') + '';
            if (altText.length == 0) {
                parentEl.find('.caption').hide();
            }
            else {
                setGalleryCaption(parentEl.find('.caption div'), altText);
                parentEl.find('.caption').width(parentEl.find('img').width());
            }
        });
    });
}


// change a feature depending on theme
function embedAfeature() {
    if ($("#aFeature").length==0)
        return;
        
    var theme = $("meta[name='X-WorldVision-Theme']").attr('content');
    switch (theme) {
        case 'clean':
            $("#aFeature").media({
                width: "100%",
                height: 405,
                src: "/Swf/aFeature/Shell.swf",
                bgColor: "transparent",
                params: { quality: "high", scale: "noscale", allowscriptaccess: "always", allowFullScreen: "true", base: "." },
                flashvars: { xmlconfig: "/Swf/aFeature/xml/config.xml", theme: "clean" },
                flashVersion: "9",
                expressInstaller: "/Swf/aFeature/expressinstall.swf"
            });
            break;
        case 'rustic':
            $("#aFeature").media({
                width: "100%",
                height: 405,
                src: "/Swf/aFeature/Shell.swf",
                bgColor: "transparent",
                params: { quality: "high", scale: "noscale", allowscriptaccess: "always", allowFullScreen: "true", base: "." },
                flashvars: { xmlconfig: "/Swf/aFeature/xml/config.xml", theme: "indie" },
                flashVersion: "9",
                expressInstaller: "/Swf/aFeature/expressinstall.swf"
            });
            break;
        default:
            $("#aFeature").media({
                width: "100%",
                height: 405,
                src: "/Swf/aFeature/Shell.swf",
                bgColor: "transparent",
                params: { quality: "high", scale: "noscale", allowscriptaccess: "always", allowFullScreen: "true", base: "." },
                flashvars: { xmlconfig: "/Swf/aFeature/xml/config.xml", theme: "clean" },
                flashVersion: "9",
                expressInstaller: "/Swf/aFeature/expressinstall.swf"
            });
    }
}
(function($) {
    $.fn.corner = function() {

        return this.each(function() {
            obj = $(this);
            obj.wrap('<div class="' + obj.attr('class') + 'Container"><div class="bd"><div class="c"><div class="s"></div></div></div></div>');
            obj.parents('.' + obj.attr('class') + 'Container').prepend('<div class="hd"><div class="c"></div></div>').append('<div class="ft"><div class="c"></div></div>');
            // add an extra pixel to the width of the container - this is to fix an ie7 bug which doesnt show the .c div
              if ($.browser.msie) {
                var buttonWidth = $('.' + obj.attr('class') + 'Container').width() + 1;
                $(this).parents("div[class$='Container']").css({ 'width': buttonWidth + 'px' });
            };
        });
    };
})(jQuery);

(function($) {
    $.fn.arrow = function(options) {
        var defaults = {
            arrow: 'none'
        };
        var options = $.extend(defaults, options);

        return this.each(function() {
            if ($.browser.version != 6) {
                switch (options.arrow) {
                    case 'none':
                        arrowValue = null;
                        break;
                    case 'up':
                        arrowValue = 'arrowUp';
                        break;
                    case 'down':
                        arrowValue = 'arrowDown';
                        break;
                }
                obj = $(this);
                obj.addClass(arrowValue);
                if ($.browser.msie) {
                    var buttonWidth = obj.parents().eq(3).width() + 15;
                    obj.parents().eq(3).css({ 'width': buttonWidth + 'px' });
                };
            }
        });
    };
})(jQuery);

// initialise gallery function
var isGalleryInit = false;
function galleryInit(width,height)    {

    if (isGalleryInit)
        return;

    isGalleryInit = true;
    
    // gallery module
    // hide gallery items and show the first one
    $('#slide ol li').css({ 'display': 'none' });
    $('#slide ol li:first').show();
    $('#slide .caption').fadeTo(0, 0.75);

    // set image's link title text to be the same as image alt, since TB gets caption from here.
    //$('#slide ol li a').attr('title', function() { return $(this).find("img").attr("alt") });
    
    // remove all title attributes altogether.
    $('#slide ol li a').attr('title','');
    
    setGalleryCaption( $('#slide .caption div'), $('#slide ol li:first img').attr('alt') );
       
    // create the nav for the gallery
    var howManyPhotos = $('#slide ol li').length;
    $('#slide').append('<div class="nav"><a href="" class="prev">Prev</a> <span class="noOfPhotos">' + howManyPhotos + ' Photos</span> <a href="" class="next">Next</a></div>');
    // disable the previous button to start off
    $('#slide .nav .prev').addClass('disabledButton');

    // attach events to the next buttons
    $('#slide .nav .next').click(function() {
        // hide the currently visible gallery item and fade in the next one (if it isn't last one)
        var img = (!$('#slide ol li:last').is(':visible')) ? $('#slide ol li:visible').hide().next().fadeIn('slow') : null;
        if (img) setGalleryCaption($('#slide .caption div'), img.find('img').attr('alt'));
        // disable the next button if on the last gallery item
        ($('#slide ol li').eq(howManyPhotos - 1).is(':visible')) ? $(this).addClass('disabledButton') : null;
        // enable the previous button if moving off the first gallery item
        $('#slide .nav .prev').removeClass('disabledButton');
        return false;
    });

    // attach events to the previous button
    $('#slide .nav .prev').click(function() {
        // hide the currently visible gallery item and fade in the previous one (if it isn't first one)
        var img = (!$('#slide ol li:first').is(':visible')) ? $('#slide ol li:visible').hide().prev().fadeIn('slow') : null;
        if (img) setGalleryCaption($('#slide .caption div'), img.find('img').attr('alt'));
        // disable the prev button if on the first gallery item
        ($('#slide ol li:first').is(':visible')) ? $(this).addClass('disabledButton') : null;
        // enable the next button if moving off the last gallery item
        (!$('#slide ol li').eq(howManyPhotos - 1).is(':visible')) ? $('#slide .nav .next').removeClass('disabledButton') : null;
        return false;
    });
}

function setGalleryCaption(el, txt) {
    if ((txt + '').length == 0) {
        el.parent().hide();
    } else {
        el.parent().show()
        el.text(txt);
    }
}


// add rounded corners to issues pillar story boxes
function roundCorners(expandedStories) {
    $('.story-boxes ul').each(function(){
        // get number of visible boxes
        boxes = $(this).children(':visible').length;
        
        // only reset 5th and 6th boxes to blank background if remaining boxes are being displayed (rounded corner bgs go to last 2 boxes)
        if(expandedStories > -1){
            $(this).find('li').eq(4).css('background','#CED1BA');
            $(this).find('li').eq(5).css('background','#CED1BA');
        }
        switch(true){
            // special box for a single story
            case boxes==1:
                $(this).children().css('background','url(/Images/content/theme/story-box-1of1.gif)');
            break
            // special boxes for two stories
            case boxes==2:
                $(this).find('li').eq(0).css('background','url(/Images/content/theme/story-box-1of2.gif)');
                $(this).find('li').eq(1).css('background','url(/Images/content/theme/story-box-2of2.gif)');
            break
            // for three or more boxes, show boxes with one rounded corner each
            case boxes > 2:
                // box one has rounded TL corner, box two has rounded TR corner
                $(this).find('li').eq(0).css('background','url(/Images/content/theme/story-box-1of4.gif)');
                $(this).find('li').eq(1).css('background','url(/Images/content/theme/story-box-2of4.gif)');
                
                if(boxes % 2 == 0) {
                    // if even number of boxes, make last box rounded BR, penultimate box rounded BL
                    $(this).find('li').eq(boxes-2).css('background','url(/Images/content/theme/story-box-3of4.gif)');
                    $(this).find('li').eq(boxes-1).css('background','url(/Images/content/theme/story-box-4of4.gif)');
                    // if odd number, round the last box BL, penultimate box BR
                } else {
                    $(this).find('li').eq(boxes-2).css('background','url(/Images/content/theme/story-box-4of4.gif)');
                    $(this).find('li').eq(boxes-1).css('background','url(/Images/content/theme/story-box-3of4.gif)');
                }
            break
        }
    });
}

// methods for flash to set and get js cookies
function set_cookie(cookieName, cookieValue) {
    jQuery.cookie(cookieName, cookieValue, { path: '/', domain: document.domain }); // set cookie
    return get_cookie(cookieName);
}
function get_cookie(cookieName) {
    var cookieValue = jQuery.cookie(cookieName); // get cookie
    return cookieValue;
}

jQuery(function() {
    autoFill('.commentUsername', 'Enter your name');
    autoFill('.commentEmail', 'Enter email address');
    autoFill('.commentText', 'Enter comment');
});

function removeAFeature(a,b) {
    foldUpAnimation(null, 'hide', 'subpage', 'animate');
}

// slide the aFrame up and go to the supplied link
function foldUpAnimation(url, state, page, animate) {
    if (state == 'expand') {
        if (page == 'subpage') {
            embedAfeature();
            $('#expandAFeature').hide();
        } else {
            $('#aFeature').slideDown();
            $('#expandAFeature').css({ 'display': 'none' });
            $('.fap.top').fadeIn();
        }
    } else {
        if (animate) {
            $('#aFeature').slideUp();
            $('.fap.top').fadeOut();
            $('#expandAFeature').fadeIn();
        } else {
            $('#aFeature').hide();
            $('.fap.top').hide();
            $('#expandAFeature').fadeIn();
        }
    }
    if (url) {
        location.href = url;
    }
}

function backgroundChange(stateName) {
    switch (stateName) {
        case 'earth':
            $('body').addClass('worldView');
            break;
        case 'image':
            $('body').removeClass('worldView');
            break;
        default:
            $('body').removeClass('worldView');
            break;
    }
}



var UNDEF = "undefined";
var VIOBASEDIR = "http://api.viostream.com/player/v5/";
var Viostream = function(D, E) {
    this.Urls = D;
    this.PlayerId = "VioPlayer" + Math.floor(Math.random() * 10000) + Math.floor(Math.random() * 100) + "_ply";
    var C = 0;
    for (var B in D) {
        for (var A in D[B]) {
            C++
        }
    }
    if (C == 1) {
        for (var B in D) {
            this.Player = B;
            for (var A in D[B]) {
                this.Speed = A
            }
        }
    }
    if (typeof(E) != "undefined") {
        this.LoadParams(E)
    }
};
Viostream.prototype = {
    ViostreamId: null,
    Tag: null,
    StreamType: "Prog",
    AutoRewind: true,
    AutoStart: true,
    PlayerSelect: true,
    Width: 400,
    Height: 224,
    Player: "",
    Speed: "",
    Urls: {},
    ShowSplash: false,
    SplashImage: VIOBASEDIR + "images/splash-image.jpg",
    PlayImage: VIOBASEDIR + "images/PlayButton.png",
    LoadParams: function(B) {
        for (var A in B) {
            if (typeof(this[A]) != "function") {
                this[A] = B[A]
            }
        }
        if ((typeof(this.Urls["mp3"]) != "undefined") && (typeof(this.Urls["mp3"]["audio"]) != "undefined")) {
            this.Urls["mp3"]["low"] = this.Urls["mp3"]["audio"]
        }
        if ((typeof(this.Urls["wma"]) != "undefined") && (typeof(this.Urls["wma"]["audio"]) != "undefined")) {
            this.Urls["wma"]["low"] = this.Urls["wma"]["audio"]
        }
    },
    PlayerHeight: function(A) {
        switch (A) {
        case "flv":
            return parseInt(this.Height) + 28;
        case "mp4":
        case "mov":
            return parseInt(this.Height) + 16;
        case "wmv":
            return parseInt(this.Height) + 64
        }
        return this.Height
    },
    RenderFlash: function(B) {
        var E = document.createElement("div");
        E.id = "VioPlayer" + Math.floor(Math.random() * 10000) + Math.floor(Math.random() * 100);
        var C = this.PlayerHeight("flv");
        E.style.height = C + "px";
        E.style.width = this.Width + "px";
        minFlashVersion = "9.0.47";
        if (Vio.swfobject.hasFlashPlayerVersion(minFlashVersion)) {
            var D = "{ videoFile: '" + B + "', showMenu : false, autoPlay: " + this.AutoStart + ", autoRewind: " + this.AutoRewind + ", showPlayListButtons: false, loop: false, initialScale: 'fit', autoBuffering: false, useNativeFullScreen: true, controlBarBackgroundColor : '0x433B38', bufferBarColor1 : '0x838C46', bufferBarColor2 : '0xB2BF60', progressBarBorderColor1 : '0xA3A86B', progressBarBorderColor2 : '0xFFFFFF' ";
            switch (this.StreamType) {
            case "True":
            case "TSAK":
                D += ", streamingServer: 'fms', streamingServerURL: '" + Vio.STREAMING_SERVER_URL + "'";
                break
            }
            D += "}";
            var A = {
                "allowScriptAccess": "always",
                "allowFullScreen": "true"
            };
            if (Vio.WindowModeTransparent) {
                A["wmode"] = "transparent"
            }
            Vio.swfobject.embedSWF(Vio.VIO_FLOWPLAYER_DIR + Vio.VIO_FLOWPLAYER, E, this.Width, C, minFlashVersion, Vio.VIO_FLOWPLAYER_DIR + "expressinstall.swf", {
                "config": D
            },
            A, {
                id: this.PlayerId,
                name: this.PlayerId
            })
        } else {
            E.innerHTML = '<p style="padding:1em;">The minimum supported version of flash is ' + minFlashVersion + '. Please visit <a href="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" target="_blank">Adobe</a> to get the latest version of the Flash plugin.</p>'
        }
        return E
    },
    RenderQuicktime: function(A) {
        var B = this.PlayerHeight("mov");
        var C = document.createElement("div");
        if (Vio.QuicktimeVersion == 0) {
            C.innerHTML = "Sorry, we could not detect QuickTime in your browser"
        } else {
            C.innerHTML = '<OBJECT CLASSID="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" id="' + this.PlayerId + '"HEIGHT="' + B + '" WIDTH="' + this.Width + '" CODEBASE="http://www.apple.com/qtactivex/qtplugin.cab" ><PARAM NAME="src" VALUE="' + A + '" ><PARAM NAME="autoplay" VALUE="' + this.AutoStart + '" ><PARAM NAME="controller" VALUE="true" ><EMBED NAME="' + this.PlayerId + '"HEIGHT="' + B + '" WIDTH="' + this.Width + '" TYPE="video/quicktime" PLUGINSPAGE="http://www.apple.com/quicktime/download/" SRC="' + A + '" AUTOPLAY="true" CONTROLLER="true" /></OBJECT>'
        }
        return C
    },
    RenderWindowsMedia: function(A) {
        var B = this.PlayerHeight("wmv");
        var D = document.createElement("div");
        var C = (navigator.mimeTypes && navigator.mimeTypes["application/x-ms-wmp"] && navigator.mimeTypes["application/x-ms-wmp"].enabledPlugin) ? "application/x-ms-wmp": "application/x-mplayer2";
        D.innerHTML = '<object classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95" id="' + this.PlayerId + '"codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,5,715" name="' + this.PlayerId + '" width="' + this.Width + '" height="' + B + '" ><param name="FileName" value="' + A + '" /><param name="AutoStart" value="' + this.AutoStart + '" /><param name="AllowScan" value="-1" /><param name="AutoRewind" value="' + this.AutoRewind + '" /><param name="EnablePositionControls" value="-1" /><param name="EnableFullScreenControls" value="-1" /><param name="DisplaySize" value="0" /><param name="ShowPositionControls" value="-1" /><param name="ShowStatusBar" value="-1" /><param name="ShowTracker" value="-1" /><embed width="' + this.Width + '" height="' + B + '" type="' + C + '" autostart="' + this.AutoStart + '" filename="' + A + '" name="' + this.PlayerId + '" allowscan="-1" autorewind="' + this.AutoRewind + '" enablepositioncontrols="-1" enablefullscreencontrols="-1" displaysize="0" showpositioncontrols="-1" showstatusbar="-1" showtracker="-1"></embed></object>';
        return D
    },
    MoviePlayer: function(C, E) {
        var F = document.createElement("div");
        F.className = "vioplayer_player";
        switch (C) {
        case "flv":
            F.appendChild(this.RenderFlash(this.Urls["flv"][E]));
            break;
        case "mp4":
            F.appendChild(this.RenderQuicktime(this.Urls["mp4"][E]));
            break;
        case "mov":
            F.appendChild(this.RenderQuicktime(this.Urls["mov"][E]));
            break;
        case "wmv":
            F.appendChild(this.RenderWindowsMedia(this.Urls["wmv"][E]));
            break;
        case "wma":
            F.appendChild(this.RenderWindowsMedia(this.Urls["wma"][E]));
            break;
        case "mp3":
            if (Vio.swfobject.hasFlashPlayerVersion("9")) {
                F.appendChild(this.RenderFlash(this.Urls["mp3"][E]))
            } else {
                if (Vio.QuicktimeVersion > 0) {
                    F.appendChild(this.RenderQuicktime(this.Urls["mp3"][E]))
                } else {
                    F.appendChild(this.RenderWindowsMedia(this.Urls["mp3"][E]))
                }
            }
            break
        }
        if (this.PlayerSelect) {
            var D = document.createElement("p");
            D.className = "viostream_player_change";
            D.style.width = this.Width + "px";
            var B = document.createElement("a");
            B.href = "javascript:void(0);";
            B.innerHTML = Vio.CHANGETEXT;
            var A = this;
            Vio.addEvent(B, "click",
            function() {
                A.Player = "";
                A.Render()
            });
            D.appendChild(B);
            F.appendChild(D)
        }
        return F
    },
    RenderSplash: function(D, E) {
        this.ShowSplash = false;
        var C = document.createElement("div");
        C.className = "vioplayer_splash";
        C.style.background = "transparent url(" + this.SplashImage + ") no-repeat 50% 50%";
        C.style.width = this.Width + "px";
        C.style.height = this.Height + "px";
        C.style.position = "relative";
        var A = document.createElement("a");
        A.href = "javascript:void(0);";
        A.innerHTML = "&nbsp;";
        if (Vio.browser.msie) {
            A.runtimeStyle.filter = "progid:DXImageTransform.Microsoft.AlphaImageLoader(src='" + this.PlayImage + "',sizingMethod='scale')"
        } else {
            A.style.background = "transparent url(" + this.PlayImage + ") no-repeat 50% 50%"
        }
        A.style.textDecoration = "none";
        A.style.display = "block";
        A.style.position = "absolute";
        A.style.width = "32px";
        A.style.height = "32px";
        A.style.cursor = "pointer";
        A.style.left = Math.floor((parseInt(this.Width) / 2) - 16) + "px";
        A.style.top = Math.floor((parseInt(this.Height) / 2) - 16) + "px";
        var B = this;
        Vio.addEvent(A, "click",
        function() {
            B.Render(D, E)
        });
        C.appendChild(A);
        return C
    },
    PlayButton: function(E, F, D) {
        var A = document.createElement("div");
        A.className = "vioplayer_button";
        var C = document.createElement("a");
        if (typeof(F) == "undefined") {
            A.className += "_" + E;
            A.appendChild(document.createTextNode(Vio.MEDIA[E]))
        } else {
            if (D) {
                A.appendChild(document.createTextNode(" "))
            } else {
                var B = this;
                C.href = "javascript:void(0);";
                Vio.addEvent(C, "click",
                function() {
                    B.Render(E, F)
                });
                C.title = Vio.QUALITY[F].caption;
                C.innerHTML = Vio.QUALITY[F].title;
                A.className += "_" + F + " " + E;
                A.appendChild(C)
            }
        }
        return A
    },
    PlaySelector: function() {
        var C = document.createElement("div");
        C.className = "vioplayer_selection";
        for (var B in this.Urls) {
            var A = document.createElement("div");
            A.className = "vioplayer_line";
            A.appendChild(this.PlayButton(B));
            A.appendChild(this.PlayButton(B, "low", typeof(this.Urls[B].low) == "undefined"));
            A.appendChild(this.PlayButton(B, "medium", typeof(this.Urls[B].medium) == "undefined"));
            A.appendChild(this.PlayButton(B, "high", typeof(this.Urls[B].high) == "undefined"));
            A.appendChild(this.PlayButton(B, "hd", typeof(this.Urls[B].hd) == "undefined"));
            C.appendChild(A)
        }
        return C
    },
    Render: function(A, B) {
        if (this.Tag != null) {
            if (Vio.browser.msie) {
                Vio.swfobject.removeSWF(this.Tag)
            }
            var C = document.createElement("div");
            C.className = "vioplayer_container";
            if (typeof(A) != "undefined") {
                this.Player = A
            }
            if (typeof(B) != "undefined") {
                this.Speed = B
            }
            if (this.Player != "") {
                if (this.ShowSplash) {
                    C.appendChild(this.RenderSplash(this.Player, this.Speed))
                } else {
                    C.appendChild(this.MoviePlayer(this.Player, this.Speed))
                }
            } else {
                C.appendChild(this.PlaySelector())
            }
            this.Tag.parentNode.replaceChild(C, this.Tag);
            this.Tag = C
        }
    },
    Seek: function(A) {
        try {
            A = parseInt(A);
            switch (this.Player) {
            case "flv":
                var C = Vio.swfobject.getObjectById(this.PlayerId);
                C.Seek(A);
                break;
            case "wmv":
                var C = document[this.PlayerId];
                C.currentPosition = A;
                break;
            case "mov":
                var C = document[this.PlayerId];
                C.SetTime(A * parseInt(C.GetTimeScale()));
                break
            }
        } catch(B) {}
    }
};
var Vio = {
    browser: function() {
        var B = navigator.userAgent.toLowerCase();
        var A = {
            version: (B.match(/.+(?:rv|it|ra|ie)[\/: ]([\d.]+)/) || [])[1],
            safari: /webkit/.test(B),
            opera: /opera/.test(B),
            msie: /msie/.test(B) && !/opera/.test(B),
            mozilla: /mozilla/.test(B) && !/(compatible|webkit)/.test(B)
        };
        return A
    } (),
    STREAMING_SERVER_URL: "rtmp://cp36269.edgefcs.net/ondemand/flash",
    VIO_FLOWPLAYER_DIR: VIOBASEDIR,
    VIO_FLOWPLAYER: "FlowPlayer.swf",
    MEDIA: {
        "flv": "Flash",
        "mov": "QuickTime",
        "wmv": "Windows Media",
        "mp4": "MPEG4",
        "mp3": "MP3 Audio",
        "wma": "Windows Media"
    },
    QUALITY: {
        "low": {
            title: "Low",
            caption: "Low Quality"
        },
        "medium": {
            title: "Medium",
            caption: "Medium Quality"
        },
        "high": {
            title: "High",
            caption: "High Quality"
        },
        "hd": {
            title: "HD",
            caption: "Higher Quality"
        }
    },
    CHANGETEXT: "Change Player / Connection Speed",
    STYLESHEET: VIOBASEDIR + "vioplayer.css",
    Viostreams: new Array(),
    WindowModeTransparent: false,
    listenersArr: new Array(),
    readyBound: false,
    isReady: false,
    readyList: new Array(),
    addLoadEvent: function(B) {
        if (typeof window.onload == "function") {
            var A = window.onload;
            window.onload = function() {
                A();
                B()
            }
        } else {
            window.onload = B
        }
    },
    addEvent: function(C, B, A) {
        if (C.addEventListener) {
            C.addEventListener(B, A, false)
        } else {
            C.attachEvent("on" + B, A);
            Vio.listenersArr.push([C, B, A])
        }
    },
    bindReady: function() {
        if (Vio.readyBound) {
            return
        }
        Vio.readyBound = true;
        Vio.addEvent(window, "unload",
        function() {
            if (Vio.browser.msie) {
                var F = Vio.listenersArr.length;
                for (var E = 0; E < F; E++) {
                    Vio.listenersArr[E][0].detachEvent(Vio.listenersArr[E][1], Vio.listenersArr[E][2])
                }
            }
            var C = Vio.Viostreams.length;
            for (var D = 0; D < C; D++) {
                Vio.swfobject.removeSWF(Vio.Viostreams[D].Tag)
            }
            for (var B in Vio) {
                Vio[B] = null
            }
            Vio = null
        });
        if (document.addEventListener && !Vio.browser.opera) {
            document.addEventListener("DOMContentLoaded", Vio.DoReady, false)
        }
        if (Vio.browser.msie && window == top) { (function() {
                if (Vio.isReady) {
                    return
                }
                try {
                    document.documentElement.doScroll("left")
                } catch(B) {
                    setTimeout(arguments.callee, 0);
                    return
                }
                Vio.DoReady()
            })()
        }
        if (Vio.browser.opera) {
            document.addEventListener("DOMContentLoaded",
            function() {
                if (Vio.isReady) {
                    return
                }
                for (var B = 0; B < document.styleSheets.length; B++) {
                    if (document.styleSheets[B].disabled) {
                        setTimeout(arguments.callee, 0);
                        return
                    }
                }
                Vio.DoReady()
            },
            false)
        }
        if (Vio.browser.safari) {
            var A;
            (function() {
                if (Vio.isReady) {
                    return
                }
                if (document.readyState != "loaded" && document.readyState != "complete") {
                    setTimeout(arguments.callee, 0);
                    return
                }
                if (A === undefined) {
                    A = document.getElementsByTagName("style").length;
                    var B = document.getElementsByTagName("link");
                    for (var C = 0; C < B.length; C++) {
                        if (B[C].rel == "stylesheet") {
                            A++
                        }
                    }
                }
                if (document.styleSheets.length < A) {
                    setTimeout(arguments.callee, 0);
                    return
                }
                Vio.DoReady()
            })()
        }
        Vio.addLoadEvent(Vio.DoReady)
    },
    DoReady: function() {
        if (!Vio.isReady) {
            Vio.isReady = true;
            for (var A = 0; A < Vio.readyList.length; A++) {
                Vio.readyList[A].call(document)
            }
        }
    },
    Ready: function(A) {
        Vio.bindReady();
        if (typeof(A) == "function") {
            if (Vio.isReady) {
                A.call(document)
            } else {
                Vio.readyList.push(A)
            }
        }
    },
    HasWindowsMedia: (navigator.mimeTypes && navigator.mimeTypes["application/x-mplayer2"] && navigator.mimeTypes["application/x-mplayer2"].enabledPlugin) || (navigator.mimeTypes && navigator.mimeTypes["application/x-ms-wmp"] && navigator.mimeTypes["application/x-ms-wmp"].enabledPlugin),
    QuicktimeVersion: 0,
    swfobject: function() {
        var UNDEF = "undefined",
        OBJECT = "object",
        SHOCKWAVE_FLASH = "Shockwave Flash",
        SHOCKWAVE_FLASH_AX = "ShockwaveFlash.ShockwaveFlash",
        FLASH_MIME_TYPE = "application/x-shockwave-flash",
        EXPRESS_INSTALL_ID = "SWFObjectExprInst",
        win = window,
        doc = document,
        nav = navigator,
        objIdArr = [],
        script,
        timer = null,
        storedAltContent = null,
        isDomLoaded = false,
        isExpressInstallActive = false;
        var ua = function() {
            var w3cdom = typeof doc.getElementById != UNDEF && typeof doc.getElementsByTagName != UNDEF && typeof doc.createElement != UNDEF,
            playerVersion = [0, 0, 0],
            d = null;
            if (typeof nav.plugins != UNDEF && typeof nav.plugins[SHOCKWAVE_FLASH] == OBJECT) {
                d = nav.plugins[SHOCKWAVE_FLASH].description;
                if (d && !(typeof nav.mimeTypes != UNDEF && nav.mimeTypes[FLASH_MIME_TYPE] && !nav.mimeTypes[FLASH_MIME_TYPE].enabledPlugin)) {
                    d = d.replace(/^.*\s+(\S+\s+\S+$)/, "$1");
                    playerVersion[0] = parseInt(d.replace(/^(.*)\..*$/, "$1"), 10);
                    playerVersion[1] = parseInt(d.replace(/^.*\.(.*)\s.*$/, "$1"), 10);
                    playerVersion[2] = /r/.test(d) ? parseInt(d.replace(/^.*r(.*)$/, "$1"), 10) : 0
                }
            } else {
                if (typeof win.ActiveXObject != UNDEF) {
                    var a = null,
                    fp6Crash = false;
                    try {
                        a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".7")
                    } catch(e) {
                        try {
                            a = new ActiveXObject(SHOCKWAVE_FLASH_AX + ".6");
                            playerVersion = [6, 0, 21];
                            a.AllowScriptAccess = "always"
                        } catch(e) {
                            if (playerVersion[0] == 6) {
                                fp6Crash = true
                            }
                        }
                        if (!fp6Crash) {
                            try {
                                a = new ActiveXObject(SHOCKWAVE_FLASH_AX)
                            } catch(e) {}
                        }
                    }
                    if (!fp6Crash && a) {
                        try {
                            d = a.GetVariable("$version");
                            if (d) {
                                d = d.split(" ")[1].split(",");
                                playerVersion = [parseInt(d[0], 10), parseInt(d[1], 10), parseInt(d[2], 10)]
                            }
                        } catch(e) {}
                    }
                }
            }
            var u = nav.userAgent.toLowerCase(),
            p = nav.platform.toLowerCase(),
            webkit = /webkit/.test(u) ? parseFloat(u.replace(/^.*webkit\/(\d+(\.\d+)?).*$/, "$1")) : false,
            ie = false,
            windows = p ? /win/.test(p) : /win/.test(u),
            mac = p ? /mac/.test(p) : /mac/.test(u);
            /*@cc_on
            ie = true;
            @if (@_win32)
            windows = true;
            @elif (@_mac)
				    mac = true;
			    @end
            @*/
            return {
                w3cdom: w3cdom,
                pv: playerVersion,
                webkit: webkit,
                ie: ie,
                win: windows,
                mac: mac
            }
        } ();
        function showExpressInstall(regObj, obj) {
            isExpressInstallActive = true;
            if (typeof(obj) == "undefined") {
                obj = getElementById(regObj.id)
            }
            if (obj) {
                if (regObj.altContentId) {
                    var ac = typeof(regObj.altContentId) == "string" ? getElementById(regObj.altContentId) : regObj.altContentId;
                    if (ac) {
                        storedAltContent = ac
                    }
                } else {
                    storedAltContent = abstractAltContent(obj)
                }
                if (! (/%$/.test(regObj.width)) && parseInt(regObj.width, 10) < 310) {
                    regObj.width = "310"
                }
                if (! (/%$/.test(regObj.height)) && parseInt(regObj.height, 10) < 137) {
                    regObj.height = "137"
                }
                doc.title = doc.title.slice(0, 47) + " - Flash Player Installation";
                var pt = ua.ie && ua.win ? "ActiveX": "PlugIn",
                dt = doc.title,
                fv = "MMredirectURL=" + win.location + "&MMplayerType=" + pt + "&MMdoctitle=" + dt,
                replaceId = regObj.id;
                if (ua.ie && ua.win && obj.readyState != 4) {
                    var newObj = createElement("div");
                    replaceId += "SWFObjectNew";
                    newObj.setAttribute("id", replaceId);
                    obj.parentNode.insertBefore(newObj, obj);
                    obj.style.display = "none";
                    var fn = function() {
                        obj.parentNode.removeChild(obj)
                    };
                    addListener(win, "onload", fn)
                }
                createSWF({
                    data: regObj.expressInstall,
                    id: EXPRESS_INSTALL_ID,
                    width: regObj.width,
                    height: regObj.height
                },
                {
                    flashvars: fv
                },
                replaceId)
            }
        }
        function abstractAltContent(obj) {
            var ac = createElement("div");
            if (ua.win && ua.ie) {
                ac.innerHTML = obj.innerHTML
            } else {
                var nestedObj = obj.getElementsByTagName(OBJECT)[0];
                if (nestedObj) {
                    var c = nestedObj.childNodes;
                    if (c) {
                        var cl = c.length;
                        for (var i = 0; i < cl; i++) {
                            if (! (c[i].nodeType == 1 && c[i].nodeName == "PARAM") && !(c[i].nodeType == 8)) {
                                ac.appendChild(c[i].cloneNode(true))
                            }
                        }
                    }
                }
            }
            return ac
        }
        function createSWF(attObj, parObj, id) {
            var r, el = (typeof(id) == "string" ? getElementById(id) : id);
            if (el) {
                if (typeof attObj.id == UNDEF) {
                    attObj.id = (typeof(id) == "string" ? id: el.id) + "_ply"
                }
                if (ua.ie && ua.win) {
                    var e = createElement("span");
                    var att = "";
                    for (var i in attObj) {
                        if (attObj[i] != Object.prototype[i]) {
                            if (i.toLowerCase() == "data") {
                                parObj.movie = attObj[i]
                            } else {
                                if (i.toLowerCase() == "styleclass") {
                                    att += ' class="' + attObj[i] + '"'
                                } else {
                                    if (i.toLowerCase() != "classid") {
                                        att += " " + i + '="' + attObj[i] + '"'
                                    }
                                }
                            }
                        }
                    }
                    var par = "";
                    for (var j in parObj) {
                        if (parObj[j] != Object.prototype[j]) {
                            par += '<param name="' + j + '" value="' + parObj[j] + '" />'
                        }
                    }
                    el.appendChild(e);
                    e.outerHTML = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"' + att + ">" + par + "</object>";
                    objIdArr[objIdArr.length] = attObj.id
                } else {
                    if (ua.webkit && ua.webkit < 312) {
                        var e = createElement("embed");
                        e.setAttribute("type", FLASH_MIME_TYPE);
                        for (var k in attObj) {
                            if (attObj[k] != Object.prototype[k]) {
                                if (k.toLowerCase() == "data") {
                                    e.setAttribute("src", attObj[k])
                                } else {
                                    if (k.toLowerCase() == "styleclass") {
                                        e.setAttribute("class", attObj[k])
                                    } else {
                                        if (k.toLowerCase() != "classid") {
                                            e.setAttribute(k, attObj[k])
                                        }
                                    }
                                }
                            }
                        }
                        for (var l in parObj) {
                            if (parObj[l] != Object.prototype[l]) {
                                if (l.toLowerCase() != "movie") {
                                    e.setAttribute(l, parObj[l])
                                }
                            }
                        }
                        el.appendChild(e)
                    } else {
                        var o = createElement(OBJECT);
                        o.setAttribute("type", FLASH_MIME_TYPE);
                        for (var m in attObj) {
                            if (attObj[m] != Object.prototype[m]) {
                                if (m.toLowerCase() == "styleclass") {
                                    o.setAttribute("class", attObj[m])
                                } else {
                                    if (m.toLowerCase() != "classid") {
                                        o.setAttribute(m, attObj[m])
                                    }
                                }
                            }
                        }
                        for (var n in parObj) {
                            if (parObj[n] != Object.prototype[n] && n.toLowerCase() != "movie") {
                                createObjParam(o, n, parObj[n])
                            }
                        }
                        el.appendChild(o)
                    }
                }
            }
            return el
        }
        function createObjParam(el, pName, pValue) {
            var p = createElement("param");
            p.setAttribute("name", pName);
            p.setAttribute("value", pValue);
            el.appendChild(p)
        }
        function removeObjectInIE(el) {
            var jbo = (typeof(el) == "string" ? getElementById(el) : el);
            if (jbo) {
                for (var i in jbo) {
                    if (typeof jbo[i] == "function") {
                        jbo[i] = null
                    }
                }
                jbo.parentNode.removeChild(jbo)
            }
        }
        function removeSWF(id) {
            var obj = (typeof(id) == "string" ? getElementById(id) : id);
            if (obj) {
                if (obj.nodeName == "OBJECT" || obj.nodeName == "EMBED") {
                    if (ua.ie && ua.win) {
                        if (obj.readyState == 4) {
                            removeObjectInIE(id)
                        } else {
                            Vio.Ready(function() {
                                removeObjectInIE(id)
                            })
                        }
                    } else {
                        obj.parentNode.removeChild(obj)
                    }
                } else {
                    if (obj.childNodes && obj.childNodes.length > 0) {
                        for (var i = 0; i < obj.childNodes.length; i++) {
                            removeSWF(obj.childNodes[i])
                        }
                    }
                }
            }
        }
        function getElementById(id) {
            var el = null;
            try {
                el = doc.getElementById(id)
            } catch(e) {}
            return el
        }
        function createElement(el) {
            return doc.createElement(el)
        }
        function hasPlayerVersion(rv) {
            var pv = ua.pv,
            v = rv.split(".");
            v[0] = parseInt(v[0], 10);
            v[1] = parseInt(v[1], 10) || 0;
            v[2] = parseInt(v[2], 10) || 0;
            return (pv[0] > v[0] || (pv[0] == v[0] && pv[1] > v[1]) || (pv[0] == v[0] && pv[1] == v[1] && pv[2] >= v[2])) ? true: false
        }
        function setVisibility(id, isVisible) {
            var v = isVisible ? "visible": "hidden";
            var o = typeof(id) == "string" ? getElementById(id) : id;
            if (o) {
                o.style.visibility = v
            }
        }
        return {
            getObjectById: function(objectIdStr) {
                var r = null;
                if (ua.w3cdom) {
                    var o = (typeof(objectIdStr) == "string" ? getElementById(objectIdStr) : objectIdStr);
                    if (o) {
                        var n = o.getElementsByTagName(OBJECT)[0];
                        if (!n || (n && typeof o.SetVariable != UNDEF)) {
                            r = o
                        } else {
                            if (typeof n.SetVariable != UNDEF) {
                                r = n
                            }
                        }
                    }
                }
                return r
            },
            embedSWF: function(swfUrlStr, replaceElemIdStr, widthStr, heightStr, swfVersionStr, xiSwfUrlStr, flashvarsObj, parObj, attObj) {
                if (!ua.w3cdom || !swfUrlStr || !replaceElemIdStr || !widthStr || !heightStr || !swfVersionStr) {
                    return
                }
                widthStr += "";
                heightStr += "";
                if (hasPlayerVersion(swfVersionStr)) {
                    setVisibility(replaceElemIdStr, false);
                    var att = {};
                    if (attObj && typeof attObj === OBJECT) {
                        for (var i in attObj) {
                            if (attObj[i] != Object.prototype[i]) {
                                att[i] = attObj[i]
                            }
                        }
                    }
                    att.data = swfUrlStr;
                    att.width = widthStr;
                    att.height = heightStr;
                    var par = {};
                    if (parObj && typeof parObj === OBJECT) {
                        for (var j in parObj) {
                            if (parObj[j] != Object.prototype[j]) {
                                par[j] = parObj[j]
                            }
                        }
                    }
                    if (flashvarsObj && typeof flashvarsObj === OBJECT) {
                        for (var k in flashvarsObj) {
                            if (flashvarsObj[k] != Object.prototype[k]) {
                                if (typeof par.flashvars != UNDEF) {
                                    par.flashvars += "&" + k + "=" + flashvarsObj[k]
                                } else {
                                    par.flashvars = k + "=" + flashvarsObj[k]
                                }
                            }
                        }
                    }
                    Vio.Ready(function() {
                        createSWF(att, par, replaceElemIdStr);
                        setVisibility(replaceElemIdStr, true)
                    })
                } else {
                    if (xiSwfUrlStr && !isExpressInstallActive && hasPlayerVersion("6.0.65") && (ua.win || ua.mac)) {
                        isExpressInstallActive = true;
                        setVisibility(replaceElemIdStr, false);
                        Vio.Ready(function() {
                            var regObj = {};
                            regObj.id = regObj.altContentId = replaceElemIdStr;
                            regObj.width = widthStr;
                            regObj.height = heightStr;
                            regObj.expressInstall = xiSwfUrlStr;
                            showExpressInstall(regObj)
                        })
                    }
                }
            },
            getFlashPlayerVersion: function() {
                return {
                    major: ua.pv[0],
                    minor: ua.pv[1],
                    release: ua.pv[2]
                }
            },
            hasFlashPlayerVersion: hasPlayerVersion,
            createSWF: function(attObj, parObj, replaceElemIdStr) {
                return createSWF(attObj, parObj, replaceElemIdStr)
            },
            removeSWF: function(objElemIdStr) {
                removeSWF(objElemIdStr)
            },
            expressInstallCallback: function() {
                if (isExpressInstallActive && storedAltContent) {
                    var obj = getElementById(EXPRESS_INSTALL_ID);
                    if (obj) {
                        obj.parentNode.replaceChild(storedAltContent, obj);
                        if (storedAltContent) {
                            setVisibility(storedAltContent, true);
                            if (ua.ie && ua.win) {
                                storedAltContent.style.display = "block"
                            }
                        }
                        storedAltContent = null;
                        isExpressInstallActive = false
                    }
                }
            }
        }
    } (),
    GetScriptTag: function() {
        var A = document.getElementsByTagName("script");
        return A[A.length - 1]
    },
    Add: function(A, B) {
        Vio.Viostreams.push(new Viostream(A, B))
    },
    LoadParams: function() {
        var ScriptTag = this.GetScriptTag();
        try {
            var o = eval(ScriptTag.innerHTML);
            for (var a in o) {
                if (typeof(Vio[a]) != "function") {
                    Vio[a] = o[a]
                }
            }
        } catch(e) {}
    },
    EvalScript: function() {
        var ScriptTag = this.GetScriptTag();
        var i = Vio.Viostreams.length - 1;
        Vio.Viostreams[i].Tag = ScriptTag;
        try {
            var o = eval(ScriptTag.innerHTML);
            Vio.Viostreams[i].LoadParams(o)
        } catch(e) {}
    },
    Render: function() {
        for (var A = 0; A < Vio.Viostreams.length; A++) {
            Vio.Viostreams[A].Render()
        }
    }
};
Vio.Ready(function() {
    Vio.Render()
});
Vio.LoadParams();
//(function() {
//    if (navigator.plugins != null && navigator.plugins.length > 0) {
//        for (i = 0; i < navigator.plugins.length; i++) {
//            var A = navigator.plugins[i];
//            if (A.name.indexOf("QuickTime") > -1) {
//                Vio.QuicktimeVersion = parseFloat(A.name.substring(18))
//            }
//        }
//    } else {
//        if (Vio.browser.msie) {
//            document.write('<script language="VBScript"> \n');
//            document.write("on error resume next \n");
//            document.write("dim obQuicktime \n");
//            document.write('set obQuicktime = CreateObject("QuickTimeCheckObject.QuickTimeCheck.1") \n');
//            document.write("if IsObject(obQuicktime) then \n");
//            document.write("   if obQuicktime.IsQuickTimeAvailable(0) then \n");
//            document.write("      Vio.QuicktimeVersion = CInt(Hex(obQuicktime.QuickTimeVersion) / 1000000) \n");
//            document.write("   end if \n");
//            document.write("end if \n");
//            document.write("<\/script> \n")
//        }
//    }
//})();
//document.write('<link rel="stylesheet" type="text/css" href="' + Vio.STYLESHEET + '" />')
if(typeof(Sys)!=='undefined')Sys.Application.notifyScriptLoaded();