/* TOOL TIP SCRIPT*/

/***********************************************
* Fixed ToolTip script- © Dynamic Drive (www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for full source code
***********************************************/
		
var tipwidth='150px' //default tooltip width
var tipbgcolor='#EFEFEF'  //tooltip bgcolor
var disappeardelay=250  //tooltip disappear speed onMouseout (in miliseconds)
var vertical_offset="0px" //horizontal offset of tooltip from anchor link
var horizontal_offset="-3px" //horizontal offset of tooltip from anchor link

/////No further editting needed

var ie4=document.all
var ns6=document.getElementById&&!document.all

if (ie4||ns6)
document.write('<div id="fixedtipdiv" style="visibility:hidden;width:'+tipwidth+';background-color:'+tipbgcolor+'" ></div>')

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}


function showhide(obj, e, visible, hidden, tipwidth){
if (ie4||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (tipwidth!=""){
dropmenuobj.widthobj=dropmenuobj.style
dropmenuobj.widthobj.width=tipwidth
}
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=(whichedge=="rightedge")? parseInt(horizontal_offset)*-1 : parseInt(vertical_offset)*-1
if (whichedge=="rightedge"){
var windowedge=ie4 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var windowedge=ie4 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
}
return edgeoffset
}

function fixedtooltip(menucontents, obj, e, tipwidth){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
clearhidetip()
dropmenuobj=document.getElementById? document.getElementById("fixedtipdiv") : fixedtipdiv
dropmenuobj.innerHTML=menucontents

if (ie4||ns6){
showhide(dropmenuobj.style, e, "visible", "hidden", tipwidth)
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
}

function hidetip(e){
if (typeof dropmenuobj!="undefined"){
if (ie4||ns6)
dropmenuobj.style.visibility="hidden"
}
}

function delayhidetip(){
if (ie4||ns6)
delayhide=setTimeout("hidetip()",disappeardelay)
}

function clearhidetip(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}

  //do browser stuff
dom = (document.getElementById) ? true : false;
ns5 = ((navigator.userAgent.indexOf("Gecko")>-1) && dom) ? true: false;
ie5 = ((navigator.userAgent.indexOf("MSIE")>-1) && dom) ? true : false;
ns4 = (document.layers && !dom) ? true : false;
ie4 = (document.all && !dom) ? true : false;
nodyn = (!ns5 && !ns4 && !ie4 && !ie5) ? true : false;
var zIndexXPR = 1;
function showDiv(iidee)
{
zIndexXPR++;

var theLyr = (ns4)? document.layers[iidee] : (ie4)? document.all[iidee].style : (ie5||ns5)?   document.getElementById(iidee).style: null;				
theLyr.display= '';
theLyr.zIndex = zIndexXPR;
}

function hideDiv(iidee)
{
var theLyr = (ns4)? document.layers[iidee] : (ie4)? document.all[iidee].style : (ie5||ns5)?   document.getElementById(iidee).style: null;				
theLyr.display= 'none';
}

/*  JAVASCRIPT TABLE BUILDING SCRIPT */

var tdCount = 0;

function setupTable(tableName,columns) {

table = document.getElementById(tableName);
tb=document.createElement('tbody');

table.appendChild(tb);

tdCount = 0;
maxTD = columns;

}

function addTableCell(tableData) {

if (tdCount == 0) {
tr=document.createElement('tr');
tb.appendChild(tr);
} 
//create our new cell
td=document.createElement('td');
td.innerHTML=tableData;

//add our cell to the current row
tr.appendChild(td);

tdCount++;

if (tdCount == maxTD) {
tdCount = 0;
}

}



/* FORM VALIDATION SCRIPT */

function validateAll(which) {


var pass=true;
if (document.images) {

for (i=0;i<which.length;i++) {

var tempobj=which.elements[i];
if (tempobj.name.substring(0,1)=="*") {

if (((tempobj.type=="text"||tempobj.type=="textarea")&&
tempobj.value=='')||(tempobj.type.toString().charAt(0)=="s"&&
tempobj.selectedIndex==0)) {
pass=false;
break;
         }
      }
   }
}

if (!pass) {
shortFieldName=tempobj.name.substring(1,40).toUpperCase();
alert("Please make sure the "+shortFieldName+" field was properly completed.");
return false;
}
else
return true;
}


 /**
 * SWFObject v1.5.1: Flash Player detection and embed - http://blog.deconcept.com/swfobject/
 *
 * SWFObject is (c) 2007 Geoff Stearns and is released under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 *
 */
if(typeof deconcept == "undefined") var deconcept = {};
if(typeof deconcept.util == "undefined") deconcept.util = {};
if(typeof deconcept.SWFObjectUtil == "undefined") deconcept.SWFObjectUtil = {};
deconcept.SWFObject = function(swf, id, w, h, ver, c, quality, xiRedirectUrl, redirectUrl, detectKey) {
	if (!document.getElementById) { return; }
	this.DETECT_KEY = detectKey ? detectKey : 'detectflash';
	this.skipDetect = deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params = {};
	this.variables = {};
	this.attributes = [];
	if(swf) { this.setAttribute('swf', swf); }
	if(id) { this.setAttribute('id', id); }
	if(w) { this.setAttribute('width', w); }
	if(h) { this.setAttribute('height', h); }
	if(ver) { this.setAttribute('version', new deconcept.PlayerVersion(ver.toString().split("."))); }
	this.installedVer = deconcept.SWFObjectUtil.getPlayerVersion();
	if (!window.opera && document.all && this.installedVer.major > 7) {
		// only add the onunload cleanup if the Flash Player version supports External Interface and we are in IE
		// fixes bug in some fp9 versions see http://blog.deconcept.com/2006/07/28/swfobject-143-released/
		if (!deconcept.unloadSet) {
			deconcept.SWFObjectUtil.prepUnload = function() {
				__flash_unloadHandler = function(){};
				__flash_savedUnloadHandler = function(){};
				window.attachEvent("onunload", deconcept.SWFObjectUtil.cleanupSWFs);
			}
			window.attachEvent("onbeforeunload", deconcept.SWFObjectUtil.prepUnload);
			deconcept.unloadSet = true;
		}
	}
	if(c) { this.addParam('bgcolor', c); }
	var q = quality ? quality : 'high';
	this.addParam('quality', q);
	this.setAttribute('useExpressInstall', false);
	this.setAttribute('doExpressInstall', false);
	var xir = (xiRedirectUrl) ? xiRedirectUrl : window.location;
	this.setAttribute('xiRedirectUrl', xir);
	this.setAttribute('redirectUrl', '');
	if(redirectUrl) { this.setAttribute('redirectUrl', redirectUrl); }
}
deconcept.SWFObject.prototype = {
	useExpressInstall: function(path) {
		this.xiSWFPath = !path ? "expressinstall.swf" : path;
		this.setAttribute('useExpressInstall', true);
	},
	setAttribute: function(name, value){
		this.attributes[name] = value;
	},
	getAttribute: function(name){
		return this.attributes[name] || "";
	},
	addParam: function(name, value){
		this.params[name] = value;
	},
	getParams: function(){
		return this.params;
	},
	addVariable: function(name, value){
		this.variables[name] = value;
	},
	getVariable: function(name){
		return this.variables[name] || "";
	},
	getVariables: function(){
		return this.variables;
	},
	getVariablePairs: function(){
		var variablePairs = [];
		var key;
		var variables = this.getVariables();
		for(key in variables){
			variablePairs[variablePairs.length] = key +"="+ variables[key];
		}
		return variablePairs;
	},
	getSWFHTML: function() {
		var swfNode = "";
		if (navigator.plugins && navigator.mimeTypes && navigator.mimeTypes.length) { // netscape plugin architecture
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "PlugIn");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<embed type="application/x-shockwave-flash" src="'+ this.getAttribute('swf') +'" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'"';
			swfNode += ' id="'+ this.getAttribute('id') +'" name="'+ this.getAttribute('id') +'" ';
			var params = this.getParams();
			 for(var key in params){ swfNode += [key] +'="'+ params[key] +'" '; }
			var pairs = this.getVariablePairs().join("&");
			 if (pairs.length > 0){ swfNode += 'flashvars="'+ pairs +'"'; }
			swfNode += '/>';
		} else { // PC IE
			if (this.getAttribute("doExpressInstall")) {
				this.addVariable("MMplayerType", "ActiveX");
				this.setAttribute('swf', this.xiSWFPath);
			}
			swfNode = '<object id="'+ this.getAttribute('id') +'" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="'+ this.getAttribute('width') +'" height="'+ this.getAttribute('height') +'" style="'+ (this.getAttribute('style') || "") +'">';
			swfNode += '<param name="movie" value="'+ this.getAttribute('swf') +'" />';
			var params = this.getParams();
			for(var key in params) {
			 swfNode += '<param name="'+ key +'" value="'+ params[key] +'" />';
			}
			var pairs = this.getVariablePairs().join("&");
			if(pairs.length > 0) {swfNode += '<param name="flashvars" value="'+ pairs +'" />';}
			swfNode += "</object>";
		}
		return swfNode;
	},
	write: function(elementId){
		if(this.getAttribute('useExpressInstall')) {
			// check to see if we need to do an express install
			var expressInstallReqVer = new deconcept.PlayerVersion([6,0,65]);
			if (this.installedVer.versionIsValid(expressInstallReqVer) && !this.installedVer.versionIsValid(this.getAttribute('version'))) {
				this.setAttribute('doExpressInstall', true);
				this.addVariable("MMredirectURL", escape(this.getAttribute('xiRedirectUrl')));
				document.title = document.title.slice(0, 47) + " - Flash Player Installation";
				this.addVariable("MMdoctitle", document.title);
			}
		}
		if(this.skipDetect || this.getAttribute('doExpressInstall') || this.installedVer.versionIsValid(this.getAttribute('version'))){
			var n = (typeof elementId == 'string') ? document.getElementById(elementId) : elementId;
			n.innerHTML = this.getSWFHTML();
			return true;
		}else{
			if(this.getAttribute('redirectUrl') != "") {
				document.location.replace(this.getAttribute('redirectUrl'));
			}
		}
		return false;
	}
}

/* ---- detection functions ---- */
deconcept.SWFObjectUtil.getPlayerVersion = function(){
	var PlayerVersion = new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins && navigator.mimeTypes.length){
		var x = navigator.plugins["Shockwave Flash"];
		if(x && x.description) {
			PlayerVersion = new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|s)+/, "").replace(/(s+r|s+b[0-9]+)/, ".").split("."));
		}
	}else if (navigator.userAgent && navigator.userAgent.indexOf("Windows CE") >= 0){ // if Windows CE
		var axo = 1;
		var counter = 3;
		while(axo) {
			try {
				counter++;
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash."+ counter);
//				document.write("player v: "+ counter);
				PlayerVersion = new deconcept.PlayerVersion([counter,0,0]);
			} catch (e) {
				axo = null;
			}
		}
	} else { // Win IE (non mobile)
		// do minor version lookup in IE, but avoid fp6 crashing issues
		// see http://blog.deconcept.com/2006/01/11/getvariable-setvariable-crash-internet-explorer-flash-6/
		try{
			var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7");
		}catch(e){
			try {
				var axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				PlayerVersion = new deconcept.PlayerVersion([6,0,21]);
				axo.AllowScriptAccess = "always"; // error if player version < 6.0.47 (thanks to Michael Williams @ Adobe for this code)
			} catch(e) {
				if (PlayerVersion.major == 6) {
					return PlayerVersion;
				}
			}
			try {
				axo = new ActiveXObject("ShockwaveFlash.ShockwaveFlash");
			} catch(e) {}
		}
		if (axo != null) {
			PlayerVersion = new deconcept.PlayerVersion(axo.GetVariable("$version").split(" ")[1].split(","));
		}
	}
	return PlayerVersion;
}
deconcept.PlayerVersion = function(arrVersion){
	this.major = arrVersion[0] != null ? parseInt(arrVersion[0]) : 0;
	this.minor = arrVersion[1] != null ? parseInt(arrVersion[1]) : 0;
	this.rev = arrVersion[2] != null ? parseInt(arrVersion[2]) : 0;
}
deconcept.PlayerVersion.prototype.versionIsValid = function(fv){
	if(this.major < fv.major) return false;
	if(this.major > fv.major) return true;
	if(this.minor < fv.minor) return false;
	if(this.minor > fv.minor) return true;
	if(this.rev < fv.rev) return false;
	return true;
}
/* ---- get value of query string param ---- */
deconcept.util = {
	getRequestParameter: function(param) {
		var q = document.location.search || document.location.hash;
		if (param == null) { return q; }
		if(q) {
			var pairs = q.substring(1).split("&");
			for (var i=0; i < pairs.length; i++) {
				if (pairs[i].substring(0, pairs[i].indexOf("=")) == param) {
					return pairs[i].substring((pairs[i].indexOf("=")+1));
				}
			}
		}
		return "";
	}
}
/* fix for video streaming bug */
deconcept.SWFObjectUtil.cleanupSWFs = function() {
	var objects = document.getElementsByTagName("OBJECT");
	for (var i = objects.length - 1; i >= 0; i--) {
		objects[i].style.display = 'none';
		for (var x in objects[i]) {
			if (typeof objects[i][x] == 'function') {
				objects[i][x] = function(){};
			}
		}
	}
}
/* add document.getElementById if needed (mobile IE < 5) */
if (!document.getElementById && document.all) { document.getElementById = function(id) { return document.all[id]; }}

