// JavaScript Document
//Funtion to resize de layer of the main content depending of the user's resolution
function resizelayermaincontent(){
var elem = document.getElementById("MainContent");
var news = document.getElementById("NewsBar");
var man = document.getElementById("Main");

if(screen.height<=780){
	elem.style.height = "550px";
	news.style.height = "470px";
	man.style.height = "470px";
	
}
else if(screen.height >781 && screen.height<=800){
	elem.style.height = "570px";
	news.style.height = "490px";
	man.style.height = "490px";
	
}


}


//Function to change the background color of a layer
function changebackgroundcolor(layer, layercolor,textcolor){
document.getElementById(layer).style.background = layercolor;

}

function popWindow(theURL, winName, features) {
	window.open(theURL, winName, features);
}


// Header Javascript/dhtml menu code
// preload


// dhtml flyout menu; old codebase.

var activeSub=0;
var SubNum=0;

//Define global variables
var timerID = null;
var timerOn = false;
var timecount = 4000;
var what = null;
var newbrowser = true;
var check = false;
var selectvisible = true;
var monthselectvisible = true;
var screenSize = 2000;
var menuTop = 48;

function reDo(){ if((check) && (what!="ns4")) window.location.reload() }
window.onresize = reDo;


function init() {

	if (document.layers) {
		layerRef="document.layers";
		styleSwitch="";
		visibleVar="show";
		screenSize = window.innerWidth;
		what ="ns4";
		menuTop = 116;
		//alert('layers!');

	} else if(document.all) {
		layerRef="document.all";
		styleSwitch=".style";
		visibleVar="visible";
		screenSize = document.body.clientWidth + 19;
		what ="ie";
		
	} else if(document.getElementById) { //for safari, mozilla and opera
		layerRef="document.getElementByID";
		styleSwitch=".style";
		screenSize = window.innerWidth;
		visibleVar="visible";
		what="moz";
		if (/Firefox[\/\s](\d+\.\d+)/.test(navigator.userAgent)){
			what = "ff";
		}
	

	} else {
		what="none";
		newbrowser = false;
	
	}

	if(newbrowser && (what!="ns4"))	{
		document.body.onmouseup = closeMenus;
	}
	check = true;
}




// set left and top for a layer
function positionLayer(layerName,leftOffset)
{
	if (what =="none") return;
	else if (what == "moz")
	{
		if(screenSize<990)
			document.getElementById(layerName).style.left = leftOffset+10+'px';
		else
			document.getElementById(layerName).style.left = ((screenSize-990)/2)+leftOffset+10+'px';
		
	}else if (what == "ff"){
		if(screenSize<990){
				document.getElementById(layerName).style.left = leftOffset+11+'px';
				document.getElementById(layerName).style.width = '158px';
		}
		else{
				document.getElementById(layerName).style.left = ((screenSize-990)/2)+leftOffset+11+'px';
				document.getElementById(layerName).style.width = '159px';
		}
	}
	else//for IE
	{
		eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.width="159px"');
		if(screenSize<990){
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left="'+(leftOffset+11+'px"'));	
		}
		else{

			if(((screenSize-990)%2)==0){
				eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left="'+(((screenSize-990)/2)+leftOffset+1+'px"'));
			}else{
				eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left="'+(((screenSize-990)/2)+leftOffset+'px"'));
			}
		}
		

	}	
}



// Turns the layers on and off
function showLayer(layerName) {

	if((check)&&(what!="ns4")) {
		hideAll();
		if (what =="none") return;
		else if (what == "moz"|| what =="ff")	{
			document.getElementById(layerName).style.visibility="visible";
		} else {
			eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="visible"');
			//if (  (what=="ie") && (eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left').substring(0,eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.left').length-2)>650) )
		}

	} else {
		return;
	}
	stopTime();
}

function hideLayer(layerName) {
	if((check)&&(what!="ns4")) {
		if (what =="none") return;
		else if (what == "moz"|| what =="ff") document.getElementById(layerName).style.visibility="hidden";
		else eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility="hidden"');		
	} else {
		return;
	}
}

function hideAll() {
	//hideLayer('AboutUsSubMenu');
	changebackgroundcolor("AboutUs", "none","#A9D9BB");
}

function closeMenus() {

	
	if(check){
		hideAll();
	}
}

