function isdefined(variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}

if (isdefined('tinyMCE')){
tinyMCE.init({
	mode : "textareas",
	theme : "advanced",
	auto_reset_designmode : true,
	width : '510',
	height : '400',
	plugins : 'imagemanager',
	theme_advanced_buttons1 : "bold,italic,underline,separator,strikethrough,justifyleft,justifycenter,justifyright,justifyfull,bullist,numlist,link,unlink,formatselect ",
	theme_advanced_buttons2 : "undo,redo,separator,sub,sup,separator,code,image,advimage,imagemanager",
	theme_advanced_buttons3 : "",
	theme_advanced_toolbar_location : "top",
	theme_advanced_toolbar_align : "left",
	theme_advanced_path_location : "bottom",
	extended_valid_elements : "a[name|href|target|title|onclick],img[class|src|border=0|alt|title|hspace|vspace|width|height|align|onmouseover|onmouseout|name],hr[class|width|size|noshade],font[face|size|color|style],span[class|align|style]",
	file_browser_callback : "fileBrowserCallBack",
	convert_urls : false
});
}

function addLoadEvent(func) {
  var oldonload = window.onload;
  if (typeof window.onload != 'function') {
	window.onload = func;
  } else {
	window.onload = function() {
	  oldonload();
	  func();
	};
  }
}

function blurA(){
	var elms = document.getElementsByTagName('a');
	for (var i=0; i < elms.length; i++){
  		var elm = elms[i];
		elm.onfocus = function(){this.blur();};
	}
}
addLoadEvent(blurA);


function confirmbox(){
	return confirm("Are you sure?");
}


