/*
KesionCMS通用脚本函数，最后更新于2008-9-28
*/
//容错脚本
ResumeError=function ()
{
        return true;
}
window.onerror = ResumeError;

 //检查是否中文字符
is_zw=function(str){
	exp=/[0-9a-zA-Z_.,#@!$%^&*()-+=|\?/<>]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
}
//验证是否包含逗号
CheckBadChar=function (Obj,AlertStr)
{
	exp=/[,，]/g;
	if(Obj.value.search(exp) != -1)
	{   alert(AlertStr+"不能包含逗号");
	    Obj.value="";
		Obj.focus();
		return false;
	}
	return true;
}
// 检查是否有效的扩展名
IsExt=function(FileName, AllowExt){
		var sTemp;
		var s=AllowExt.toUpperCase().split("|");
		for (var i=0;i<s.length ;i++ ){
			sTemp=FileName.substr(FileName.length-s[i].length-1);
			sTemp=sTemp.toUpperCase();
			s[i]="."+s[i];
			if (s[i]==sTemp){
				return true;
				break;
			}
		}
		return false;
}
//检查是否数字方法一
is_number=function(str){
	exp=/[^0-9()-]/g;
	if(str.search(exp) != -1)
	{
		return false;
	}
	return true;
}
//检查数字方法二
CheckNumber=function(Obj,DescriptionStr){
	if (Obj.value!='' && (isNaN(Obj.value) || Obj.value<0))
	{
		alert(DescriptionStr+"应填有效数字！");
		Obj.value="";
		Obj.focus();
		return false;
	}
	return true;
}
//检查电子邮件有效性
is_email=function(str){ 
if((str.indexOf("@")==-1)||(str.indexOf(".")==-1)){
	return false;
	}
	return true;
}
//检查日期格式是否为2008-01-01 13:01:01
is_date=function(str){   
var reg = /^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2}) (\d{1,2}):(\d{1,2}):(\d{1,2})$/; 
var r = str.match(reg); 
if(r==null)return is_shortdate(str); 
var d= new Date(r[1], r[3]-1,r[4],r[5],r[6],r[7]); 
var v=(d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]&&d.getHours()==r[5]&&d.getMinutes()==r[6]&&d.getSeconds()==r[7]);
if (v==false)
  return is_shortdate(str)
 else
 return true;
}
////检查日期格式是否为2008-01-01
is_shortdate=function(str){
var r = str.match(/^(\d{1,4})(-|\/)(\d{1,2})\2(\d{1,2})$/); 
if(r==null)return false; 
var d= new Date(r[1], r[3]-1, r[4]); 
return (d.getFullYear()==r[1]&&(d.getMonth()+1)==r[3]&&d.getDate()==r[4]);	
}

/* 点击选中表单li */
function chk_iddiv(id){
	var objc=document.getElementById("c"+id); //多选框
	var obju=document.getElementById("u"+id);//ul
	if (objc.checked==''){
		objc.checked='checked';
		obju.style.background='#EEF8FE';
		//obju.className='listmouseover';
	}else{
		objc.checked='';
		obju.style.background='';
		//obju.className='list';
	}
}
/**/
function chk_idBatch(form,askString){
	var bCheck;
	bCheck=false;
	for (var i=0;i < form.elements.length;i++)
    {
    var e = form.elements[i];
    if (e.name == "id"){
       if (e.checked ==1){
       		bCheck=true;
       		break;
       	}
		}
	}
	
	if (bCheck==false){
		alert("请选择要操作的内容!")
		return false;
		}
	else{
		return confirm('确认要'+askString+"?");
		}
}
function get_Ids(form)
{
	var ids='';
	for (var i=0;i < form.elements.length;i++)
	{
			var e = form.elements[i];
			if (e.name == "id"){
			   if (e.checked ==1){
			      if (ids=='')
				   ids=e.value;
				  else
					ids+=","+e.value;
				  }
				}
	}
	return ids;
}
function Select(flag)
{  
  $("input[type=checkbox]").each(function(){
  if ($(this).attr("name")=="id"){
	var objc=$("#c"+$(this).val()); 
	var obju=$("#u"+$(this).val());
	switch (flag){
	  case 0:  //全选
	   objc.attr("checked",true);
	   obju.attr("style","background:#eef8fe");
	   break;
	  case 1: //反选
		if (objc.attr("checked")==false){
			objc.attr("checked",true);
			obju.attr("style","background:#eef8fe");
		}else{
			objc.attr("checked",false);
	    	obju.attr("style","background:");
		}
		break;
	 case 2:  //不选
		objc.attr("checked",false);
	    obju.attr("style","background:");
		break;
	 }
  }
 })
}


// utility function called by getCookie( )
 function getCookieVal(offset) {
			var endstr = document.cookie.indexOf (";", offset);
			if (endstr == -1) {
				endstr = document.cookie.length;
			}
		    return unescape(document.cookie.substring(offset, endstr));
}
// primary function to retrieve cookie by name
function getCookie(name) {
			var arg = name + "=";
			var alen = arg.length;
			var clen = document.cookie.length;
			var i = 0;
			while (i < clen) {
				var j = i + alen;
				if (document.cookie.substring(i, j) == arg) { 
					return getCookieVal(j);
				}
				i = document.cookie.indexOf(" ", i) + 1;
				if (i == 0) break; 
			}
			return "";
}
// store cookie value with optional details as needed
function setCookie(name, value) {
			document.cookie = name + "=" + escape (value)
}
// remove the cookie by setting ancient expiration date
function deleteCookie(name,path,domain) {
			if (getCookie(name)) {
				document.cookie = name + "=" 
			}
}

function CheckAll(form)
{
	 for (var i=0;i<form.elements.length;i++)
	 {
		var e = form.elements[i];
		if (e.Name != 'chkAll'&&e.disabled==false)
		e.checked = form.chkAll.checked;
	}
 } 