function startTime() {

	if (what=="ns4") {
		closeMenus();
	} else if (timerOn == false) {
		timerID=setTimeout( "closeMenus()" , timecount);
		timerOn = true;
	}
}

function stopTime() {
	if (timerOn) {
		clearTimeout(timerID);
		timerID = null;
		timerOn = false;
		changebackgroundcolor("AboutUs", "#A9D9BB","none");
	}
}

function onLoad() {
	init();
}

/////////////////////////////////////////////////////////////////////////////////
function jsScrollbar (o, s, a, ev) {
	var self = this;
	this.reset = function () {
		//Arguments that were passed
		this._parent = o;
		this._src    = s;
		this.auto    = a ? a : false;
		this.eventHandler = ev ? ev : function () {};
		//Component Objects
		this._up   = this._findComponent("Scrollbar-Up", this._parent);
		this._down = this._findComponent("Scrollbar-Down", this._parent);
		this._yTrack  = this._findComponent("Scrollbar-Track", this._parent);
		this._yHandle = this._findComponent("Scrollbar-Handle", this._yTrack);
		
		
		//Height and position properties
		this._trackTop = findOffsetTop(this._yTrack);
		this._trackHeight  = this._yTrack.offsetHeight;
		this._handleHeight = this._yHandle.offsetHeight;
		this._x = 0;
		this._y = 0;
		//Misc. variables
		this._scrollDist  = 5;
		this._scrollTimer = null;
		this._selectFunc  = null;
		this._grabPoint   = null;
		this._tempTarget  = null;
		this._tempDistX   = 0;
		this._tempDistY   = 0;
		this._disabled    = false;
		this._ratio = (this._src.totalHeight - this._src.viewableHeight)/(this._trackHeight - this._handleHeight);
		
		this._yHandle.ondragstart  = function () {return false;};
		this._yHandle.onmousedown = function () {return false;};
		this._addEvent(this._src.content, "mousewheel", this._scrollbarWheel);
		this._removeEvent(this._parent, "mousedown", this._scrollbarClick);
		this._addEvent(this._parent, "mousedown", this._scrollbarClick);
		
		this._src.reset();
		with (this._yHandle.style) {
			top  = "0px";
			left = "0px";
		}
		this._moveContent();
		
		if (this._src.totalHeight < this._src.viewableHeight) {
			this._disabled = true;
			this._yHandle.style.visibility = "hidden";
			if (this.auto) this._parent.style.visibility = "hidden";
		} else {
			this._disabled = false;
			this._yHandle.style.visibility = "visible";
			this._parent.style.visibility  = "visible";
		}
	};
	this._addEvent = function (o, t, f) {
		if (o.addEventListener) o.addEventListener(t, f, false);
		else if (o.attachEvent) o.attachEvent('on'+ t, f);
		else o['on'+ t] = f;
	};
	this._removeEvent = function (o, t, f) {
		if (o.removeEventListener) o.removeEventListener(t, f, false);
		else if (o.detachEvent) o.detachEvent('on'+ t, f);
		else o['on'+ t] = null;
	};
	this._findComponent = function (c, o) {
		var kids = o.childNodes;
		for (var i = 0; i < kids.length; i++) {
			if (kids[i].className && kids[i].className == c) {
				return kids[i];
			}
		}
	};
	
	function findOffsetTop (o) {
		var t = 0;
		if (o.offsetParent) {
			while (o.offsetParent) {
				t += o.offsetTop;
				o  = o.offsetParent;
			}
		}
		return t;
	};
	this._scrollbarClick = function (e) {
		if (self._disabled) return false;
		
		e = e ? e : event;
		if (!e.target) e.target = e.srcElement;
		
		if (e.target.className.indexOf("Scrollbar-Up") > -1) self._scrollUp(e);
		else if (e.target.className.indexOf("Scrollbar-Down") > -1) self._scrollDown(e);
		else if (e.target.className.indexOf("Scrollbar-Track") > -1) self._scrollTrack(e);
		else if (e.target.className.indexOf("Scrollbar-Handle") > -1) self._scrollHandle(e);
		
		self._tempTarget = e.target;
		self._selectFunc = document.onselectstart;
		document.onselectstart = function () {return false;};
		
		self.eventHandler(e.target, "mousedown");
		self._addEvent(document, "mouseup", self._stopScroll, false);
		
		return false;
	};
	this._scrollbarDrag = function (e) {
		e = e ? e : event;
		var t = parseInt(self._yHandle.style.top);
		var v = e.clientY + document.body.scrollTop - self._trackTop;
		with (self._yHandle.style) {
			if (v >= self._trackHeight - self._handleHeight + self._grabPoint)
				top = self._trackHeight - self._handleHeight +"px";
			else if (v <= self._grabPoint) top = "0px";
			else top = v - self._grabPoint +"px";
			self._y = parseInt(top);
		}
		
		self._moveContent();
	};
	this._scrollbarWheel = function (e) {
		e = e ? e : event;
		var dir = 0;
		if (e.wheelDelta >= 120) dir = -1;
		if (e.wheelDelta <= -120) dir = 1;
		
		self.scrollBy(0, dir * 20);
		e.returnValue = false;
	};
	this._startScroll = function (x, y) {
		this._tempDistX = x;
		this._tempDistY = y;
		this._scrollTimer = window.setInterval(function () {
			self.scrollBy(self._tempDistX, self._tempDistY); 
		}, 40);
	};
	this._stopScroll = function () {
		self._removeEvent(document, "mousemove", self._scrollbarDrag, false);
		self._removeEvent(document, "mouseup", self._stopScroll, false);
		
		if (self._selectFunc) document.onselectstart = self._selectFunc;
		else document.onselectstart = function () { return true; };
		
		if (self._scrollTimer) window.clearInterval(self._scrollTimer);
		self.eventHandler (self._tempTarget, "mouseup");
	};
	this._scrollUp = function (e) {this._startScroll(0, -this._scrollDist);};
	this._scrollDown = function (e) {this._startScroll(0, this._scrollDist);};
	this._scrollTrack = function (e) {
		var curY = e.clientY + document.body.scrollTop;
		this._scroll(0, curY - this._trackTop - this._handleHeight/2);
	};
	this._scrollHandle = function (e) {
		var curY = e.clientY + document.body.scrollTop;
		this._grabPoint = curY - findOffsetTop(this._yHandle);
		this._addEvent(document, "mousemove", this._scrollbarDrag, false);
	};
	this._scroll = function (x, y) {
		if (y > this._trackHeight - this._handleHeight) 
			y = this._trackHeight - this._handleHeight;
		if (y < 0) y = 0;
		
		this._yHandle.style.top = y +"px";
		this._y = y;
		
		this._moveContent();
	};
	this._moveContent = function () {
		this._src.scrollTo(0, Math.round(this._y * this._ratio));
	};
	
	this.scrollBy = function (x, y) {
		this._scroll(0, (-this._src._y + y)/this._ratio);
	};
	this.scrollTo = function (x, y) {
		this._scroll(0, y/this._ratio);
	};
	this.swapContent = function (o, w, h) {
		this._removeEvent(this._src.content, "mousewheel", this._scrollbarWheel, false);
		this._src.swapContent(o, w, h);
		this.reset();
	};
	
	this.reset();
}