/**
 * SWFObject v1.5: 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=new Object()
}
if(typeof deconcept.util=="undefined")
{
	deconcept.util=new Object()
}
if(typeof deconcept.SWFObjectUtil=="undefined")
{
	deconcept.SWFObjectUtil=new Object()
}
deconcept.SWFObject=function(a,b,w,h,d,c,e,f,g,i,j)
{
	if(!document.getElementById)
	{
		return
	}
	this.DETECT_KEY=j?j:"detectflash";
	this.skipDetect=deconcept.util.getRequestParameter(this.DETECT_KEY);
	this.params=new Object();
	this.variables=new Object();
	this.attributes=new Array();
	if(a)
	{
		this.setAttribute("swf",a)
	}
	if(b)
	{
		this.setAttribute("id",b)
	}
	if(w)
	{
		this.setAttribute("width",w)
	}
	if(h)
	{
		this.setAttribute("height",h)
	}
	if(d)
	{
		this.setAttribute("version",new deconcept.PlayerVersion(d.toString().split(".")))
	}
	this.installedVer=deconcept.SWFObjectUtil.getPlayerVersion();
	if(c)
	{
		this.addParam("bgcolor",c)
	}
	var q=f?f:"high";
	this.addParam("wmode",'transparent');
	this.addParam("quality",q);
	this.setAttribute("useExpressInstall",e);
	this.setAttribute("doExpressInstall",false);
	var k=(g)?g:window.location;
	this.setAttribute("xiRedirectUrl",k);
	this.setAttribute("redirectUrl","");
	if(i)
	{
		this.setAttribute("redirectUrl",i)
	}
};
deconcept.SWFObject.prototype=
{
	setAttribute:function(a,b)
	{
		this.attributes[a]=b
	}
	,getAttribute:function(a)
	{
		return this.attributes[a]
	}
	,addParam:function(a,b)
	{
		this.params[a]=b
	}
	,getParams:function()
	{
		return this.params
	}
	,addVariable:function(a,b)
	{
		this.variables[a]=b
	}
	,getVariable:function(a)
	{
		return this.variables[a]
	}
	,getVariables:function()
	{
		return this.variables
	}
	,getVariablePairs:function()
	{
		var a=new Array();
		var b;
		var c=this.getVariables();
		for(b in c)
		{
			a.push(b+"="+c[b])
		}
		return a
	}
	,getSWFHTML:function()
	{
		var a="";
		if(navigator.plugins&&navigator.mimeTypes&&navigator.mimeTypes.length)
		{
			if(this.getAttribute("doExpressInstall"))
			{
				this.addVariable("MMplayerType","PlugIn")
			}
			a="<embed type=\"application/x-shockwave-flash\" src=\""+this.getAttribute("swf")+"\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\"";
			a+=" id=\""+this.getAttribute("id")+"\" name=\""+this.getAttribute("id")+"\" ";
			var b=this.getParams();
			for(var c in b)
			{
				a+=[c]+"=\""+b[c]+"\" "
			}
			var d=this.getVariablePairs().join("&");
			if(d.length>0)
			{
				a+="flashvars=\""+d+"\""
			}
			a+="/>"
		}
		else
		{
			if(this.getAttribute("doExpressInstall"))
			{
				this.addVariable("MMplayerType","ActiveX")
			}
			a="<object id=\""+this.getAttribute("id")+"\" classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" width=\""+this.getAttribute("width")+"\" height=\""+this.getAttribute("height")+"\">";
			a+="<param name=\"movie\" value=\""+this.getAttribute("swf")+"\" />";
			var e=this.getParams();
			for(var c in e)
			{
				a+="<param name=\""+c+"\" value=\""+e[c]+"\" />"
			}
			var f=this.getVariablePairs().join("&");
			if(f.length>0)
			{
				a+="<param name=\"flashvars\" value=\""+f+"\" />"
			}
			a+="</object>"
		}
		return a
	}
	,write:function(a)
	{
		if(this.getAttribute("useExpressInstall"))
		{
			var b=new deconcept.PlayerVersion([6,0,65]);
			if(this.installedVer.versionIsValid(b)&&!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 a=="string")?document.getElementById(a):a;
			n.innerHTML=this.getSWFHTML();
			return true
		}
		else
		{
			if(this.getAttribute("redirectUrl")!="")
			{


				document.location.replace(this.getAttribute("redirectUrl"))
			}
		}
		return false
	}
};
deconcept.SWFObjectUtil.getPlayerVersion=function()
{
	var a=new deconcept.PlayerVersion([0,0,0]);
	if(navigator.plugins&&navigator.mimeTypes.length)
	{
		var x=navigator.plugins["Shockwave Flash"];
		if(x&&x.description)
		{
			a=new deconcept.PlayerVersion(x.description.replace(/([a-zA-Z]|\s)+/,"").replace(/(\s+r|\s+b[0-9]+)/,".").split("."))
		}
	}
	else
	{
		try
		{
			var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.7")
		}
		catch(e)
		{
			try
			{
				var b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash.6");
				a=new deconcept.PlayerVersion([6,0,21]);
				b.AllowScriptAccess="always"
			}
			catch(e)
			{
				if(a.major==6)
				{
					return a
				}
			}
			try
			{
				b=new ActiveXObject("ShockwaveFlash.ShockwaveFlash")
			}
			catch(e)
			{
			}
		}
		if(b!=null)
		{
			a=new deconcept.PlayerVersion(b.GetVariable("$version").split(" ")[1].split(","))
		}
	}
	return a
};
deconcept.PlayerVersion=function(a)
{
	this.major=a[0]!=null?parseInt(a[0]):0;
	this.minor=a[1]!=null?parseInt(a[1]):0;
	this.rev=a[2]!=null?parseInt(a[2]):0
};
deconcept.PlayerVersion.prototype.versionIsValid=function(a)
{
	if(this.major<a.major)
	{
		return false
	}
	if(this.major>a.major)
	{
		return true
	}
	if(this.minor<a.minor)
	{
		return false
	}
	if(this.minor>a.minor)
	{
		return true
	}
	if(this.rev<a.rev)
	{
		return false
	}
	return true
};
deconcept.util=
{
	getRequestParameter:function(a)
	{
		var q=document.location.search||document.location.hash;
		if(q)
		{
			var b=q.substring(1).split("&");
			for(var i=0;i<b.length;i++)
			{
				if(b[i].substring(0,b[i].indexOf("="))==a)
				{
					return b[i].substring((b[i].indexOf("=")+1))
				}
			}
		}
		return""
	}
};
deconcept.SWFObjectUtil.cleanupSWFs=function()
{
	if(window.opera||!document.all)
	{
		return
	}
	var a=document.getElementsByTagName("OBJECT");
	for(var i=0;i<a.length;i++)
	{
		a[i].style.display="none";
		for(var x in a[i])
		{
			if(typeof a[i][x]=="function")
			{
				a[i][x]=function()
				{
				}
			}
		}
	}
};
deconcept.SWFObjectUtil.prepUnload=function()
{
	__flash_unloadHandler=function()
	{
	};
	__flash_savedUnloadHandler=function()
	{
	};
	if(typeof window.onunload=="function")
	{
		var a=window.onunload;
		window.onunload=function()
		{
			deconcept.SWFObjectUtil.cleanupSWFs();
			a()
		}
	}
	else
	{
		window.onunload=deconcept.SWFObjectUtil.cleanupSWFs
	}
};
if(typeof window.onbeforeunload=="function")
{
	var oldBeforeUnload=window.onbeforeunload;
	window.onbeforeunload=function()
	{
		deconcept.SWFObjectUtil.prepUnload();
		oldBeforeUnload()
	}
}
else
{
	window.onbeforeunload=deconcept.SWFObjectUtil.prepUnload
}
if(Array.prototype.push==null)
{
	Array.prototype.push=function(a)
	{
		this[this.length]=a;
		return this.length
	}
}
var getQueryParamValue=deconcept.util.getRequestParameter;
var FlashObject=deconcept.SWFObject;
var SWFObject=deconcept.SWFObject;


function $I(v) { return(document.getElementById(v)); }
function $S(v) { return($I(v).style); }
function uni(v,id,s){
	var ob=$S(id),b=v/100;
	ob.opacity=b;
	ob.MozOpacity=b;
	ob.KhtmlOpacity=b;
	ob.filter="alpha(opacity="+v+")";
}

function fade(id,ln,s){
	function opacity(oStart,oEnd,ln){
		var speed=Math.round(ln/100),timer=0;
		if(oStart>oEnd){
			for(i=oStart;i>=oEnd;i--){
				setTimeout("uni("+i+",'"+id+"','')",timer*speed);
				timer++;
			}
			setTimeout("$S('"+id+"').display='none';",timer*speed);
		}
		else if(oStart<oEnd){
			$S(id).display='block';
			for(i=oStart;i<=oEnd;i++){
				setTimeout("uni("+i+",'"+id+"','"+1+"')",timer*speed);
				timer++;
			}
		}
	}
	if(s==1 || (!s && $S(id).opacity==0)){ uni(0,id,''); opacity(0,80,ln);}
	else { opacity(80,0,ln);}
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight);
	return arrayPageSize;
}
function getPageScroll(){

	var yScroll;

	if (self.pageYOffset) {
		yScroll = self.pageYOffset;
	} else if (document.documentElement && document.documentElement.scrollTop){	 // Explorer 6 Strict
		yScroll = document.documentElement.scrollTop;
	} else if (document.body) {// all other Explorers
		yScroll = document.body.scrollTop;
	}

	arrayPageScroll = new Array('',yScroll) ;
	return arrayPageScroll;
}


function editPageSwitch(){
	document.getElementById('editdiv').style.display = 'block';
	document.getElementById('mid').style.display = 'none';
}
function startPageSwitch(which){
	document.getElementById('editdiv'+which).style.display = 'block';
}
function tog(id,f,center){
	if ($S(id).display!='block'){
		if (f){
		fade('overlayBG',400,1);
		var arrayPageSize = getPageSize();
		$S('overlayBG').height=(arrayPageSize[1] + 'px');
		}
		$S(id).display='block';
		if (center) showAndCenter(id, center);
	}
	else{
		$S(id).display='none';
		if(f) fade('overlayBG',400);
	}
}
function showAndCenter(id, b){
	var arrayPageSize = getPageSize();
	var arrayPageScroll = getPageScroll();
	$S('overlayBG').height=(arrayPageSize[1] + 'px');
	
	$S(id).left=Math.round((XYwin(1)-b)/2)+'px';
	topPos = (arrayPageScroll[1] + ((arrayPageSize[3] - 35 - 700) / 2));
	$S(id).top=(topPos<arrayPageScroll[1] ? arrayPageScroll[1]+'px' : topPos+'px');
	$S(id).width=b+'px';
	$S(id).display='block';
}
function popup(url, width, height,name) {
var top = Math.round((screen.height-height)/2);
var left = Math.round((screen.width-width)/2);
popups = new Array();
rand = Math.floor(Math.random()*1001);
popups[rand] = window.open (url, 'newwindow'+name+rand,'toolbar=no, location=no, directories=no, status=no, menubar=no, scrollbars=no, resizable=yes, fullscreen=no, top=' + top + ', left=' + left + ', width=' + width + ', height=' + height);
popups[rand].focus();
}




/* Rounded Corners */
var isIE = navigator.userAgent.toLowerCase().indexOf("msie") > -1;
var isMoz = document.implementation && document.implementation.createDocument;
var isSafari = ((navigator.userAgent.toLowerCase().indexOf('safari')!=-1)&&(navigator.userAgent.toLowerCase().indexOf('mac')!=-1))?true:false;
function curvyCorners()
{
	if(typeof(arguments[0]) != "object") throw newCurvyError("First parameter of curvyCorners() must be an object.");
	if(typeof(arguments[1]) != "object" && typeof(arguments[1]) != "string") throw newCurvyError("Second parameter of curvyCorners() must be an object or a class name.");
	if(typeof(arguments[1]) == "string")
	{
		var startIndex = 0;
		var boxCol = getElementsByClassName(document, '*', arguments[1]);
	}
	else
	{
		var startIndex = 1;
		var boxCol = arguments;
	}
	var curvyCornersCol = new Array();
	for(var i = startIndex, j = boxCol.length;i < j;i++)
	{
		if(boxCol[i].tagName.toLowerCase() == "div")
		{
			curvyCornersCol[curvyCornersCol.length] = new curvyObject(arguments[0], boxCol[i]);
		}
	}
	this.objects = curvyCornersCol;
	this.applyCornersToAll = function(){
		for(var x = 0, k = this.objects.length;x < k;x++)
		{
			this.objects[x].applyCorners();
		}
	};
}
function curvyObject()
{
	this.box = arguments[1];
	this.settings = arguments[0];
	this.topContainer = null;
	this.bottomContainer = null;
	this.masterCorners = new Array();
	this.contentDIV = null;
	var boxHeight = get_style(this.box, "height", "height");
	var boxWidth = get_style(this.box, "width", "width");
	var borderWidth = get_style(this.box, "borderTopWidth", "border-top-width");
	var borderColour = get_style(this.box, "borderTopColor", "border-top-color");
	var boxColour = get_style(this.box, "backgroundColor", "background-color");
	var backgroundImage = get_style(this.box, "backgroundImage", "background-image");
	var boxPosition = get_style(this.box, "position", "position");
	var boxPadding = get_style(this.box, "paddingTop", "padding-top");
	this.boxHeight = parseInt(((boxHeight != "" && boxHeight != "auto" && boxHeight.indexOf("%") == -1)? boxHeight.substring(0, boxHeight.indexOf("px")) : this.box.scrollHeight));
	this.boxWidth = parseInt(((boxWidth != "" && boxWidth != "auto" && boxWidth.indexOf("%") == -1)? boxWidth.substring(0, boxWidth.indexOf("px")) : this.box.scrollWidth));
	this.borderWidth = parseInt(((borderWidth != "" && borderWidth.indexOf("px") !== -1)? borderWidth.slice(0, borderWidth.indexOf("px")) : 0));
	this.boxColour = format_colour(boxColour);
	this.boxPadding = parseInt(((boxPadding != "" && boxPadding.indexOf("px") !== -1)? boxPadding.slice(0, boxPadding.indexOf("px")) : 0));
	this.borderColour = format_colour(borderColour);
	this.borderString = this.borderWidth + "px" + " solid " + this.borderColour;
	this.backgroundImage = ((backgroundImage != "none")? backgroundImage : "");
	this.boxContent = this.box.innerHTML;
	if(boxPosition != "absolute") this.box.style.position = "relative";
	this.box.style.padding = "0px";
	if(isIE && boxWidth == "auto" && boxHeight == "auto") this.box.style.width = "100%";
	if(this.settings.autoPad == true && this.boxPadding > 0) this.box.innerHTML = "";
	this.applyCorners = function()
	{
		for(var t = 0;t < 2;t++)
		{
			switch(t)
			{
				case 0: if(this.settings.tl || this.settings.tr)
				{
					var newMainContainer = document.createElement("DIV");
					newMainContainer.style.width = "100%";
					newMainContainer.style.fontSize = "1px";
					newMainContainer.style.overflow = "hidden";
					newMainContainer.style.position = "absolute";
					newMainContainer.style.paddingLeft = this.borderWidth + "px";
					newMainContainer.style.paddingRight = this.borderWidth + "px";
					var topMaxRadius = Math.max(this.settings.tl ? this.settings.tl.radius : 0, this.settings.tr ? this.settings.tr.radius : 0);
					newMainContainer.style.height = topMaxRadius + "px";
					newMainContainer.style.top = 0 - topMaxRadius + "px";
					newMainContainer.style.left = 0 - this.borderWidth + "px";
					this.topContainer = this.box.appendChild(newMainContainer);
				}
				break;
				case 1: if(this.settings.bl || this.settings.br)
				{
					var newMainContainer = document.createElement("DIV");
					newMainContainer.style.width = "100%";
					newMainContainer.style.fontSize = "1px";
					newMainContainer.style.overflow = "hidden";
					newMainContainer.style.position = "absolute";
					newMainContainer.style.paddingLeft = this.borderWidth + "px";
					newMainContainer.style.paddingRight = this.borderWidth + "px";
					var botMaxRadius = Math.max(this.settings.bl ? this.settings.bl.radius : 0, this.settings.br ? this.settings.br.radius : 0);
					newMainContainer.style.height = botMaxRadius + "px";
					newMainContainer.style.bottom = 0 - botMaxRadius + "px";
					newMainContainer.style.left = 0 - this.borderWidth + "px";
					this.bottomContainer = this.box.appendChild(newMainContainer);
				}
				break;
			}
		}
		if(this.topContainer) this.box.style.borderTopWidth = "0px";
		if(this.bottomContainer) this.box.style.borderBottomWidth = "0px";
		var corners = ["tr", "tl", "br", "bl"];
		for(var i in corners){
		
		if (corners.hasOwnProperty(i)) {	
			
			var cc = corners[i];
			if(!this.settings[cc])
			{
				if(((cc == "tr" || cc == "tl") && this.topContainer != null) || ((cc == "br" || cc == "bl") && this.bottomContainer != null))
				{
					var newCorner = document.createElement("DIV");
					newCorner.style.position = "relative";
					newCorner.style.fontSize = "1px";
					newCorner.style.overflow = "hidden";
					if(this.backgroundImage == "") newCorner.style.backgroundColor = this.boxColour;
					else newCorner.style.backgroundImage = this.backgroundImage;
					switch(cc)
					{
						case "tl": newCorner.style.height = topMaxRadius - this.borderWidth + "px";
						newCorner.style.marginRight = this.settings.tr.radius - (this.borderWidth*2) + "px";
						newCorner.style.borderLeft = this.borderString;
						newCorner.style.borderTop = this.borderString;
						newCorner.style.left = -this.borderWidth + "px";
						break;
						case "tr": newCorner.style.height = topMaxRadius - this.borderWidth + "px";
						newCorner.style.marginLeft = this.settings.tl.radius - (this.borderWidth*2) + "px";
						newCorner.style.borderRight = this.borderString;
						newCorner.style.borderTop = this.borderString;
						newCorner.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px";
						newCorner.style.left = this.borderWidth + "px";
						break;
						case "bl": newCorner.style.height = botMaxRadius - this.borderWidth + "px";
						newCorner.style.marginRight = this.settings.br.radius - (this.borderWidth*2) + "px";
						newCorner.style.borderLeft = this.borderString;
						newCorner.style.borderBottom = this.borderString;
						newCorner.style.left = -this.borderWidth + "px";
						newCorner.style.backgroundPosition = "-" + (this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px";
						break;
						case "br": newCorner.style.height = botMaxRadius - this.borderWidth + "px";
						newCorner.style.marginLeft = this.settings.bl.radius - (this.borderWidth*2) + "px";
						newCorner.style.borderRight = this.borderString;
						newCorner.style.borderBottom = this.borderString;
						newCorner.style.left = this.borderWidth + "px";
						newCorner.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (botMaxRadius + this.borderWidth)) + "px";
						break;
					}
				}
			}
			else
			{
				if(this.masterCorners[this.settings[cc].radius])
				{
					var newCorner = this.masterCorners[this.settings[cc].radius].cloneNode(true);
				}
				else
				{
					var newCorner = document.createElement("DIV");
					newCorner.style.height = this.settings[cc].radius + "px";
					newCorner.style.width = this.settings[cc].radius + "px";
					newCorner.style.position = "absolute";
					newCorner.style.fontSize = "1px";
					newCorner.style.overflow = "hidden";
					var borderRadius = parseInt(this.settings[cc].radius - this.borderWidth);
					for(var intx = 0, j = this.settings[cc].radius;intx < j;intx++)
					{
						if((intx +1) >= borderRadius) var y1 = -1;
						else var y1 = (Math.floor(Math.sqrt(Math.pow(borderRadius, 2) - Math.pow((intx+1), 2))) - 1);
						if(borderRadius != j)
						{
							if((intx) >= borderRadius) var y2 = -1;
							else var y2 = Math.ceil(Math.sqrt(Math.pow(borderRadius,2) - Math.pow(intx, 2)));
							if((intx+1) >= j) var y3 = -1;
							else var y3 = (Math.floor(Math.sqrt(Math.pow(j ,2) - Math.pow((intx+1), 2))) - 1);
						}
						if((intx) >= j) var y4 = -1;
						else var y4 = Math.ceil(Math.sqrt(Math.pow(j ,2) - Math.pow(intx, 2)));
						if(y1 > -1) this.drawPixel(intx, 0, this.boxColour, 100, (y1+1), newCorner, -1, this.settings[cc].radius);
						if(borderRadius != j)
						{
							for(var inty = (y1 + 1);
							inty < y2;
							inty++)
							{
								if(this.settings.antiAlias)
								{
									if(this.backgroundImage != "")
									{
										var borderFract = (pixelFraction(intx, inty, borderRadius) * 100);
										if(borderFract < 30)
										{
											this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, 0, this.settings[cc].radius);
										}
										else
										{
											this.drawPixel(intx, inty, this.borderColour, 100, 1, newCorner, -1, this.settings[cc].radius);
										}
									}
									else
									{
										var pixelcolour = BlendColour(this.boxColour, this.borderColour, pixelFraction(intx, inty, borderRadius));
										this.drawPixel(intx, inty, pixelcolour, 100, 1, newCorner, 0, this.settings[cc].radius, cc);
									}
								}
							}
							if(this.settings.antiAlias)
							{
								if(y3 >= y2)
								{
									if (y2 == -1) y2 = 0;
									this.drawPixel(intx, y2, this.borderColour, 100, (y3 - y2 + 1), newCorner, 0, 0);
								}
							}
							else
							{
								if(y3 >= y1)
								{
									this.drawPixel(intx, (y1 + 1), this.borderColour, 100, (y3 - y1), newCorner, 0, 0);
								}
							}
							var outsideColour = this.borderColour;
						}
						else
						{
							var outsideColour = this.boxColour;
							var y3 = y1;
						}
						if(this.settings.antiAlias)
						{
							for(var inty = (y3 + 1);
							inty < y4;
							inty++)
							{
								this.drawPixel(intx, inty, outsideColour, (pixelFraction(intx, inty , j) * 100), 1, newCorner, ((this.borderWidth > 0)? 0 : -1), this.settings[cc].radius);
							}
						}
					}
					this.masterCorners[this.settings[cc].radius] = newCorner.cloneNode(true);
				}
				if(cc != "br")
				{
					for(var t = 0, k = newCorner.childNodes.length;t < k;t++)
					{
						var pixelBar = newCorner.childNodes[t];
						var pixelBarTop = parseInt(pixelBar.style.top.substring(0, pixelBar.style.top.indexOf("px")));
						var pixelBarLeft = parseInt(pixelBar.style.left.substring(0, pixelBar.style.left.indexOf("px")));
						var pixelBarHeight = parseInt(pixelBar.style.height.substring(0, pixelBar.style.height.indexOf("px")));
						if(cc == "tl" || cc == "bl")
						{
							pixelBar.style.left = this.settings[cc].radius -pixelBarLeft -1 + "px";
						}
						if(cc == "tr" || cc == "tl")
						{
							pixelBar.style.top = this.settings[cc].radius -pixelBarHeight -pixelBarTop + "px";
						}
						switch(cc)
						{
							case "tr": pixelBar.style.backgroundPosition = "-" + Math.abs((this.boxWidth - this.settings[cc].radius + this.borderWidth) + pixelBarLeft) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px";
							break;
							case "tl": pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs(this.settings[cc].radius -pixelBarHeight -pixelBarTop - this.borderWidth) + "px";
							break;
							case "bl": pixelBar.style.backgroundPosition = "-" + Math.abs((this.settings[cc].radius -pixelBarLeft -1) - this.borderWidth) + "px -" + Math.abs((this.boxHeight + this.settings[cc].radius + pixelBarTop) -this.borderWidth) + "px";
							break;
						}
					}
				}
			}
			if(newCorner)
			{
				switch(cc)
				{
					case "tl": if(newCorner.style.position == "absolute") newCorner.style.top = "0px";
					if(newCorner.style.position == "absolute") newCorner.style.left = "0px";
					if(this.topContainer) this.topContainer.appendChild(newCorner);
					break;
					case "tr": if(newCorner.style.position == "absolute") newCorner.style.top = "0px";
					if(newCorner.style.position == "absolute") newCorner.style.right = "0px";
					if(this.topContainer) this.topContainer.appendChild(newCorner);
					break;
					case "bl": if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px";
					if(newCorner.style.position == "absolute") newCorner.style.left = "0px";
					if(this.bottomContainer) this.bottomContainer.appendChild(newCorner);
					break;
					case "br": if(newCorner.style.position == "absolute") newCorner.style.bottom = "0px";
					if(newCorner.style.position == "absolute") newCorner.style.right = "0px";
					if(this.bottomContainer) this.bottomContainer.appendChild(newCorner);
					break;
				}
			}
		  }
		}
		var radiusDiff = new Array();
		radiusDiff["t"] = Math.abs(this.settings.tl.radius - this.settings.tr.radius);
		radiusDiff["b"] = Math.abs(this.settings.bl.radius - this.settings.br.radius);
		for(z in radiusDiff)
		{
		  if (radiusDiff.hasOwnProperty(z)) {
			if(radiusDiff[z])
			{
				var smallerCornerType = ((this.settings[z + "l"].radius < this.settings[z + "r"].radius)? z +"l" : z +"r");
				var newFiller = document.createElement("DIV");
				newFiller.style.height = radiusDiff[z] + "px";
				newFiller.style.width = this.settings[smallerCornerType].radius+ "px";
				newFiller.style.position = "absolute";
				newFiller.style.fontSize = "1px";
				newFiller.style.overflow = "hidden";
				newFiller.style.backgroundColor = this.boxColour;
				switch(smallerCornerType)
				{
					case "tl": newFiller.style.bottom = "0px";
					newFiller.style.left = "0px";
					newFiller.style.borderLeft = this.borderString;
					this.topContainer.appendChild(newFiller);
					break;
					case "tr": newFiller.style.bottom = "0px";
					newFiller.style.right = "0px";
					newFiller.style.borderRight = this.borderString;
					this.topContainer.appendChild(newFiller);
					break;
					case "bl": newFiller.style.top = "0px";
					newFiller.style.left = "0px";
					newFiller.style.borderLeft = this.borderString;
					this.bottomContainer.appendChild(newFiller);
					break;
					case "br": newFiller.style.top = "0px";
					newFiller.style.right = "0px";
					newFiller.style.borderRight = this.borderString;
					this.bottomContainer.appendChild(newFiller);
					break;
				}
			}
			var newFillerBar = document.createElement("DIV");
			newFillerBar.style.position = "relative";
			newFillerBar.style.fontSize = "1px";
			newFillerBar.style.overflow = "hidden";
			newFillerBar.style.backgroundColor = this.boxColour;
			newFillerBar.style.backgroundImage = this.backgroundImage;
			switch(z)
			{
				case "t": if(this.topContainer)
				{
					if(this.settings.tl.radius && this.settings.tr.radius)
					{
						newFillerBar.style.height = topMaxRadius - this.borderWidth + "px";
						newFillerBar.style.marginLeft = this.settings.tl.radius - this.borderWidth + "px";
						newFillerBar.style.marginRight = this.settings.tr.radius - this.borderWidth + "px";
						newFillerBar.style.borderTop = this.borderString;
						if(this.backgroundImage != "") newFillerBar.style.backgroundPosition = "-" + (topMaxRadius + this.borderWidth) + "px 0px";
						this.topContainer.appendChild(newFillerBar);
					}
					this.box.style.backgroundPosition = "0px -" + (topMaxRadius - this.borderWidth) + "px";
				}
				break;
				case "b": if(this.bottomContainer)
				{
					if(this.settings.bl.radius && this.settings.br.radius)
					{
						newFillerBar.style.height = botMaxRadius - this.borderWidth + "px";
						newFillerBar.style.marginLeft = this.settings.bl.radius - this.borderWidth + "px";
						newFillerBar.style.marginRight = this.settings.br.radius - this.borderWidth + "px";
						newFillerBar.style.borderBottom = this.borderString;
						if(this.backgroundImage != "") newFillerBar.style.backgroundPosition = "-" + (botMaxRadius + this.borderWidth) + "px -" + (this.boxHeight + (topMaxRadius + this.borderWidth)) + "px";
						this.bottomContainer.appendChild(newFillerBar);
					}
				}
				break;
			}
		  }
		}
		if(this.settings.autoPad == true && this.boxPadding > 0)
		{
			var contentContainer = document.createElement("DIV");
			contentContainer.style.position = "relative";
			contentContainer.innerHTML = this.boxContent;
			contentContainer.className = "autoPadDiv";
			var topPadding = Math.abs(topMaxRadius - this.boxPadding);
			var botPadding = Math.abs(botMaxRadius - this.boxPadding);
			if(topMaxRadius < this.boxPadding) contentContainer.style.paddingTop = topPadding + "px";
			if(botMaxRadius < this.boxPadding) contentContainer.style.paddingBottom = botMaxRadius + "px";
			contentContainer.style.paddingLeft = this.boxPadding + "px";
			contentContainer.style.paddingRight = this.boxPadding + "px";
			this.contentDIV = this.box.appendChild(contentContainer);
		}
	};
	this.drawPixel = function(intx, inty, colour, transAmount, height, newCorner, image, cornerRadius)
	{
		var pixel = document.createElement("DIV");
		pixel.style.height = height + "px";
		pixel.style.width = "1px";
		pixel.style.position = "absolute";
		pixel.style.fontSize = "1px";
		pixel.style.overflow = "hidden";
		var topMaxRadius = Math.max(this.settings["tr"].radius, this.settings["tl"].radius);
		if(image == -1 && this.backgroundImage != "")		{
			pixel.style.backgroundImage = this.backgroundImage;
			pixel.style.backgroundPosition = "-" + (this.boxWidth - (cornerRadius - intx) + this.borderWidth) + "px -" + ((this.boxHeight + topMaxRadius + inty) -this.borderWidth) + "px";
		}
		else		{
			pixel.style.backgroundColor = colour;
		}
		if (transAmount != 100) setOpacity(pixel, transAmount);
		pixel.style.top = inty + "px";
		pixel.style.left = intx + "px";
		newCorner.appendChild(pixel);
	};
}
function insertAfter(parent, node, referenceNode)
{
	parent.insertBefore(node, referenceNode.nextSibling);
}
function BlendColour(Col1, Col2, Col1Fraction){
	var red1 = parseInt(Col1.substr(1,2),16);
	var green1 = parseInt(Col1.substr(3,2),16);
	var blue1 = parseInt(Col1.substr(5,2),16);
	var red2 = parseInt(Col2.substr(1,2),16);
	var green2 = parseInt(Col2.substr(3,2),16);
	var blue2 = parseInt(Col2.substr(5,2),16);
	if(Col1Fraction > 1 || Col1Fraction < 0) Col1Fraction = 1;
	var endRed = Math.round((red1 * Col1Fraction) + (red2 * (1 - Col1Fraction)));
	if(endRed > 255) endRed = 255;
	if(endRed < 0) endRed = 0;
	var endGreen = Math.round((green1 * Col1Fraction) + (green2 * (1 - Col1Fraction)));
	if(endGreen > 255) endGreen = 255;
	if(endGreen < 0) endGreen = 0;
	var endBlue = Math.round((blue1 * Col1Fraction) + (blue2 * (1 - Col1Fraction)));
	if(endBlue > 255) endBlue = 255;
	if(endBlue < 0) endBlue = 0;
	return "#" + IntToHex(endRed)+ IntToHex(endGreen)+ IntToHex(endBlue);
}
function IntToHex(strNum){
	base = strNum / 16;
	rem = strNum % 16;
	base = base - (rem / 16);
	baseS = MakeHex(base);
	remS = MakeHex(rem);
	return baseS + '' + remS;
}
function MakeHex(x){
	if((x >= 0) && (x <= 9)){
		return x;
	}
	else{
		switch(x){
			case 10: return "A";
			case 11: return "B";
			case 12: return "C";
			case 13: return "D";
			case 14: return "E";
			case 15: return "F";
		}
	}
}
function pixelFraction(x, y, r){
	var pixelfraction = 0;
	var xvalues = new Array(1);
	var yvalues = new Array(1);
	var point = 0;
	var whatsides = "";
	var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x,2)));
	if ((intersect >= y) && (intersect < (y+1))){
		whatsides = "Left";
		xvalues[point] = 0;
		yvalues[point] = intersect - y;
		point = point + 1;
	}
	var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y+1,2)));
	if ((intersect >= x) && (intersect < (x+1))){
		whatsides = whatsides + "Top";
		xvalues[point] = intersect - x;
		yvalues[point] = 1;
		point = point + 1;
	}
	var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(x+1,2)));
	if ((intersect >= y) && (intersect < (y+1))){
		whatsides = whatsides + "Right";
		xvalues[point] = 1;
		yvalues[point] = intersect - y;
		point = point + 1;
	}
	var intersect = Math.sqrt((Math.pow(r,2) - Math.pow(y,2)));
	if ((intersect >= x) && (intersect < (x+1))){
		whatsides = whatsides + "Bottom";
		xvalues[point] = intersect - x;
		yvalues[point] = 0;
	}
	switch (whatsides)	{
		case "LeftRight": pixelfraction = Math.min(yvalues[0],yvalues[1]) + ((Math.max(yvalues[0],yvalues[1]) - Math.min(yvalues[0],yvalues[1]))/2);
		break;
		case "TopRight": pixelfraction = 1-(((1-xvalues[0])*(1-yvalues[1]))/2);
		break;
		case "TopBottom": pixelfraction = Math.min(xvalues[0],xvalues[1]) + ((Math.max(xvalues[0],xvalues[1]) - Math.min(xvalues[0],xvalues[1]))/2);
		break;
		case "LeftBottom": pixelfraction = (yvalues[0]*xvalues[1])/2;
		break;
		default: pixelfraction = 1;
	}
	return pixelfraction;
}
function rgb2Hex(rgbColour){
	try	{
		var rgbArray = rgb2Array(rgbColour);
		var red = parseInt(rgbArray[0]);
		var green = parseInt(rgbArray[1]);
		var blue = parseInt(rgbArray[2]);
		var hexColour = "#" + IntToHex(red) + IntToHex(green) + IntToHex(blue);
	}
	catch(e){
		alert("There was an error converting the RGB value to Hexadecimal in function rgb2Hex");
	}
	return hexColour;
}
function rgb2Array(rgbColour)
{
	var rgbValues = rgbColour.substring(4, rgbColour.indexOf(")"));
	var rgbArray = rgbValues.split(", ");
	return rgbArray;
}
function setOpacity(obj, opacity)
{
	opacity = (opacity == 100)?99.999:opacity;
	if(isSafari && obj.tagName != "IFRAME"){
		var rgbArray = rgb2Array(obj.style.backgroundColor);
		var red = parseInt(rgbArray[0]);
		var green = parseInt(rgbArray[1]);
		var blue = parseInt(rgbArray[2]);
		obj.style.backgroundColor = "rgba(" + red + ", " + green + ", " + blue + ", " + opacity/100 + ")";
	}
	else if(typeof(obj.style.opacity) != "undefined"){
		obj.style.opacity = opacity/100;
	}
	else if(typeof(obj.style.MozOpacity) != "undefined"){
		obj.style.MozOpacity = opacity/100;
	}
	else if(typeof(obj.style.filter) != "undefined"){
		obj.style.filter = "alpha(opacity:" + opacity + ")";
	}
	else if(typeof(obj.style.KHTMLOpacity) != "undefined"){
		obj.style.KHTMLOpacity = opacity/100;
	}
}