function OpenWindow(Url,Width,Height,WindowObj){
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:no;help:no;scroll:no;status:0;help:0;scroll:0;');
	return ReturnStr;
}
var obj=null;
function OpenThenSetValue(Url,Width,Height,WindowObj,SetObj){
	if (document.all){
	var ReturnStr=showModalDialog(Url,WindowObj,'dialogWidth:'+Width+'pt;dialogHeight:'+Height+'pt;status:no;help:no;scroll:no;status:0;help:0;scroll:0;');
	if (ReturnStr!='' && ReturnStr!=undefined) SetObj.value=ReturnStr;
	return ReturnStr;
	}else{
	 obj=SetObj;
	 Width=Width+180;
	 Height=Height+80;
	 window.open(Url,'newWin','modal=yes,width='+Width+',height='+Height+',resizable=no,scrollbars=no');
	}
}
function setVal(v)
{ 
 obj.value=v;
}
function CheckEnglishStr(Obj,DescriptionStr)
{
	var TempStr=Obj.value,i=0,ErrorStr='',CharAscii;
	if (TempStr!='')
	{
		for (i=0;i<TempStr.length;i++)
		{
			CharAscii=TempStr.charCodeAt(i);
			if (CharAscii>=255||CharAscii<=31)
			{
				ErrorStr=ErrorStr+TempStr.charAt(i);
			}
			else
			{
				if (!CheckErrorStr(CharAscii))
				{
					ErrorStr=ErrorStr+TempStr.charAt(i);
				}
			}
		}
		if (ErrorStr!='')
		{
			alert("出错信息:\n\n"+DescriptionStr+'发现非法字符:'+ErrorStr);
			Obj.focus();
			return false;
		}
		if (!(((TempStr.charCodeAt(0)>=48)&&(TempStr.charCodeAt(0)<=57))||((TempStr.charCodeAt(0)>=65)&&(TempStr.charCodeAt(0)<=90))||((TempStr.charCodeAt(0)>=97)&&(TempStr.charCodeAt(0)<=122))))
		{
			alert(DescriptionStr+'首字符只能够为数字或者字母');
			Obj.focus();
			return false;
		}
	}
	return true;
}
function CheckErrorStr(CharAsciiCode)
{
	var TempArray=new Array(34,47,92,42,58,60,62,63,124);
	for (var i=0;i<TempArray.length;i++)
	{
		if (CharAsciiCode==TempArray[i]) return false;
	}
	return true;
}
//Obj单击的对象,OpStr--BottomFrame显示当前操作的提示信息,ButtonSymbol按钮状态,MainUrl--MainFrame的链接
function SelectObjItem1(Obj,OpStr,ButtonSymbol,MainUrl,ChannelID)
{   if (OpStr!='')
    {
		window.parent.parent.frames['BottomFrame'].location.href='KS.Split.asp?ChannelID='+escape(ChannelID)+'&OpStr='+escape(OpStr)+'&ButtonSymbol='+escape(ButtonSymbol);
		}
	if(MainUrl!='')
	{window.parent.parent.frames['MainFrame'].location.href=MainUrl;
	}

}
function FolderClick(Obj,el)
{   	var i=0;
  for (var i=0;i<document.all.length;i++)
	   {
		if (document.all(i).className=='FolderSelected') document.all(i).className='';
	    }
	         Obj.className='FolderSelected';
	  
              for (i=0;i<DocElementArr.length;i++)
			{
				if (el==DocElementArr[i].Obj)
				{
					if (DocElementArr[i].Selected==false)
					{
						DocElementArr[i].Obj.className='FolderSelectItem';
						DocElementArr[i].Selected=true;
					}
					else
					{
						DocElementArr[i].Obj.className='FolderItem';
						DocElementArr[i].Selected=false;
					}
				}
			}
}
function InsertKeyWords(obj,KeyWords)
{ 
	if (KeyWords!='')
	{
		if (obj.value.search(KeyWords)==-1)
		{
			if (obj.value=='') obj.value=KeyWords;
			else obj.value=obj.value+','+KeyWords;
			
		}
	}
	if (KeyWords == 'Clean')
	{
		obj.value = '';
	}
	return;
}
//发送参数给各个Frames窗口
function SendFrameInfo(MainUrl,LeftUrl,ControlUrl){
	location.href=MainUrl;
    parent.frames['LeftFrame'].LeftInfoFrame.location.href=LeftUrl;
	 $(parent.document).find('#BottomFrame')[0].src=ControlUrl;
}

function InsertFileFromUp(FileList,fileSize,maxId,title)
{   var files=FileList.split('/');
	var file=files[files.length-1];
	var fileext = FileList.substring(FileList.lastIndexOf(".") + 1, FileList.length).toLowerCase();
    if (fileext=="gif" || fileext=="jpg" || fileext=="jpeg" || fileext=="bmp" || fileext=="png")
	  {
		 insertHTMLToEditor('<img src="'+FileList+'" border="0"/><br/>');	
	  }else{
	  var str="<div class=\"quote\">[UploadFiles]"+maxId+","+fileSize+","+fileext+","+title+"[/UploadFiles]</div><p></p><br/>";
	     insertHTMLToEditor(str);	
	 }
}
//选择附件
function PopInsertAnnex(){
	new KesionPopup().PopupCenterIframe('选择附件插入','../plus/selectAnnex.asp',690,300,'no')
}
function Getcolor(img_val,Url,input_val){
	var arr = showModalDialog(Url, "", "dialogWidth:18.5em; dialogHeight:17.5em; status:0; help:0");
	if (arr != null){
		document.getElementById(input_val).value = arr;
		img_val.style.backgroundColor = arr;
		}
}
function OpenImgCutWindow(deloriginphoto,installdir,photourl)
{
	OpenImgCutWindows(deloriginphoto,installdir,photourl,$('#PhotoUrl')[0]);
}
function OpenImgCutWindows(deloriginphoto,installdir,photourl,obj)
{
	OpenThenSetValue(installdir+'plus/ImgCut.asp?del='+deloriginphoto+'&photourl='+photourl,680,380,window,obj);
}
function scrollDoor(){
}
scrollDoor.prototype = {
	sd : function(menus,divs,openClass,closeClass){
		var _this = this;
		if(menus.length != divs.length)
		{
			alert("菜单层数量和内容层数量不一样!");
			return false;
		}				
		for(var i = 0 ; i < menus.length ; i++)
		{	
			_this.$(menus[i]).value = i;				
			_this.$(menus[i]).onmouseover = function(){
					
				for(var j = 0 ; j < menus.length ; j++)
				{						
					_this.$(menus[j]).className = closeClass;
					_this.$(divs[j]).style.display = "none";
				}
				_this.$(menus[this.value]).className = openClass;	
				_this.$(divs[this.value]).style.display = "block";				
			}
		}
		},
	$ : function(oid){
		if(typeof(oid) == "string")
		return document.getElementById(oid);
		return oid;
	}
}




Wo_Modal = new Object();
Wo_Modal._variableName = 'Wo_Modal';
Wo_Modal.LoadingHtmlUrl = null;
Wo_Modal.WindowCssClasses = new Array();
Wo_Modal.WindowTitleCssClasses = new Array();
Wo_Modal.WindowCloseCssClasses = new Array();
Wo_Modal.WindowContentCssClasses = new Array();
Wo_Modal.WindowMaskCssClasses = new Array();
Wo_Modal.WindowFooterCssClasses = new Array();
Wo_Modal.WindowResizeCssClasses = new Array();
Wo_Modal.ZIndex = 100;
Wo_Modal._isShown = false;
Wo_Modal._initialized = false;
Wo_Modal._modal = null;
Wo_Modal._modalTitle = null;
Wo_Modal._modalClose = null;
Wo_Modal._modalAnimationMask = null;
Wo_Modal._modalMask = null;
Wo_Modal._modalIframe = null;
Wo_Modal._modalResize = null;
Wo_Modal._modalFooter = null;
Wo_Modal._modalContent = null;
Wo_Modal._animationHandle = null;
Wo_Modal._isOpening = false;
Wo_Modal._hiddenSelects = null;
Wo_Modal._checkForScrollResizeHandle = null;
Wo_Modal._lastModalInfo = null;
Wo_Modal._lastWindowInfo = null;
Wo_Modal._isDragging = false;
Wo_Modal._moveModalInfo = null;
Wo_Modal._resizeModalInfo = null;
Wo_Modal._isResizing = false;

Wo_Modal.Configure = function(loadingHtmlUrl, windowCssClasses, windowTitleCssClasses, windowCloseCssClasses, windowContentCssClasses, windowFooterCssClasses, windowResizeCssClasses, windowMaskCssClasses, zIndex)
{
	this.LoadingHtmlUrl = loadingHtmlUrl;
	this.WindowCssClasses = windowCssClasses;
	this.WindowTitleCssClasses = windowTitleCssClasses;
	this.WindowCloseCssClasses = windowCloseCssClasses;
	this.WindowContentCssClasses = windowContentCssClasses;
	this.WindowMaskCssClasses = windowMaskCssClasses;
	this.WindowFooterCssClasses = windowFooterCssClasses;
	this.WindowResizeCssClasses = windowResizeCssClasses;
	this.ZIndex = zIndex;
}