///////////////////////////////////////////////////////////////////////////////////

function jsScroller (o, w, h) {
	var self = this;
	var list = o.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf("Scroller-Container") > -1) {
				o = list[i];
			}	
	}
	
	//Private methods
	this._setPos = function (x, y) {
		if (x < this.viewableWidth - this.totalWidth) 
			x = this.viewableWidth - this.totalWidth;
		if (x > 0) x = 0;
		if (y < this.viewableHeight - this.totalHeight) 
			y = this.viewableHeight - this.totalHeight;
		if (y > 0) y = 0;
		this._x = x;
		this._y = y;
		with (o.style) {
			left = this._x +"px";
			top  = this._y +"px";
		}
	};
	
	//Public Methods
	this.reset = function () {
		this.content = o;
		this.totalHeight = o.offsetHeight;
		this.totalWidth	 = o.offsetWidth;
		this._x = 0;
		this._y = 0;
		with (o.style) {
			left = "0px";
			top  = "0px";
		}
	};
	this.scrollBy = function (x, y) {
		this._setPos(this._x + x, this._y + y);
	};
	this.scrollTo = function (x, y) {
		this._setPos(-x, -y);
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.startScroll = function (x, y) {
		this.stopScroll();
		this.scrollTimer = window.setInterval(
			function(){ self.scrollBy(x, y); }, 40
		);
	};
	this.swapContent = function (c, w, h) {
		o = c;
		var list = o.getElementsByTagName("div");
		for (var i = 0; i < list.length; i++) {
		
			
				if (list[i].className.indexOf("Scroller-Container") > -1) {
					o = list[i];
				}
		
							
		}
		if (w) this.viewableWidth  = w;
		if (h) this.viewableHeight = h;
		this.reset();
	};
	
	//variables
	this.content = o;
	this.viewableWidth  = w;
	this.viewableHeight = h;
	this.totalWidth	 = o.offsetWidth;
	this.totalHeight = o.offsetHeight;
	this.scrollTimer = null;
	this.reset();
}