function format_colour(colour){
	var returnColour = "#ffffff";
	if(colour != "" && colour != "transparent")	{
		if(colour.substr(0, 3) == "rgb"){
			returnColour = rgb2Hex(colour);
		}
		else if(colour.length == 4){
			returnColour = "#" + colour.substring(1, 2) + colour.substring(1, 2) + colour.substring(2, 3) + colour.substring(2, 3) + colour.substring(3, 4) + colour.substring(3, 4);
		}
		else{
			returnColour = colour;
		}
	}
	return returnColour;
}
function get_style(obj, property, propertyNS){
	try	{
		if(obj.currentStyle)		{
			var returnVal = eval("obj.currentStyle." + property);
		}
		else		{
			if(isSafari && obj.style.display == "none")			{
				obj.style.display = "";
				var wasHidden = true;
			}
			var returnVal = document.defaultView.getComputedStyle(obj, '').getPropertyValue(propertyNS);
			if(isSafari && wasHidden)			{
				obj.style.display = "none";
			}
		}
	}
	catch(e){
	}
	return returnVal;
}

function newCurvyError(errorMessage)
{
	return new Error("curvyCorners Error:\n" + errorMessage);
}
function roundTP(id,rad){
if (!rad){rad = 4;}
settings = {
tl: { radius: rad },
tr: { radius: rad },
bl: { radius: rad },
br: { radius: rad },
antiAlias: true,
autoPad: false
};
var cornersObj = new curvyCorners(settings, $I(id));
cornersObj.applyCornersToAll();
}

 
 
 
 
 
 
 
 