/* add some aliases for ease of use/backwards compatibility */
var getQueryParamValue = deconcept.util.getRequestParameter;
var FlashObject = deconcept.SWFObject; // for legacy support
var SWFObject = deconcept.SWFObject;



/* FLASH VIDEO PROFILER SCRIPT */

function loadFlashVideoScreen(movieName)
{

crossobj= document.getElementById("fhREVideoScreen");


crossobj.innerHTML= '<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,0,0" width="320" height="256" id="flvplayer" align="middle"> <param name="allowScriptAccess" value="sameDomain" /> <param name="movie" value="/media/flvplayerManual.swf?file='+movieName+'" /> <param name="menu" value="false" /> <param name="quality" value="high" /> <PARAM NAME=wmode VALUE=transparent><param name="autoplay" value="false" /><param name="autostart" value="0" /><embed src="/media/flvplayerManual.swf?file='+movieName+'" menu="false" quality="high" wmode=transparent width="320" height="256" name="flvplayer" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" autostart="false"/></object>';

return false;

}

/*
 * touchSwipe - jQuery Plugin
 * http://plugins.jquery.com/project/touchSwipe
 * http://labs.skinkers.com/touchSwipe/
 *
 * Copyright (c) 2010 Matt Bryson (www.skinkers.com)
 * Dual licensed under the MIT or GPL Version 2 licenses.
 *
 * $version: 1.2.3
 * This jQuery plugin will only run on devices running Mobile Webkit based browsers (iOS 2.0+, android 2.2+)
 */
 