/////////////////////////////////////////////////////////////////////////////////////////////////

function jsScrollerTween (o, t, s) {
	var self = this;
	
	this._tweenTo = function (y) {
		if (self._idle) {
			var tHeight = self._parent._src ? self._parent._src.totalHeight : self._parent.totalHeight;
			var vHeight = self._parent._src ? self._parent._src.viewableHeight : self._parent.viewableHeight;
			var scrollY = self._parent._src ? self._parent._src._y : self._parent._y;
			
			if (y < 0) y = 0;
			if (y > tHeight - vHeight) y = tHeight - vHeight;
			
			var dist = y - (-scrollY);
			
			self._inc = 0;
			self._timer = null;
			self._values = [];
			self._idle = false;
			for (var i = 0; i < self.steps.length; i++) {
				self._values[i] = Math.round((-scrollY) + dist * (self.steps[i] / 100));
			}
			self._timer = window.setInterval(function () {
				self._parent.scrollTo(0, self._values[self._inc]);
				if (self._inc == self.steps.length-1) {
					window.clearTimeout(self._timer);
					self._idle = true;
				} else self._inc++;
			}, self.stepDelay);
		}
	};
	this._tweenBy = function (y) {
		var scrollY = self._parent._src ? self._parent._src._y : self._parent._y;
		self._tweenTo(-scrollY + y);
	};
	this._trackTween = function (e) {
		e = e ? e : event;
		self._parent.canScroll = false;
		var curY = e.clientY + document.body.scrollTop;
		self._tweenTo((curY - self._parent._trackTop - self._parent._handleHeight/2) * self._parent._ratio);
	};
	
	this.stepDelay = 40;
	this.steps   = s?s:[0,25,50,70,85,95,97,99,100];
	this._values = [];
	this._parent = o;
	this._timer  = [];
	this._idle   = true;
	
	o.tweenTo = this._tweenTo;
	o.tweenBy = this._tweenBy;
	o.trackTween = this._trackTween;
	
	if (t) o._scrollTrack = function (e) {
		this.trackTween(e);
	};
}