Wo_Modal.IsShown = function()
{
	return this._isShown;
}

Wo_Modal._getWindowInfo = function()
{
	var scrollX = 0, scrollY = 0, width = 0, height = 0, contentWidth = 0, contentHeight = 0;

	if (typeof(window.pageXOffset) == 'number') 
	{
		//Netscape compliant
		scrollX = window.pageXOffset;
		scrollY = window.pageYOffset;
	} 
	else if (document.body && (document.body.scrollLeft || document.body.scrollTop)) 
	{
		//DOM compliant
		scrollX = document.body.scrollLeft;
		scrollY = document.body.scrollTop;
	} 
	else if (document.documentElement && (document.documentElement.scrollLeft || document.documentElement.scrollTop)) 
	{
		//IE6 standards compliant mode
		scrollX = document.documentElement.scrollLeft;
		scrollY = document.documentElement.scrollTop;
	}
	
	if (typeof(window.innerWidth) == 'number') 
	{
		//Non-IE
		width = window.innerWidth;
		height = window.innerHeight;
	} 
	else if (document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) 
	{
		//IE 6+ in 'standards compliant mode'
		width = document.documentElement.clientWidth;
		height = document.documentElement.clientHeight;
	} 
	else if (document.body && (document.body.clientWidth || document.body.clientHeight)) 
	{
		//IE 4 compatible
		width = document.body.clientWidth;
		height = document.body.clientHeight;
	}
	
	if (document.documentElement && (document.documentElement.scrollHeight || document.documentElement.offsetHeight))
	{
		if (document.documentElement.scrollHeight > document.documentElement.offsetHeight)
		{
			contentWidth = document.documentElement.scrollWidth;
			contentHeight = document.documentElement.scrollHeight;
		}
		else
		{
			contentWidth = document.documentElement.offsetWidth;
			contentHeight = document.documentElement.offsetHeight;
		}
	}
	else if (document.body && (document.body.scrollHeight || document.body.offsetHeight))
	{
		if (document.body.scrollHeight > document.body.offsetHeight)
		{
			contentWidth = document.body.scrollWidth;
			contentHeight = document.body.scrollHeight;
		}
		else
		{
			contentWidth = document.body.offsetWidth;
			contentHeight = document.body.offsetHeight;
		}
	}
	else
	{
		contentWidth = width;
		contentHeight = height;
	}
	
	if (height > contentHeight)
		height = contentHeight;
		
	if (width > contentWidth)
		width = contentWidth;
	
	var rect = new Object();
	rect.ScrollX = scrollX;
	rect.ScrollY = scrollY;
	rect.Width = width;
	rect.Height = height;
	rect.ContentWidth = contentWidth;
	rect.ContentHeight = contentHeight;
	
	return rect;
}

Wo_Modal._getCurrentStyleValue = function(element, styleRule, jsStyleRule)
{
	var value = 0;
	
	if(document.defaultView && document.defaultView.getComputedStyle)
		value = parseInt(document.defaultView.getComputedStyle(element, "").getPropertyValue(styleRule), 0);
	else if(element.currentStyle)
		value = parseInt(element.currentStyle[jsStyleRule], 0);
	
	if (!isNaN(value))
		return value;
	else
		return 0;
}

Wo_Modal._calculateStyleOffset = function(element)
{
	var result = new Object();
	
	result.Height = this._getCurrentStyleValue(element, 'border-top-width', 'borderTopWidth') + 
		this._getCurrentStyleValue(element, 'border-bottom-width', 'borderBottomWidth') +
		this._getCurrentStyleValue(element, 'padding-top', 'paddingTop') +
		this._getCurrentStyleValue(element, 'padding-bottom', 'paddingBottom');
	
	result.Width = this._getCurrentStyleValue(element, 'border-left-width', 'borderLeftWidth') + 
		this._getCurrentStyleValue(element, 'border-right-width', 'borderRightWidth') +
		this._getCurrentStyleValue(element, 'padding-left', 'paddingLeft') +
		this._getCurrentStyleValue(element, 'padding-right', 'paddingRight');
	
	return result;
}

Wo_Modal.Open = function (url, width, height, onCloseFunction, x, y, ignoreCloseAndAnimation)
{
	if (!ignoreCloseAndAnimation && this._isShown)
		this.Close();
	else if (this._hiddenSelects)
	{
		for (var i = 0; i < this._hiddenSelects.length; i++)
		{
			if (this._hiddenSelects[i].Element.style.visibility == 'hidden')
				this._hiddenSelects[i].Element.style.visibility = this._hiddenSelects[i].Visibility;
		}
			
		this._hiddenSelects = null;
	}
	
	if (!this._initialized)
		this._initialize();
	
	try
	{
		this._modalTitle.childNodes[1].innerHTML = this._modalIframe.contentWindow.document.title;
	}
	catch (err)
	{
	}
	
	if (!ignoreCloseAndAnimation)
		this._modalIframe.src = url;
	
	try
	{
		this._modalIframe.contentWindow.opener = window;
	}
	catch (err)
	{
	}
	
	this._modalAnimationMask.style.display = 'none';
	this._modalMask.style.display = 'none';
	
	// retrieve the window info
	this._lastWindowInfo = this._getWindowInfo();
	
	this._modalAnimationMask.style.display = 'block';
	
	// width/height of panel
	if (width > this._lastWindowInfo.Width)
		width = this._lastWindowInfo.Width;
	
	this._modalAnimationMask.style.position = 'absolute';
	this._modalAnimationMask.style.zIndex = this.ZIndex;
	this._modalAnimationMask.style.display = 'block';
	this._modalAnimationMask.style.visibility = 'hidden';
	this._modalAnimationMask.style.overflow = 'hidden';
	
	this._modalAnimationMask.style.width = width + 'px';
	this._modalContent.style.width = width + 'px';
	
	this._modal.style.position = 'absolute';
	this._modal.style.display = 'block';
	this._modal.style.visibility = 'hidden';
	this._modal.style.left = '0px';
	this._modal.style.top = '0px';
	
	this._modalMask.style.position = 'absolute';
	this._modalMask.style.display = 'block';
	this._modalMask.style.zIndex = this.ZIndex;
	this._modalMask.style.visibility = 'visible';
	
	var modalContentOffset = this._calculateStyleOffset(this._modalContent);
	
	var offset = (this._modal.offsetHeight - this._modalContent.offsetHeight) - modalContentOffset.Height;
	if (height + offset > this._lastWindowInfo.Height)
		height = this._lastWindowInfo.Height - offset;
		
	if (width < this._modalResize.offsetWidth * 2)
		width = this._modalResize.offsetWidth * 2;
	
	if (width < this._modalClose.offsetWidth * 2)
		width = this._modalClose.offsetWidth * 2;
	
	if (height < this._modalTitle.offsetHeight + this._modalFooter.offsetHeight)
		height = this._modalTitle.offsetHeight + this._modalFooter.offsetHeight;
		
	this._modalIframe.style.height = height + 'px';
	this._modalContent.style.height = height + 'px';
	this._modalContent.style.width = (width - (this._modal.offsetWidth - this._modalContent.offsetWidth) - modalContentOffset.Width) + 'px';
	this._modalAnimationMask.style.width = width + 'px';
	this._modalAnimationMask.style.height = this._modal.offsetHeight + 'px';
	
	this._modalMask.style.left = '0px';
	this._modalMask.style.top = '0px';	
	this._modalMask.style.width = this._lastWindowInfo.ContentWidth + 'px';
	this._modalMask.style.height = this._lastWindowInfo.ContentHeight + 'px';
	
	this._lastWindowInfo = this._getWindowInfo();
	
	var panelWidth = this._modal.offsetWidth;
	var panelHeight = this._modal.offsetHeight;
	var animatePropertyName, animateTargetValue, animateNextValue;
	
	if (typeof(x) == 'undefined' || isNaN(parseInt(x, 10)))
		x = ((this._lastWindowInfo.Width - panelWidth) / 2) + this._lastWindowInfo.ScrollX;
	
	if (x + panelWidth > this._lastWindowInfo.Width + this._lastWindowInfo.ScrollX)
		x = this._lastWindowInfo.Width + this._lastWindowInfo.ScrollX - panelWidth;
		
	if (x < this._lastWindowInfo.ScrollX)
		x = this._lastWindowInfo.ScrollX;
	
	if (typeof(y) == 'undefined' || isNaN(parseInt(y, 10)))
		y = ((this._lastWindowInfo.Height - panelHeight) / 2) + this._lastWindowInfo.ScrollY;
	
	if (y + panelHeight > this._lastWindowInfo.Height + this._lastWindowInfo.ScrollY)
		y = this._lastWindowInfo.Height + this._lastWindowInfo.ScrollY - panelHeight;
	
	if (y < this._lastWindowInfo.ScrollY)
		y = this._lastWindowInfo.ScrollY;
		
	this._modalAnimationMask.style.left = x + 'px';
	this._modalAnimationMask.style.top = y + 'px';
	
	animateTargetValue = 0;
	animateNextValue = -panelHeight;
	
	this._modal.style.visibility = 'visible';
	this._modalAnimationMask.style.visibility = 'visible';
	this._modalAnimationMask.style.overflow = 'hidden';
	
	// detect and hide select boxes
	if (this._modalAnimationMask.getClientRects)
	{
		var selectBoxes = document.getElementsByTagName('select');
		this._hiddenSelects = new Array();
		for (var i = 0; i < selectBoxes.length; i++)
		{
			this._hiddenSelects[this._hiddenSelects.length] = { Element: selectBoxes[i], Visibility: selectBoxes[i].style.visibility };
			selectBoxes[i].style.visibility = 'hidden';
		}
	}
	
	this._isOpening = true;
	if (ignoreCloseAndAnimation)
		this._animationHandle = window.setTimeout(new Function(this._variableName + '._animate(0,0,0,0);'), 9);
	else
	{
		this._modalIframe.style.display = 'none';
		this._animate(0, -panelHeight, panelHeight / 3, .67);
	}

	this._lastModalInfo = { Url : this._modalIframe.src, OnCloseFunction : onCloseFunction, X : x, Y : y, Width : parseInt(width, 10), Height: parseInt(height, 10) };	
	this._isShown = true;
}