/***********************************************
* Ultimate Fade-In Slideshow (v1.51): © Dynamic Drive (http://www.dynamicdrive.com)
* This notice MUST stay intact for legal use
* Visit http://www.dynamicdrive.com/ for this script and 100s more.
***********************************************/
var fadebgcolor="transparent"

////NO need to edit beyond here/////////////
 
var fadearray=new Array() //array to cache fadeshow instances
var fadeclear=new Array() //array to cache corresponding clearinterval pointers
 
var dom=(document.getElementById) //modern dom browsers
var iebrowser=document.all
 
function fadeshow(theimages, fadewidth, fadeheight, borderwidth, delay, pause, displayorder){
this.pausecheck=pause
this.mouseovercheck=0
this.delay=delay
this.degree=10 //initial opacity degree (10%)
this.curimageindex=0
this.nextimageindex=1
fadearray[fadearray.length]=this
this.slideshowid=fadearray.length-1
this.canvasbase="canvas"+this.slideshowid
this.curcanvas=this.canvasbase+"_0"
if (typeof displayorder!="undefined")
theimages.sort(function() {return 0.5 - Math.random();}) //thanks to Mike (aka Mwinter) :)
this.theimages=theimages
this.imageborder=parseInt(borderwidth)
this.postimages=new Array() //preload images
for (p=0;p<theimages.length;p++){
this.postimages[p]=new Image()
this.postimages[p].src=theimages[p][0]
}
 
var fadewidth=fadewidth+this.imageborder*2
var fadeheight=fadeheight+this.imageborder*2
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers (ie: Firefox)
document.write('<div id="master'+this.slideshowid+'" style="position:relative;width:'+fadewidth+'px;height:'+fadeheight+'px;overflow:hidden;"><div id="'+this.canvasbase+'_0" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;text-align:right;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div><div id="'+this.canvasbase+'_1" style="position:absolute;width:'+fadewidth+'px;height:'+fadeheight+'px;top:0;left:0;text-align:right;filter:progid:DXImageTransform.Microsoft.alpha(opacity=10);opacity:0.1;-moz-opacity:0.1;-khtml-opacity:0.1;background-color:'+fadebgcolor+'"></div></div>')
else
document.write('<div><img name="defaultslide'+this.slideshowid+'" src="'+this.postimages[0].src+'"></div>')
 
if (iebrowser&&dom||dom) //if IE5+ or modern browsers such as Firefox
this.startit()
else{
this.curimageindex++
setInterval("fadearray["+this.slideshowid+"].rotateimage()", this.delay)
}
}