///////////////////////////////****************************************Concerns****************************//////////////////////////////
/////////////////////////////////////////////////////////////////////////////////
function jsScrollbarC (o, s, a, ev) {
	var self = this;
	this.reset = function () {
		//Arguments that were passed
		this._parent = o;
		this._src    = s;
		this.auto    = a ? a : false;
		this.eventHandler = ev ? ev : function () {};
		//Component Objects
		this._up   = this._findComponent("Scrollbar-Up", this._parent);
		this._down = this._findComponent("Scrollbar-Down", this._parent);
		this._yTrack  = this._findComponent("Scrollbar-TrackC", this._parent);
		this._yHandle = this._findComponent("Scrollbar-HandleC", this._yTrack);
		
		
		//Height and position properties
		this._trackTop = findOffsetTop(this._yTrack);
		this._trackHeight  = this._yTrack.offsetHeight;
		this._handleHeight = this._yHandle.offsetHeight;
		this._x = 0;
		this._y = 0;
		//Misc. variables
		this._scrollDist  = 5;
		this._scrollTimer = null;
		this._selectFunc  = null;
		this._grabPoint   = null;
		this._tempTarget  = null;
		this._tempDistX   = 0;
		this._tempDistY   = 0;
		this._disabled    = false;
		this._ratio = (this._src.totalHeight - this._src.viewableHeight)/(this._trackHeight - this._handleHeight);
		
		this._yHandle.ondragstart  = function () {return false;};
		this._yHandle.onmousedown = function () {return false;};
		this._addEvent(this._src.content, "mousewheel", this._scrollbarWheel);
		this._removeEvent(this._parent, "mousedown", this._scrollbarClick);
		this._addEvent(this._parent, "mousedown", this._scrollbarClick);
		
		this._src.reset();
		with (this._yHandle.style) {
			top  = "0px";
			left = "0px";
		}
		this._moveContent();
		
		if (this._src.totalHeight < this._src.viewableHeight) {
			this._disabled = true;
			this._yHandle.style.visibility = "hidden";
			if (this.auto) this._parent.style.visibility = "hidden";
		} else {
			this._disabled = false;
			this._yHandle.style.visibility = "visible";
			this._parent.style.visibility  = "visible";
		}
	};
	this._addEvent = function (o, t, f) {
		if (o.addEventListener) o.addEventListener(t, f, false);
		else if (o.attachEvent) o.attachEvent('on'+ t, f);
		else o['on'+ t] = f;
	};
	this._removeEvent = function (o, t, f) {
		if (o.removeEventListener) o.removeEventListener(t, f, false);
		else if (o.detachEvent) o.detachEvent('on'+ t, f);
		else o['on'+ t] = null;
	};
	this._findComponent = function (c, o) {
		var kids = o.childNodes;
		for (var i = 0; i < kids.length; i++) {
			if (kids[i].className && kids[i].className == c) {
				return kids[i];
			}
		}
	};
	
	function findOffsetTop (o) {
		var t = 0;
		if (o.offsetParent) {
			while (o.offsetParent) {
				t += o.offsetTop;
				o  = o.offsetParent;
			}
		}
		return t;
	};
	this._scrollbarClick = function (e) {
		if (self._disabled) return false;
		
		e = e ? e : event;
		if (!e.target) e.target = e.srcElement;
		
		if (e.target.className.indexOf("Scrollbar-Up") > -1) self._scrollUp(e);
		else if (e.target.className.indexOf("Scrollbar-Down") > -1) self._scrollDown(e);
		else if (e.target.className.indexOf("Scrollbar-TrackC") > -1) self._scrollTrack(e);
		else if (e.target.className.indexOf("Scrollbar-HandleC") > -1) self._scrollHandle(e);
		
		self._tempTarget = e.target;
		self._selectFunc = document.onselectstart;
		document.onselectstart = function () {return false;};
		
		self.eventHandler(e.target, "mousedown");
		self._addEvent(document, "mouseup", self._stopScroll, false);
		
		return false;
	};
	this._scrollbarDrag = function (e) {
		e = e ? e : event;
		var t = parseInt(self._yHandle.style.top);
		var v = e.clientY + document.body.scrollTop - self._trackTop;
		with (self._yHandle.style) {
			if (v >= self._trackHeight - self._handleHeight + self._grabPoint)
				top = self._trackHeight - self._handleHeight +"px";
			else if (v <= self._grabPoint) top = "0px";
			else top = v - self._grabPoint +"px";
			self._y = parseInt(top);
		}
		
		self._moveContent();
	};
	this._scrollbarWheel = function (e) {
		e = e ? e : event;
		var dir = 0;
		if (e.wheelDelta >= 120) dir = -1;
		if (e.wheelDelta <= -120) dir = 1;
		
		self.scrollBy(0, dir * 20);
		e.returnValue = false;
	};
	this._startScroll = function (x, y) {
		this._tempDistX = x;
		this._tempDistY = y;
		this._scrollTimer = window.setInterval(function () {
			self.scrollBy(self._tempDistX, self._tempDistY); 
		}, 40);
	};
	this._stopScroll = function () {
		self._removeEvent(document, "mousemove", self._scrollbarDrag, false);
		self._removeEvent(document, "mouseup", self._stopScroll, false);
		
		if (self._selectFunc) document.onselectstart = self._selectFunc;
		else document.onselectstart = function () { return true; };
		
		if (self._scrollTimer) window.clearInterval(self._scrollTimer);
		self.eventHandler (self._tempTarget, "mouseup");
	};
	this._scrollUp = function (e) {this._startScroll(0, -this._scrollDist);};
	this._scrollDown = function (e) {this._startScroll(0, this._scrollDist);};
	this._scrollTrack = function (e) {
		var curY = e.clientY + document.body.scrollTop;
		this._scroll(0, curY - this._trackTop - this._handleHeight/2);
	};
	this._scrollHandle = function (e) {
		var curY = e.clientY + document.body.scrollTop;
		this._grabPoint = curY - findOffsetTop(this._yHandle);
		this._addEvent(document, "mousemove", this._scrollbarDrag, false);
	};
	this._scroll = function (x, y) {
		if (y > this._trackHeight - this._handleHeight) 
			y = this._trackHeight - this._handleHeight;
		if (y < 0) y = 0;
		
		this._yHandle.style.top = y +"px";
		this._y = y;
		
		this._moveContent();
	};
	this._moveContent = function () {
		this._src.scrollTo(0, Math.round(this._y * this._ratio));
	};
	
	this.scrollBy = function (x, y) {
		this._scroll(0, (-this._src._y + y)/this._ratio);
	};
	this.scrollTo = function (x, y) {
		this._scroll(0, y/this._ratio);
	};
	this.swapContent = function (o, w, h) {
		this._removeEvent(this._src.content, "mousewheel", this._scrollbarWheel, false);
		this._src.swapContent(o, w, h);
		this.reset();
	};
	
	this.reset();
}