Wo_Modal._checkForScrollResize = function()
{
	if (this._checkForScrollResizeHandle)
		window.clearTimeout(this._checkForScrollResizeHandle);

	if (this._isShown && !this._isOpening && this._lastWindowInfo)
	{
		try
		{
			this._modalTitle.childNodes[1].innerHTML = this._modalIframe.contentWindow.document.title;
		}
		catch (err)
		{
		}
		
		var windowInfo = this._getWindowInfo();
		if (windowInfo.ScrollX != this._lastWindowInfo.ScrollX || windowInfo.ScrollY != this._lastWindowInfo.ScrollY || windowInfo.Width != this._lastWindowInfo.Width || windowInfo.Height != this._lastWindowInfo.Height)
			this.Open(null, this._lastModalInfo.Width, this._lastModalInfo.Height, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.X, this._lastModalInfo.Y, true);
		else
			this._checkForScrollResizeHandle = window.setTimeout(new Function('window.' + this._variableName + '._checkForScrollResize();'), 999);
	}
}

Wo_Modal.Close = function(returnValue)
{
	if (this._isShown)
	{
		if (!this._initialized)
			this._initialize();
	
		this._modal.style.position = 'absolute';
		this._modal.style.display = 'none';
		this._modalAnimationMask.style.position = 'absolute';
		this._modalAnimationMask.style.display = 'none';
		this._modalMask.style.position = 'absolute';
		this._modalMask.style.display = 'none';
		this._modalIframe.src = this.LoadingHtmlUrl;

		var onCloseFunction = this._lastModalInfo.OnCloseFunction;
		
		this._isShown = false;
		this._lastModalInfo = null;
		this._windowInfo = null;
		
		if (this._hiddenSelects)
		{
			for (var i = 0; i < this._hiddenSelects.length; i++)
			{
				if (this._hiddenSelects[i].Element.style.visibility == 'hidden')
					this._hiddenSelects[i].Element.style.visibility = this._hiddenSelects[i].Visibility;
			}
				
			this._hiddenSelects = null;
		}

		if (onCloseFunction)
			onCloseFunction(returnValue);
		
		this.Dispose();
	}
}

Wo_Modal.Refresh = function()
{
	if (this._animationHandle)
		window.clearTimeout(this._animationHandle);
	
	this.Dispose();
	
	if (this._isShown && this._lastModalInfo)
		this.Open(this._lastModalInfo.Url, this._lastModalInfo.Width, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.Height, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.X, this._lastModalInfo.Y);
}