(function($){$.fn.swipe=function(options){if(!this)return false;var defaults={fingers:1,threshold:75,swipe:null,swipeLeft:null,swipeRight:null,swipeUp:null,swipeDown:null,swipeStatus:null,click:null,triggerOnTouchEnd:true,allowPageScroll:"auto"};var LEFT="left";var RIGHT="right";var UP="up";var DOWN="down";var NONE="none";var HORIZONTAL="horizontal";var VERTICAL="vertical";var AUTO="auto";var PHASE_START="start";var PHASE_MOVE="move";var PHASE_END="end";var PHASE_CANCEL="cancel";var phase="start";if(options.allowPageScroll==undefined&&(options.swipe!=undefined||options.swipeStatus!=undefined))options.allowPageScroll=NONE;if(options)$.extend(defaults,options);return this.each(function(){var $this=$(this);var triggerElementID=null;var fingerCount=0;var start={x:0,y:0};var end={x:0,y:0};var delta={x:0,y:0};function touchStart(event){phase=PHASE_START;fingerCount=event.touches.length;distance=0;direction=null;if(fingerCount==defaults.fingers){start.x=end.x=event.touches[0].pageX;start.y=end.y=event.touches[0].pageY;if(defaults.swipeStatus)triggerHandler(event,phase);}else{touchCancel(event);}}
function touchMove(event){if(phase==PHASE_END||phase==PHASE_CANCEL)return;end.x=event.touches[0].pageX;end.y=event.touches[0].pageY;direction=caluculateDirection();fingerCount=event.touches.length;phase=PHASE_MOVE
validateDefaultEvent(event,direction);if(fingerCount==defaults.fingers){distance=caluculateDistance();if(defaults.swipeStatus)triggerHandler(event,phase,direction,distance);if(!defaults.triggerOnTouchEnd){if(distance>=defaults.threshold){phase=PHASE_END;triggerHandler(event,phase);touchCancel(event);}}}else{phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event);}}
function touchEnd(event){event.preventDefault();distance=caluculateDistance();direction=caluculateDirection();if(defaults.triggerOnTouchEnd){phase=PHASE_END;if(fingerCount==defaults.fingers&&end.x!=0){if(distance>=defaults.threshold){triggerHandler(event,phase);touchCancel(event);}else{phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event);}}else{phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event);}}else if(phase==PHASE_MOVE){phase=PHASE_CANCEL;triggerHandler(event,phase);touchCancel(event);}}
function touchCancel(event){fingerCount=0;start.x=0;start.y=0;end.x=0;end.y=0;delta.x=0;delta.y=0;}
function triggerHandler(event,phase){if(defaults.swipeStatus)defaults.swipeStatus.call($this,event,phase,direction||null,distance||0);if(phase==PHASE_CANCEL){if(defaults.click&&fingerCount==1&&(isNaN(distance)||distance==0))defaults.click.call($this,event,event.target);}
if(phase==PHASE_END){if(defaults.swipe){defaults.swipe.call($this,event,direction,distance);}
switch(direction){case LEFT:if(defaults.swipeLeft)defaults.swipeLeft.call($this,event,direction,distance);break;case RIGHT:if(defaults.swipeRight)defaults.swipeRight.call($this,event,direction,distance);break;case UP:if(defaults.swipeUp)defaults.swipeUp.call($this,event,direction,distance);break;case DOWN:if(defaults.swipeDown)defaults.swipeDown.call($this,event,direction,distance);break;}}}
function validateDefaultEvent(event,direction){if(defaults.allowPageScroll==NONE){event.preventDefault();}else{var auto=defaults.allowPageScroll==AUTO;switch(direction){case LEFT:if((defaults.swipeLeft&&auto)||(!auto&&defaults.allowPageScroll!=HORIZONTAL))event.preventDefault();break;case RIGHT:if((defaults.swipeRight&&auto)||(!auto&&defaults.allowPageScroll!=HORIZONTAL))event.preventDefault();break;case UP:if((defaults.swipeUp&&auto)||(!auto&&defaults.allowPageScroll!=VERTICAL))event.preventDefault();break;case DOWN:if((defaults.swipeDown&&auto)||(!auto&&defaults.allowPageScroll!=VERTICAL))event.preventDefault();break;}}}
function caluculateDistance(){return Math.round(Math.sqrt(Math.pow(end.x-start.x,2)+Math.pow(end.y-start.y,2)));}
function caluculateAngle(){var X=start.x-end.x;var Y=end.y-start.y;var r=Math.atan2(Y,X);var angle=Math.round(r*180/Math.PI);if(angle<0)angle=360-Math.abs(angle);return angle;}
function caluculateDirection(){var angle=caluculateAngle();if((angle<=45)&&(angle>=0))return LEFT;else if((angle<=360)&&(angle>=315))return LEFT;else if((angle>=135)&&(angle<=225))return RIGHT;else if((angle>45)&&(angle<135))return DOWN;else return UP;}
try{this.addEventListener("touchstart",touchStart,false);this.addEventListener("touchmove",touchMove,false);this.addEventListener("touchend",touchEnd,false);this.addEventListener("touchcancel",touchCancel,false);}catch(e){}});};})(jQuery);