///////////////////////////////////////////////////////////////////////////////////

function jsScrollerC (o, w, h) {
	var self = this;
	var list = o.getElementsByTagName("div");
	for (var i = 0; i < list.length; i++) {
			if (list[i].className.indexOf("Scroller-ContainerC") > -1) {
				o = list[i];
			}	
	}
	
	//Private methods
	this._setPos = function (x, y) {
		if (x < this.viewableWidth - this.totalWidth) 
			x = this.viewableWidth - this.totalWidth;
		if (x > 0) x = 0;
		if (y < this.viewableHeight - this.totalHeight) 
			y = this.viewableHeight - this.totalHeight;
		if (y > 0) y = 0;
		this._x = x;
		this._y = y;
		with (o.style) {
			left = this._x +"px";
			top  = this._y +"px";
		}
	};
	
	//Public Methods
	this.reset = function () {
		this.content = o;
		this.totalHeight = o.offsetHeight;
		this.totalWidth	 = o.offsetWidth;
		this._x = 0;
		this._y = 0;
		with (o.style) {
			left = "0px";
			top  = "0px";
		}
	};
	this.scrollBy = function (x, y) {
		this._setPos(this._x + x, this._y + y);
	};
	this.scrollTo = function (x, y) {
		this._setPos(-x, -y);
	};
	this.stopScroll = function () {
		if (this.scrollTimer) window.clearInterval(this.scrollTimer);
	};
	this.startScroll = function (x, y) {
		this.stopScroll();
		this.scrollTimer = window.setInterval(
			function(){ self.scrollBy(x, y); }, 40
		);
	};
	this.swapContent = function (c, w, h) {
		o = c;
		var list = o.getElementsByTagName("div");
		for (var i = 0; i < list.length; i++) {
		
			
				if (list[i].className.indexOf("Scroller-ContainerC") > -1) {
					o = list[i];
				}
		
							
		}
		if (w) this.viewableWidth  = w;
		if (h) this.viewableHeight = h;
		this.reset();
	};
	
	//variables
	this.content = o;
	this.viewableWidth  = w;
	this.viewableHeight = h;
	this.totalWidth	 = o.offsetWidth;
	this.totalHeight = o.offsetHeight;
	this.scrollTimer = null;
	this.reset();
}

/////////////////////////////////////////////////////////////////////////////////////////////////