Wo_Modal._initialize = function()
{
	this._modalMask = document.createElement('div');
	this._modalMask.style.width = 'auto';
	this._modalMask.style.height = 'auto';
	this._modalMask.style.position = 'absolute';
	this._modalMask.style.display = 'none';

	var mm = this._modalMask;	
	if (this.WindowMaskCssClasses.length > 0)
	{
		mm.className = this.WindowMaskCssClasses[0];
		for (var i = 1; i < this.WindowMaskCssClasses.length; i++)
		{
			mm.appendChild(document.createElement('div'));
			mm = mm.childNodes[0];
			mm.className = this.WindowMaskCssClasses[i];
			mm.style.width = 'auto';
			mm.style.height = 'auto';
		}
	}
	
	document.body.appendChild(this._modalMask);
	
	this._modalAnimationMask = document.createElement('div');
	this._modalAnimationMask.style.position = 'absolute';
	this._modalAnimationMask.style.display = 'none';
	this._modalAnimationMask.style.overflow = 'hidden';
	
	this._modal = document.createElement('div');
	this._modal.style.width = 'auto';
	this._modal.style.height = 'auto';
	this._modal.style.position = 'absolute';
	this._modal.style.display = 'none';

	var m = this._modal;	
	if (this.WindowCssClasses.length > 0)
	{
		m.className = this.WindowCssClasses[0];
		for (var i = 1; i < this.WindowCssClasses.length; i++)
		{
			m.appendChild(document.createElement('div'));
			m = m.childNodes[0];
			m.className = this.WindowCssClasses[i];
			m.style.width = 'auto';
			m.style.height = 'auto';
		}
	}
	
	this._modalTitle = document.createElement('div');
	m.appendChild(this._modalTitle);
	if (this.WindowTitleCssClasses.length > 0)
	{
		this._modalTitle.className = this.WindowTitleCssClasses[0];
		for (var i = 1; i < this.WindowTitleCssClasses.length; i++)
		{
			this._modalTitle.appendChild(document.createElement('div'));
			this._modalTitle = this._modalTitle.childNodes[0];
			this._modalTitle.className = this.WindowTitleCssClasses[i];
		}
	}
	this._modalTitle.onmousedown = new Function('event', 'window.' + this._variableName + '._startDrag(event); return false;');
	
	this._modalClose = document.createElement('div');
	this._modalTitle.appendChild(this._modalClose);
	
	var mc = this._modalClose;
	if (this.WindowCloseCssClasses.length > 0)
	{
		mc.className = this.WindowCloseCssClasses[0];
		for (var i = 1; i < this.WindowCloseCssClasses.length; i++)
		{
			mc.appendChild(document.createElement('div'));
			mc = mc.childNodes[0];
			mc.className = this.WindowCloseCssClasses[i];
		}
	}
	
	this._modalClose.onclick = new Function('window.' + this._variableName + '.Close();');
		
	this._modalTitle.appendChild(document.createElement('span'));
	
	var e = document.createElement('div');
	e.style.clear = 'both';
	this._modalTitle.appendChild(e);
	
	this._modalContent = document.createElement('div');
	m.appendChild(this._modalContent);
	if (this.WindowContentCssClasses.length > 0)
	{
		this._modalContent.className = this.WindowContentCssClasses[0];
		for (var i = 1; i < this.WindowContentCssClasses.length; i++)
		{
			this._modalContent.appendChild(document.createElement('div'));
			this._modalContent = this._modalContent.childNodes[0];
			this._modalContent.className = this.WindowContentCssClasses[i];
		}
	}
	
	this._modalIframe = document.createElement('iframe');
	this._modalIframe.src = this.LoadingHtmlUrl;
	this._modalIframe.width = '100%';
	this._modalIframe.border = '0';
	this._modalIframe.frameBorder = 'no';
	this._modalIframe.style.borderLeftWidth = '0px';
	this._modalIframe.style.borderRightWidth = '0px';
	this._modalIframe.style.borderTopWidth = '0px';
	this._modalIframe.style.borderBottomWidth = '0px';
	this._modalContent.appendChild(this._modalIframe);
	
	this._modalFooter = document.createElement('div');
	m.appendChild(this._modalFooter);
	var mf = this._modalFooter;
	if (this.WindowFooterCssClasses.length > 0)
	{
		mf.className = this.WindowFooterCssClasses[0];
		for (var i = 1; i < this.WindowFooterCssClasses.length; i++)
		{
			mf.appendChild(document.createElement('div'));
			mf = mf.childNodes[0];
			mf.className = this.WindowFooterCssClasses[i];
		}
	}

	this._modalResize = document.createElement('div');
	mf.appendChild(this._modalResize);

	var e = document.createElement('div');
	e.style.clear = 'both';
	mf.appendChild(e);

	var mr = this._modalResize;
	if (this.WindowResizeCssClasses.length > 0)
	{
		mr.className = this.WindowResizeCssClasses[0];
		for (var i = 1; i < this.WindowResizeCssClasses.length; i++)
		{
			mr.appendChild(document.createElement('div'));
			mr = mr.childNodes[0];
			mr.className = this.WindowResizeCssClasses[i];
		}
	}
	
	this._modalResize.onmousedown = new Function('event', 'window.' + this._variableName + '._startResize(event); return false;');

	this._modalAnimationMask.appendChild(this._modal);

	document.body.appendChild(this._modalAnimationMask);
	
	this._initialized = true;
}

Wo_Modal.Dispose = function()
{
	if (this._initialized)
	{
		if (this._animationHandle)
			window.clearTimeout(this._animationHandle);
		
		this._isShown = false;
		this._isOpening = false;
		
		if (document && document.body)
		{
			document.body.removeChild(this._modalAnimationMask);
			document.body.removeChild(this._modalMask);
			this._modalClose.onclick = null;
			this._modalTitle.onmousedown = null;
			this._modalResize.onmousedown = null;
			this._modal = null;
			this._modalTitle = null;
			this._modalClose = null;
			this._modalAnimationMask = null;
			this._modalMask = null;
			this._modalIframe = null;
			this._modalResize = null;
			this._modalFooter = null;
			this._modalContent = null;
		}
		
		this._initialized = false;
	}
}

Wo_Modal._animate = function(targetValue, nextValue, step, acceleration)
{
	if (this._animationHandle)
		window.clearTimeout(this._animationHandle);
	
	if (!this._isOpening)
		return;
			
	var currValue = parseInt(this._modal.style.top, 10);
	if ((step < 0 && currValue < targetValue) || (step > 0 && currValue > targetValue) || Math.abs(step) < 1)
	{
		// complete	
		if (this._hiddenSelects)
		{
			for (var i = 0; i < this._hiddenSelects.length; i++)
				this._hiddenSelects[i].Element.style.visibility = 'hidden';
		}
	
		this._modal.style.top = targetValue + 'px';
		this._modal.style.position = 'static';
		this._modalAnimationMask.style.overflow = 'visible';
		this._animationHandle = null;
		
		if (!this._isResizing && !this._isDragging)
			this._modalIframe.style.display = 'block';
		
		this._isOpening = false;
		
		this._lastWindowInfo = this._getWindowInfo();
		this._checkForScrollResizeHandle = window.setTimeout(new Function('window.' + this._variableName + '._checkForScrollResize();'), 999);
	}
	else
	{
		// continue animation
		this._modal.style.top = nextValue + 'px';
		
		nextValue = nextValue + step;
		if (step > 0 && nextValue > targetValue)
			nextValue = targetValue;
		else if (step < 0 && nextValue < targetValue)
			nextValue = targetValue;
		
		step = step * acceleration;
		
		this._animationHandle = window.setTimeout(new Function(this._variableName + '._animate(' + targetValue + ',' + nextValue + ',' + step + ',' + acceleration + ');'), 19);
	}
}

Wo_Modal._startDrag = function(event)
{
	if (!this._initialized)
		this._initialize();
	
	if (!event)
		event = window.event;
	
	this._moveModalInfo = new Object();
		
	this._moveModalInfo.StartMouseX = event.pageX ? event.pageX : event.screenX;
	this._moveModalInfo.StartMouseY = event.pageY ? event.pageY : event.screenY;
	this._moveModalInfo.StartModalX = this._lastModalInfo.X;
	this._moveModalInfo.StartModalY = this._lastModalInfo.Y;
	this._moveModalInfo.Button = event.button;
	
	document.onmouseup = new Function('event', 'window.' + this._variableName + '._endDrag(event); return false;');
	document.onmousemove = new Function('event', 'window.' + this._variableName + '._drag(event); return false;');
	
	this._modalIframe.style.display = 'none';	
	this._isDragging = true;
}

Wo_Modal._endDrag = function(event)
{
	if (!this._initialized)
		this._initialize();
	
	this._isDragging = false;
	this._moveModalInfo = null;
	document.onmouseup = null;
	document.onmousemove = null;
	this._modalIframe.style.display = 'block';
}