function fadepic(obj){
if (obj.degree<100){
obj.degree+=3
if (obj.tempobj.filters&&obj.tempobj.filters[0]){
if (typeof obj.tempobj.filters[0].opacity=="number") //if IE6+
obj.tempobj.filters[0].opacity=obj.degree
else //else if IE5.5-
obj.tempobj.style.filter="alpha(opacity="+obj.degree+")"
}
else if (obj.tempobj.style.MozOpacity)
obj.tempobj.style.MozOpacity=obj.degree/101
else if (obj.tempobj.style.KhtmlOpacity)
obj.tempobj.style.KhtmlOpacity=obj.degree/100
else if (obj.tempobj.style.opacity&&!obj.tempobj.filters)
obj.tempobj.style.opacity=obj.degree/101
}
else{
clearInterval(fadeclear[obj.slideshowid])
obj.nextcanvas=(obj.curcanvas==obj.canvasbase+"_0")? obj.canvasbase+"_0" : obj.canvasbase+"_1"
obj.tempobj=iebrowser? iebrowser[obj.nextcanvas] : document.getElementById(obj.nextcanvas)
obj.populateslide(obj.tempobj, obj.nextimageindex)
obj.nextimageindex=(obj.nextimageindex<obj.postimages.length-1)? obj.nextimageindex+1 : 0
setTimeout("fadearray["+obj.slideshowid+"].rotateimage()", obj.delay)
}
}
 