function jsScrollerTweenC (o, t, s) {
	var self = this;
	
	this._tweenTo = function (y) {
		if (self._idle) {
			var tHeight = self._parent._src ? self._parent._src.totalHeight : self._parent.totalHeight;
			var vHeight = self._parent._src ? self._parent._src.viewableHeight : self._parent.viewableHeight;
			var scrollY = self._parent._src ? self._parent._src._y : self._parent._y;
			
			if (y < 0) y = 0;
			if (y > tHeight - vHeight) y = tHeight - vHeight;
			
			var dist = y - (-scrollY);
			
			self._inc = 0;
			self._timer = null;
			self._values = [];
			self._idle = false;
			for (var i = 0; i < self.steps.length; i++) {
				self._values[i] = Math.round((-scrollY) + dist * (self.steps[i] / 100));
			}
			self._timer = window.setInterval(function () {
				self._parent.scrollTo(0, self._values[self._inc]);
				if (self._inc == self.steps.length-1) {
					window.clearTimeout(self._timer);
					self._idle = true;
				} else self._inc++;
			}, self.stepDelay);
		}
	};
	this._tweenBy = function (y) {
		var scrollY = self._parent._src ? self._parent._src._y : self._parent._y;
		self._tweenTo(-scrollY + y);
	};
	this._trackTween = function (e) {
		e = e ? e : event;
		self._parent.canScroll = false;
		var curY = e.clientY + document.body.scrollTop;
		self._tweenTo((curY - self._parent._trackTop - self._parent._handleHeight/2) * self._parent._ratio);
	};
	
	this.stepDelay = 40;
	this.steps   = s?s:[0,25,50,70,85,95,97,99,100];
	this._values = [];
	this._parent = o;
	this._timer  = [];
	this._idle   = true;
	
	o.tweenTo = this._tweenTo;
	o.tweenBy = this._tweenBy;
	o.trackTween = this._trackTween;
	
	if (t) o._scrollTrack = function (e) {
		this.trackTween(e);
	};
}

///////////////////Close Panels on Medical part//////////////////////////////

function CloseAccordions(){
acc7b.closePanel();
acc7c.closePanel();
}


function videoarchive(){
	
		Arc = new Array;
		Arc[0] = "Media/Video/Broadcast/Accupunture.swf";
		Arc[1] = "Media/Video/Broadcast/Antiaging.swf";
		Arc[2] = "Media/Video/Broadcast/BeardSculpting.swf";
		Arc[3] = "Media/Video/Broadcast/Beauty Secrets2.swf";
		Arc[4] = "Media/Video/Broadcast/BeautyPatchesfla.swf";
		Arc[5] = "Media/Video/Broadcast/Beauty Secrets3.swf";
		Arc[6] = "Media/Video/Broadcast/BeautySecrets1.swf";
		Arc[7] = "Media/Video/Broadcast/Botox.swf";
		Arc[8] = "Media/Video/Broadcast/FacialHairRemoval.swf";//check
		Arc[9] = "Media/Video/Broadcast/Foot Treatment.swf";
		Arc[10] = "Media/Video/Broadcast/Fox News 08152008.swf";//check
		Arc[11] = "Media/Video/Broadcast/Geraldo at Large.swf";
		Arc[12] = "Media/Video/Broadcast/Hair Dye.swf";
		Arc[13] = "Media/Video/Broadcast/Laser for Men.swf";
		Arc[14] = "Media/Video/Broadcast/Laser Hair Removal.swf";
		Arc[15] = "Media/Video/Broadcast/Melanoma.swf";
		Arc[16] = "Media/Video/Broadcast/Men Wrinkles.swf";
		Arc[17] = "Media/Video/Broadcast/Mens Grooming.swf";
		Arc[18] = "Media/Video/Broadcast/MensGrooming.swf";
		Arc[19] = "Media/Video/Broadcast/ModelLife107C2_4.swf";
		Arc[20] = "Media/Video/Broadcast/SkinCancer.swf";
		Arc[21] = "Media/Video/Broadcast/skinsmoothers.swf";
		Arc[22] = "Media/Video/Broadcast/sunscreen070208.swf";
		Arc[23] = "Media/Video/Broadcast/TeenTaning.swf";
		Arc[24] = "Media/Video/Broadcast/Today6212007.swf";
		Arc[25] = "Media/Video/Broadcast/TVSpot.swf";//check
		Arc[26] = "Media/Video/Broadcast/Wedding.swf";
		Arc[27] = "Media/Video/Broadcast/winter skin.swf";
		Arc[28] = "Media/Video/Broadcast/Women-Feet.swf";

     	var ra = Math.floor(Math.random()*Arc.length);
		return Arc[ra];
		
}


function videoprovider(i){
		Prov = new Array;
		Prov[0] = "Media/Providers/Colbert_365_213.swf";
		Prov[1] = "Media/Providers/Jadams.swf";
		Prov[2] = "Media/Providers/Siyer.swf";
		
		if (i != -1){
			return Prov[i];
		}
		else {
			var pro = Math.floor(Math.random()*Prov.length);
			return Prov[pro];
			
		}
			
}