Wo_Modal._drag = function(event)
{
	if (!this._initialized)
		this._initialize();

	if (!event)
		event = window.event;
	
	if (event.button != this._moveModalInfo.Button)
	{
		this._endDrag(event);
		return;
	}

	var eventX = typeof(event.pageX) != 'undefined' ? event.pageX : event.screenX;
	var eventY = typeof(event.pageY) != 'undefined' ? event.pageY : event.screenY;
	
	var xChange = eventX - this._moveModalInfo.StartMouseX;
	var yChange = eventY - this._moveModalInfo.StartMouseY;
	
	this.Open(null, this._lastModalInfo.Width, this._lastModalInfo.Height, this._lastModalInfo.OnCloseFunction, this._moveModalInfo.StartModalX + xChange, this._moveModalInfo.StartModalY + yChange, true);
}

Wo_Modal._startResize = function(event)
{
	if (!this._initialized)
		this._initialize();
	
	if (!event)
		event = window.event;
	
	this._resizeModalInfo = new Object();
		
	this._resizeModalInfo.StartMouseX = event.pageX ? event.pageX : event.screenX;
	this._resizeModalInfo.StartMouseY = event.pageY ? event.pageY : event.screenY;
	this._resizeModalInfo.StartModalWidth = this._lastModalInfo.Width;
	this._resizeModalInfo.StartModalHeight = this._lastModalInfo.Height;
	this._resizeModalInfo.Button = event.button;
	
	document.onmouseup = new Function('event', 'window.' + this._variableName + '._endResize(event); return false;');
	document.onmousemove = new Function('event', 'window.' + this._variableName + '._resize(event); return false;');
	
	this._modalIframe.style.display = 'none';	
	this._isResizing = true;
}

Wo_Modal._endResize = function(event)
{
	if (!this._initialized)
		this._initialize();
	
	this._isResizing = false;
	this._resizeModalInfo = null;
	document.onmouseup = null;
	document.onmousemove = null;
	this._modalIframe.style.display = 'block';
}

Wo_Modal._resize = function(event)
{
	if (!this._initialized)
		this._initialize();

	if (!event)
		event = window.event;
	
	if (event.button != this._resizeModalInfo.Button)
	{
		this._endResize(event);
		return;
	}

	var eventX = typeof(event.pageX) != 'undefined' ? event.pageX : event.screenX;
	var eventY = typeof(event.pageY) != 'undefined' ? event.pageY : event.screenY;
	
	var xChange = eventX - this._resizeModalInfo.StartMouseX;
	var yChange = eventY - this._resizeModalInfo.StartMouseY;
	
	this.Open(null, this._resizeModalInfo.StartModalWidth + xChange, this._resizeModalInfo.StartModalHeight + yChange, this._lastModalInfo.OnCloseFunction, this._lastModalInfo.X, this._lastModalInfo.Y, true);
}

Wo_Modal.Configure('Utility/loading.htm',['CommonModal'],['CommonModalTitle'],['CommonModalClose'],['CommonModalContent'],['CommonModalFooter'],['CommonModalResize'],['CommonModalMask'],100);


/*
 * jQuery Cycle Plugin for light-weight slideshows
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007 M. Alsup
 * Version: 2.05 (01/16/2008)
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Requires: jQuery v1.1.3.1 or later
 *
 * Based on the work of:
 *  1) Matt Oakes (http://portfolio.gizone.co.uk/applications/slideshow/)
 *  2) Torsten Baldes (http://medienfreunde.com/lab/innerfade/)
 *  3) Benjamin Sterling (http://www.benjaminsterling.com/experiments/jqShuffle/)
 */