fadeshow.prototype.populateslide=function(picobj, picindex){
var slideHTML=""
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML='<a href="'+this.theimages[picindex][1]+'" target="'+this.theimages[picindex][2]+'">'
slideHTML+='<img src="'+this.postimages[picindex].src+'" border="'+this.imageborder+'px">'
if (this.theimages[picindex][1]!="") //if associated link exists for image
slideHTML+='</a>'
picobj.innerHTML=slideHTML
}
 
 
fadeshow.prototype.rotateimage=function(){
if (this.pausecheck==1) //if pause onMouseover enabled, cache object
var cacheobj=this
if (this.mouseovercheck==1)
setTimeout(function(){cacheobj.rotateimage()}, 100)
else if (iebrowser&&dom||dom){
this.resetit()
var crossobj=this.tempobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
crossobj.style.zIndex++
fadeclear[this.slideshowid]=setInterval("fadepic(fadearray["+this.slideshowid+"])",5)
this.curcanvas=(this.curcanvas==this.canvasbase+"_0")? this.canvasbase+"_1" : this.canvasbase+"_0"
}
else{
var ns4imgobj=document.images['defaultslide'+this.slideshowid]
ns4imgobj.src=this.postimages[this.curimageindex].src
}
this.curimageindex=(this.curimageindex<this.postimages.length-1)? this.curimageindex+1 : 0
}
 