/*  
 *  Gallerize : jQuery image slider plugin version 2.3
 *
 *  Written by Felix Wang @ Backbone Technology
 *  © Backbone Technology inc.
 *  http://www.backbonetechnology.com
 *
 */
 
/*  
 *  Gallerize : jQuery image slider plugin version 2.3
 *
 *  Written by Felix Wang @ Backbone Technology
 *  © Backbone Technology inc.
 *  http://www.backbonetechnology.com
 *
 */

(function($){$.widget("ui.gallerize",{options:{slider:null,item:null,itemsPerRow:1,itemClickable:false,itemEvent:null,modernizr:false,touchswipe:false,touchswipeInit:null,continuous:true,speed:500,current:0,width:'100%',height:'auto',sliderW:0,overallWidth:0,autoplay:false,duration:7000,timer:null,imgInCSS:false,img:null,imgCon:null,imgPos:'center center',before:null,after:null,navigation:false,prev:null,next:null,prevEvent:null,nextEvent:null,pager:false,pagerCon:'',pagerNum:true,pagerTitle:false,pagerTitleClass:'',pagerItemClass:''},_create:function(){var self=this;var o=self.options;var el=self.element;var slider=$(o.slider,el);var item=$(o.item,el);var total=Math.ceil(parseInt(item.length)/parseInt(o.itemsPerRow));var width=o.width;var sliderW=total*width;var speed=o.speed;var is_trans=false;var duration=o.duration;var pager=$(o.pagerCon);var pager_row=0;var isTouchSwipe=false;if(o.overallWidth>0)slider.css({width:overallWidth});else slider.css({width:sliderW});item.each(function(i){if(o.imgInCSS){var img=$(o.img,this).attr('src');if(!o.imgCon)$(this).css({background:'url("'+img+'") no-repeat '+o.imgPos});else $(o.imgCon,this).css({background:'url("'+img+'") no-repeat 50% 50%'});}
if(o.pager){var title=$(o.pagerTitleClass,this).html();if(o.pagerNum){$('<li id="pager-'+i+'" class="count-'+i+' pager-item '+o.pagerItemClass+'"><a>'+(i+1)+'</a></li>').appendTo(o.pagerCon,el);}else if(o.pagerTitle){$('<li id="pager-'+i+'" class="count-'+i+' pager-item '+o.pagerItemClass+'"><a>'+title+'</a></li>').appendTo(o.pagerCon,el);}else{$('<li id="pager-'+i+'" class="count-'+i+' pager-item '+o.pagerItemClass+'"><a></a></li>').appendTo(o.pagerCon,el);}}});if(o.pager){$('li.pager-item a',pager).click(function(e){e.preventDefault();pager.find('.active').removeClass('active');o.current=$(this).parents('li').attr('id').replace('pager-','');$(this).parents('li').addClass('active');slide();});}
if(o.navigation){el.find(o.prev).click(prev);el.find(o.next).click(next);}
item.eq(o.current).addClass('current');slide();if(o.autoplay){if(Modernizr.touch&&o.touchswipe){}else{o.timer=setTimeout(function(){autoplay_next()},duration);}}
function autoplay_next(){o.current++;if(o.current>total-1){if(o.continuous)o.current=0;else o.current=total-1;}
slide();}
if(o.touchswipe)if(Modernizr.touch)touch();function touch(){isTouchSwipe=true;slider.swipe({triggerOnTouchEnd:true,swipeStatus:swipeStatus,allowPageScroll:"vertical",threshold:200});}
function swipeStatus(event,phase,direction,distance){if(typeof o.bofore=='function')o.before.call(this);if(phase=="move"&&(direction=="left"||direction=="right")){var duration=0;if(direction=="left")scrollImages((width*o.current)+distance,duration);else if(direction=="right")scrollImages((width*o.current)-distance,duration);}else if(phase=="cancel"){scrollImages(width*o.current,speed);}else if(phase=="end"){if(direction=="right")touch_prev();else if(direction=="left")touch_next();if(typeof o.after=='function')o.after.call(this);}}
function touch_prev(){o.current=Math.max(o.current-1,0);scrollImages(width*o.current,speed);}
function touch_next(){o.current=Math.min(o.current+1,total-1);scrollImages(width*o.current,speed);}
function scrollImages(distance,duration){slider.css("-webkit-transition-duration",(duration/1000).toFixed(1)+"s");var value=(distance<0?"":"-")+Math.abs(distance).toString();slider.css("-webkit-transform","translate3d("+value+"px,0px,0px)");}
function prev(e){e.preventDefault();if(Modernizr.touch){if(o.touchswipe)touch_prev();}else{if(!o.modernizr){if(!is_trans){is_trans=true;prev_process();}}else{prev_process();}}}
function prev_process(){o.current--;if(o.current<0){if(o.continuous)o.current=total-1;else o.current=0;}
if(typeof o.prevEvent=='function')o.prevEvent.call(this);slide();}
function next(e){e.preventDefault();if(Modernizr.touch){if(o.touchswipe)touch_next();}else{if(!o.modernizr){if(!is_trans){is_trans=true;next_process();}}else{next_process();}}}
function next_process(){o.current++;if(o.current>total-1){if(o.continuous)o.current=0;else o.current=total-1;}
if(typeof o.nextEvent=='function')o.nextEvent.call(this);slide();}
function slide(){if(!o.touchswipe&&o.autoplay){clearTimeout(o.timer);o.timer=setTimeout(function(){autoplay_next()},duration);}
if(typeof o.before=='function')o.before.call(this);var pos=-(o.current*width);if(o.modernizr){if(Modernizr.touch){slider.css({"-webkit-transform":'translate('+pos+'px,0)'});}else if(Modernizr.csstransitions){slider.css({left:pos});}else{slider.animate({left:pos},speed);}}else{slider.animate({left:pos},speed,function(){is_trans=false;});}
item.each(function(){if($(this).hasClass('current'))item.removeClass('current');});item.eq(o.current).addClass('current');if(o.pager){pager.find('.active').removeClass('active');pager.find('.pager-item').eq(o.current).addClass('active');}
if(typeof o.after=='function')o.after.call(this);}},set_current:function(value){this.options.current=value;},set_autoplay:function(value){if(value==false){clearTimeout(this.options.timer);}else{clearTimeout(this.options.timer);this.options.timer=setTimeout();}
this.options.autoplay=value;},update:function(){this.element.find(this.options.slider).css({left:-(this.options.current*this.options.width)});},destroy:function(){$.Widget.prototype.destroy.apply(this,arguments);}});})(jQuery);