(function($) {

var ver = '2.05';

$.fn.cycle = function(options) {
    return this.each(function() {
        options = options || {};
        if (options.constructor == String) {
            switch(options) {
            case 'stop':
                if (this.cycleTimeout) clearTimeout(this.cycleTimeout);
                this.cycleTimeout = 0;
                return;
            case 'pause':
                this.cyclePause = 1;
                return;
            case 'resume':
                this.cyclePause = 0;
                return;
            default:
                options = { fx: options };
            };
        }
        var $cont = $(this);
        var $slides = options.slideExpr ? $(options.slideExpr, this) : $cont.children();
        var els = $slides.get();
        if (els.length < 2) return; // don't bother

        // support metadata plugin (v1.0 and v2.0)
        var opts = $.extend({}, $.fn.cycle.defaults, options || {}, $.metadata ? $cont.metadata() : $.meta ? $cont.data() : {});
        if (opts.autostop) 
            opts.countdown = opts.autostopCount || els.length;
            
        opts.before = opts.before ? [opts.before] : [];
        opts.after = opts.after ? [opts.after] : [];
        opts.after.unshift(function(){ opts.busy=0; });

        // allow shorthand overrides of width, height and timeout
        var cls = this.className;
        var w = parseInt((cls.match(/w:(\d+)/)||[])[1]) || opts.width;
        var h = parseInt((cls.match(/h:(\d+)/)||[])[1]) || opts.height;
        opts.timeout = parseInt((cls.match(/t:(\d+)/)||[])[1]) || opts.timeout;

        if ($cont.css('position') == 'static') 
            $cont.css('position', 'relative');
        if (w) 
            $cont.width(w);
        if (h && h != 'auto') 
            $cont.height(h);

        if (opts.startingSlide >= els.length)
            opts.startingSlide = 0; // catch bogus input
        var first = opts.startingSlide || 0;
        $slides.css('position','absolute').hide().each(function(i) { 
            var z = first ? i >= first ? els.length - (i-first) : first-i : els.length-i;
            $(this).css('z-index', z) 
        });
        
        $(els[first]).show();
        if (opts.fit && w) 
            $slides.width(w);
        if (opts.fit && h && h != 'auto') 
            $slides.height(h);
        if (opts.pause) 
            $cont.hover(function(){this.cyclePause=1;}, function(){this.cyclePause=0;});

        // run transition init fn
        var init = $.fn.cycle.transitions[opts.fx];
        if ($.isFunction(init))
            init($cont, $slides, opts);

        $slides.each(function() {
            var $el = $(this);
            this.cycleH = (opts.fit && h) ? h : $el.height();
            this.cycleW = (opts.fit && w) ? w : $el.width();
        });

        opts.cssBefore = opts.cssBefore || {};
        opts.animIn = opts.animIn || {};
        opts.animOut = opts.animOut || {};

        $slides.not(':eq('+first+')').css(opts.cssBefore);
        if (opts.cssFirst)
            $($slides[first]).css(opts.cssFirst);

        if (opts.timeout) {
            // ensure that timeout and speed settings are sane
            if (opts.speed.constructor == String)
                opts.speed = {slow: 600, fast: 200}[opts.speed] || 400;
            if (!opts.sync)
                opts.speed = opts.speed / 2;
            while((opts.timeout - opts.speed) < 250)
                opts.timeout += opts.speed;
        }
        if (opts.easing) 
            opts.easeIn = opts.easeOut = opts.easing;
        if (!opts.speedIn) 
            opts.speedIn = opts.speed;
        if (!opts.speedOut) 
            opts.speedOut = opts.speed;

 		opts.slideCount = els.length;
        opts.currSlide = first;
        if (opts.random) {
            opts.nextSlide = opts.currSlide;
            while (opts.nextSlide == opts.currSlide)
                opts.nextSlide = Math.floor(Math.random() * els.length);
        }
        else
            opts.nextSlide = opts.startingSlide >= (els.length-1) ? 0 : opts.startingSlide+1;

        // fire artificial events
        var e0 = $slides[first];
        if (opts.before.length)
            opts.before[0].apply(e0, [e0, e0, opts, true]);
        if (opts.after.length > 1)
            opts.after[1].apply(e0, [e0, e0, opts, true]);
        
        if (opts.click && !opts.next)
            opts.next = opts.click;
        if (opts.next)
            $(opts.next).bind('click', function(){return advance(els,opts,opts.rev?-1:1)});
        if (opts.prev)
            $(opts.prev).bind('click', function(){return advance(els,opts,opts.rev?1:-1)});
        if (opts.pager)
            buildPager(els,opts);
        if (opts.timeout)
            this.cycleTimeout = setTimeout(function(){go(els,opts,0,!opts.rev)}, opts.timeout + (opts.delay||0));
    });
};

function go(els, opts, manual, fwd) {
    if (opts.busy) return;
    var p = els[0].parentNode, curr = els[opts.currSlide], next = els[opts.nextSlide];
    if (p.cycleTimeout === 0 && !manual) 
        return;

    if (!manual && !p.cyclePause && opts.autostop && (--opts.countdown <= 0)) 
        return;

    if (manual || !p.cyclePause) {
        if (opts.before.length)
            $.each(opts.before, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
        var after = function() {
            $.each(opts.after, function(i,o) { o.apply(next, [curr, next, opts, fwd]); });
        };

        if (opts.nextSlide != opts.currSlide) {
            opts.busy = 1;
            if (opts.fxFn)
                opts.fxFn(curr, next, opts, after, fwd);
            else if ($.isFunction($.fn.cycle[opts.fx]))
                $.fn.cycle[opts.fx](curr, next, opts, after);
            else
                $.fn.cycle.custom(curr, next, opts, after);
        }
        if (opts.random) {
            opts.currSlide = opts.nextSlide;
            while (opts.nextSlide == opts.currSlide)
                opts.nextSlide = Math.floor(Math.random() * els.length);
        }
        else { // sequence
            var roll = (opts.nextSlide + 1) == els.length;
            opts.nextSlide = roll ? 0 : opts.nextSlide+1;
            opts.currSlide = roll ? els.length-1 : opts.nextSlide-1;
        }
        if (opts.pager)
            $(opts.pager).find('a').removeClass('activeSlide').filter('a:eq('+opts.currSlide+')').addClass('activeSlide');
    }
    if (opts.timeout)
        p.cycleTimeout = setTimeout(function() { go(els,opts,0,!opts.rev) }, opts.timeout);
};

// advance slide forward or back
function advance(els, opts, val) {
    var p = els[0].parentNode, timeout = p.cycleTimeout;
    if (timeout) {
        clearTimeout(timeout);
        p.cycleTimeout = 0;
    }
    opts.nextSlide = opts.currSlide + val;
    if (opts.nextSlide < 0)
        opts.nextSlide = els.length - 1;
    else if (opts.nextSlide >= els.length)
        opts.nextSlide = 0;
    if (opts.prevNextClick && typeof opts.prevNextClick == 'function')
        opts.prevNextClick(val > 0, opts.nextSlide, els[opts.nextSlide]);
    go(els, opts, 1, val>=0);
    return false;
};

function buildPager(els, opts) {
    var $p = $(opts.pager);
    $.each(els, function(i,o) {
        var $a = (typeof opts.pagerAnchorBuilder == 'function')
            ? $(opts.pagerAnchorBuilder(i,o))
            : $('<a href="#">'+(i+1)+'</a>');
        // don't reparent if anchor is in the dom
        if ($a.parents('body').length == 0)
            $a.appendTo($p);
        $a.bind('click',function() {
            opts.nextSlide = i;
            var p = els[0].parentNode, timeout = p.cycleTimeout;
            if (timeout) {
                clearTimeout(timeout);
                p.cycleTimeout = 0;
            }            
            if (typeof opts.pagerClick == 'function')
                opts.pagerClick(opts.nextSlide, els[opts.nextSlide]);
            go(els,opts,1,!opts.rev);
            return false;
        });
    });
   $p.find('a').filter('a:eq('+opts.startingSlide+')').addClass('activeSlide');
};

$.fn.cycle.custom = function(curr, next, opts, cb) {
    var $l = $(curr), $n = $(next);
    $n.css(opts.cssBefore);
    var fn = function() {$n.animate(opts.animIn, opts.speedIn, opts.easeIn, cb)};
    $l.animate(opts.animOut, opts.speedOut, opts.easeOut, function() {
        if (opts.cssAfter) $l.css(opts.cssAfter);
        if (!opts.sync) fn();
    });
    if (opts.sync) fn();
};

$.fn.cycle.transitions = {
    fade: function($cont, $slides, opts) {
        $slides.not(':eq('+opts.startingSlide+')').css('opacity',0);
        opts.before.push(function() { $(this).show() });
        opts.animIn    = { opacity: 1 };
        opts.animOut   = { opacity: 0 };
        opts.cssAfter  = { display: 'none' };
    }
};

$.fn.cycle.ver = function() { return ver; };

// override these globally if you like (they are all optional)
$.fn.cycle.defaults = {
    fx:           'fade', // one of: fade, shuffle, zoom, slideX, slideY, scrollUp/Down/Left/Right
    timeout:       4000,  // milliseconds between slide transitions (0 to disable auto advance)
    speed:         1000,  // speed of the transition (any valid fx speed value)
    speedIn:       null,  // speed of the 'in' transition
    speedOut:      null,  // speed of the 'out' transition
    click:         null,  // @deprecated; please use the 'next' option
    next:          null,  // id of element to use as click trigger for next slide
    prev:          null,  // id of element to use as click trigger for previous slide
    prevNextClick: null,  // callback fn for prev/next clicks:  function(isNext, zeroBasedSlideIndex, slideElement)
    pager:         null,  // id of element to use as pager container
    pagerClick:    null,  // callback fn for pager clicks:  function(zeroBasedSlideIndex, slideElement)
    pagerAnchorBuilder: null, // callback fn for building anchor links
    before:        null,  // transition callback (scope set to element to be shown)
    after:         null,  // transition callback (scope set to element that was shown)
    easing:        null,  // easing method for both in and out transitions
    easeIn:        null,  // easing for "in" transition
    easeOut:       null,  // easing for "out" transition
    shuffle:       null,  // coords for shuffle animation, ex: { top:15, left: 200 }
    animIn:        null,  // properties that define how the slide animates in
    animOut:       null,  // properties that define how the slide animates out
    cssBefore:     null,  // properties that define the initial state of the slide before transitioning in
    cssAfter:      null,  // properties that defined the state of the slide after transitioning out
    fxFn:          null,  // function used to control the transition
    height:       'auto', // container height
    startingSlide: 0,     // zero-based index of the first slide to be displayed
    sync:          1,     // true if in/out transitions should occur simultaneously
    random:        0,     // true for random, false for sequence (not applicable to shuffle fx)
    fit:           0,     // force slides to fit container
    pause:         0,     // true to enable "pause on hover"
    autostop:      0,     // true to end slideshow after X transitions (where X == slide count)
    delay:         0,     // additional delay (in ms) for first transition (hint: can be negative)
    slideExpr:     null   // expression for selecting slides (if something other than all children is required)
};

})(jQuery);

/*
 * jQuery Cycle Plugin Transition Definitions
 * This script is a plugin for the jQuery Cycle Plugin
 * Examples and documentation at: http://malsup.com/jquery/cycle/
 * Copyright (c) 2007 M. Alsup
 * Version:  2.05
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */

//
// These functions define one-time slide initialization for the named
// transitions. To save file size feel free to remove any of these that you 
// don't need.
//

// scrollUp/Down/Left/Right
jQuery.fn.cycle.transitions.scrollUp = function($cont, $slides, opts) {
    $cont.css('overflow','hidden');
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.cssBefore.top = next.offsetHeight;
        opts.animOut.top = 0-curr.offsetHeight;
    });
    opts.cssFirst = { top: 0 };
    opts.animIn   = { top: 0 };
    opts.cssAfter = { display: 'none' };
};
jQuery.fn.cycle.transitions.scrollDown = function($cont, $slides, opts) {
    $cont.css('overflow','hidden');
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.cssBefore.top = 0-next.offsetHeight;
        opts.animOut.top = curr.offsetHeight;
    });
    opts.cssFirst = { top: 0 };
    opts.animIn   = { top: 0 };
    opts.cssAfter = { display: 'none' };
};
jQuery.fn.cycle.transitions.scrollLeft = function($cont, $slides, opts) {
    $cont.css('overflow','hidden');
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.cssBefore.left = next.offsetWidth;
        opts.animOut.left = 0-curr.offsetWidth;
    });
    opts.cssFirst = { left: 0 };
    opts.animIn   = { left: 0 };
};
jQuery.fn.cycle.transitions.scrollRight = function($cont, $slides, opts) {
    $cont.css('overflow','hidden');
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.cssBefore.left = 0-next.offsetWidth;
        opts.animOut.left = curr.offsetWidth;
    });
    opts.cssFirst = { left: 0 };
    opts.animIn   = { left: 0 };
};
jQuery.fn.cycle.transitions.scrollHorz = function($cont, $slides, opts) {
    $cont.css('overflow','hidden').width();
//    $slides.show();
    opts.before.push(function(curr, next, opts, fwd) {
        jQuery(this).show();
        var currW = curr.offsetWidth, nextW = next.offsetWidth;
        opts.cssBefore = fwd ? { left: nextW } : { left: -nextW };
        opts.animIn.left = 0;
        opts.animOut.left = fwd ? -currW : currW;
        $slides.not(curr).css(opts.cssBefore);
    });
    opts.cssFirst = { left: 0 };
    opts.cssAfter = { display: 'none' }
};
jQuery.fn.cycle.transitions.scrollVert = function($cont, $slides, opts) {
    $cont.css('overflow','hidden');
//    $slides.show();
    opts.before.push(function(curr, next, opts, fwd) {
        jQuery(this).show();
        var currH = curr.offsetHeight, nextH = next.offsetHeight;
        //opts.cssBefore = fwd ? { top: -nextH } : { top: nextH };
        opts.cssBefore = !fwd ? { top: -nextH } : { top: nextH };
        opts.animIn.top = 0;
       // opts.animOut.top = fwd ? currH : -currH;
        opts.animOut.top = !fwd ? currH : -currH;
        $slides.not(curr).css(opts.cssBefore);
    });
    opts.cssFirst = { top: 0 };
    opts.cssAfter = { display: 'none' }
};