fadeshow.prototype.resetit=function(){
this.degree=10
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
if (crossobj.filters&&crossobj.filters[0]){
if (typeof crossobj.filters[0].opacity=="number") //if IE6+
crossobj.filters(0).opacity=this.degree
else //else if IE5.5-
crossobj.style.filter="alpha(opacity="+this.degree+")"
}
else if (crossobj.style.MozOpacity)
crossobj.style.MozOpacity=this.degree/101
else if (crossobj.style.KhtmlOpacity)
crossobj.style.KhtmlOpacity=this.degree/100
else if (crossobj.style.opacity&&!crossobj.filters)
crossobj.style.opacity=this.degree/101
}
 
 
fadeshow.prototype.startit=function(){
var crossobj=iebrowser? iebrowser[this.curcanvas] : document.getElementById(this.curcanvas)
this.populateslide(crossobj, this.curimageindex)
if (this.pausecheck==1){ //IF SLIDESHOW SHOULD PAUSE ONMOUSEOVER
var cacheobj=this
var crossobjcontainer=iebrowser? iebrowser["master"+this.slideshowid] : document.getElementById("master"+this.slideshowid)
crossobjcontainer.onmouseover=function(){cacheobj.mouseovercheck=1}
crossobjcontainer.onmouseout=function(){cacheobj.mouseovercheck=0}
}
this.rotateimage()
}