var openPopup = window.open;

function show_msg(msg) { alert(msg); }

function validateForm() {
	missing_required = 0;

	for (i = 0; i < arguments.length; i++) {
		if(arguments[i] == '') {
			missing_required = 1;
		}
	}

	if(missing_required) {
		alert("A required form field is missing.");
		return false;
	} else {
		return true;
	}
}

function expCustomLink(myURL) {
	location.href = myURL;
}

function setUrl(path) {
	document.location.href = path;
}

function expArticleLink(sectionId, articleId) {
	location.href = '/index.php?section_id=' + sectionId + '&section_copy_id=' + articleId;
}

function expPopupWindow(url, widthVal, heightVal, resizableVal, scrollbarsVal, toolbarVal, locationVal, directoriesVal, statusVal, menubarVal, copyHistoryVal) {

	var attributes = "width="  	 	 + widthVal       +
				 	 ",height=" 	 + heightVal      +
				 	 ",resizable="  + resizableVal  +
				 	 ",scrollbars="  + scrollbarsVal  +
				 	 ",toolbar=" 	 + toolbarVal 	  +
				 	 ",location=" 	 + locationVal 	  +
				 	 ",directories=" + directoriesVal +
				 	 ",status=" 	 + statusVal 	  +
				 	 ",menubar=" 	 + menubarVal 	  +
				 	 ",copyhistory=" + copyHistoryVal;

	window.open(url, 'WindowName', attributes);
}

function xprLog(msg) {
    if (window.console) console.log(msg);
}

if (document.addEventListener) {  
    document.addEventListener("DOMContentLoaded", function () { if (typeof onXprPageLoad == 'function') onXprPageLoad(); }, false);
} else if (document.attachEvent) {  
    document.attachEvent('DOMContentLoaded', function () { if (typeof onXprPageLoad == 'function') onXprPageLoad(); });
}  