// slideX/slideY
jQuery.fn.cycle.transitions.slideX = function($cont, $slides, opts) {
    opts.animIn  = { width: 'show' };
    opts.animOut = { width: 'hide' };
};
jQuery.fn.cycle.transitions.slideY = function($cont, $slides, opts) {
    opts.animIn  = { height: 'show' };
    opts.animOut = { height: 'hide' };
};

// shuffle
jQuery.fn.cycle.transitions.shuffle = function($cont, $slides, opts) {
    var w = $cont.css('overflow', 'visible').width();
    $slides.css({left: 0, top: 0});
    opts.before.push(function() { jQuery(this).show() });
    opts.speed = opts.speed / 2; // shuffle has 2 transitions        
    opts.random = 0;
    opts.shuffle = opts.shuffle || {left:-w, top:15};
    opts.els = [];
    for (var i=0; i < $slides.length; i++)
        opts.els.push($slides[i]);

    for (var i=0; i < opts.startingSlide; i++)
        opts.els.push(opts.els.shift());

    // custom transition fn (hat tip to Benjamin Sterling for this bit of sweetness!)
    opts.fxFn = function(curr, next, opts, cb, fwd) {
        var $el = fwd ? jQuery(curr) : jQuery(next);
        $el.animate(opts.shuffle, opts.speedIn, opts.easeIn, function() {
            fwd ? opts.els.push(opts.els.shift()) : opts.els.unshift(opts.els.pop());
            if (fwd) 
                for (var i=0, len=opts.els.length; i < len; i++)
                    jQuery(opts.els[i]).css('z-index', len-i);
            else {
                var z = jQuery(curr).css('z-index');
                $el.css('z-index', parseInt(z)+1);
            }
            $el.animate({left:0, top:0}, opts.speedOut, opts.easeOut, function() {
                if (fwd) jQuery(this).hide();
                if (cb) cb();
            });
        });
    };
};

// turnUp/Down/Left/Right
jQuery.fn.cycle.transitions.turnUp = function($cont, $slides, opts) {
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.cssBefore.top = next.cycleH;
        opts.animIn.height = next.cycleH;
    });
    opts.cssFirst  = { top: 0 };
    opts.cssBefore = { height: 0 };
    opts.animIn    = { top: 0 };
    opts.animOut   = { height: 0 };
    opts.cssAfter  = { display: 'none' };
};
jQuery.fn.cycle.transitions.turnDown = function($cont, $slides, opts) {
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.animIn.height = next.cycleH;
        opts.animOut.top   = curr.cycleH;
    });
    opts.cssFirst  = { top: 0 };
    opts.cssBefore = { top: 0, height: 0 };
    opts.animOut   = { height: 0 };
    opts.cssAfter  = { display: 'none' };
};
jQuery.fn.cycle.transitions.turnLeft = function($cont, $slides, opts) {
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.cssBefore.left = next.cycleW;
        opts.animIn.width = next.cycleW;
    });
    opts.cssBefore = { width: 0 };
    opts.animIn    = { left: 0 };
    opts.animOut   = { width: 0 };
    opts.cssAfter  = { display: 'none' };
};
jQuery.fn.cycle.transitions.turnRight = function($cont, $slides, opts) {
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.animIn.width = next.cycleW;
        opts.animOut.left = curr.cycleW;
    });
    opts.cssBefore = { left: 0, width: 0 };
    opts.animIn    = { left: 0 };
    opts.animOut   = { width: 0 };
    opts.cssAfter  = { display: 'none' };
};

// zoom
jQuery.fn.cycle.transitions.zoom = function($cont, $slides, opts) {
    opts.cssFirst = { top:0, left: 0 }; 
    opts.cssAfter = { display: 'none' };
    
    opts.before.push(function(curr, next, opts) {
        jQuery(this).show();
        opts.cssBefore = { width: 0, height: 0, top: next.cycleH/2, left: next.cycleW/2 };
        opts.animIn    = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
        opts.animOut   = { width: 0, height: 0, top: curr.cycleH/2, left: curr.cycleW/2 };
    });    
};

// fadeZoom
jQuery.fn.cycle.transitions.fadeZoom = function($cont, $slides, opts) {
    opts.before.push(function(curr, next, opts) {
        opts.cssBefore = { width: 0, height: 0, opacity: 1, left: next.cycleW/2, top: next.cycleH/2, zIndex: 1 };
        opts.animIn    = { top: 0, left: 0, width: next.cycleW, height: next.cycleH };
    });    
    opts.animOut  = { opacity: 0 };
    opts.cssAfter = { zIndex: 0 };
};

