/* overlib/overlib.js */

//\/////
//\  overLIB 4.21 - You may not remove or change this notice.
//\  Copyright Erik Bosrup 1998-2004. All rights reserved.
//\
//\  Contributors are listed on the homepage.
//\  This file might be old, always check for the latest version at:
//\  http://www.bosrup.com/web/overlib/
//\
//\  Please read the license agreement (available through the link above)
//\  before using overLIB. Direct any licensing questions to erik@bosrup.com.
//\
//\  Do not sell this as your own work or remove this copyright notice. 
//\  For full details on copying or changing this script please read the
//\  license agreement at the link above. Please give credit on sites that
//\  use overLIB and submit changes of the script so other people can use
//\  them as well.
//   $Revision: 1.119 $                $Date: 2005/07/02 23:41:44 $
//\/////
//\mini

////////
// PRE-INIT
// Ignore these lines, configuration is below.
////////
var olLoaded = 0;var pmStart = 10000000; var pmUpper = 10001000; var pmCount = pmStart+1; var pmt=''; var pms = new Array(); var olInfo = new Info('4.21', 1);
var FREPLACE = 0; var FBEFORE = 1; var FAFTER = 2; var FALTERNATE = 3; var FCHAIN=4;
var olHideForm=0;  // parameter for hiding SELECT and ActiveX elements in IE5.5+ 
var olHautoFlag = 0;  // flags for over-riding VAUTO and HAUTO if corresponding
var olVautoFlag = 0;  // positioning commands are used on the command line
var hookPts = new Array(), postParse = new Array(), cmdLine = new Array(), runTime = new Array();
// for plugins
registerCommands('donothing,inarray,caparray,sticky,background,noclose,caption,left,right,center,offsetx,offsety,fgcolor,bgcolor,textcolor,capcolor,closecolor,width,border,cellpad,status,autostatus,autostatuscap,height,closetext,snapx,snapy,fixx,fixy,relx,rely,fgbackground,bgbackground,padx,pady,fullhtml,above,below,capicon,textfont,captionfont,closefont,textsize,captionsize,closesize,timeout,function,delay,hauto,vauto,closeclick,wrap,followmouse,mouseoff,closetitle,cssoff,compatmode,cssclass,fgclass,bgclass,textfontclass,captionfontclass,closefontclass');

////////
// DEFAULT CONFIGURATION
// Settings you want everywhere are set here. All of this can also be
// changed on your html page or through an overLIB call.
////////
if (typeof ol_fgcolor=='undefined') var ol_fgcolor="#CCCCFF";
if (typeof ol_bgcolor=='undefined') var ol_bgcolor="#333399";
if (typeof ol_textcolor=='undefined') var ol_textcolor="#000000";
if (typeof ol_capcolor=='undefined') var ol_capcolor="#FFFFFF";
if (typeof ol_closecolor=='undefined') var ol_closecolor="#9999FF";
if (typeof ol_textfont=='undefined') var ol_textfont="Verdana,Arial,Helvetica";
if (typeof ol_captionfont=='undefined') var ol_captionfont="Verdana,Arial,Helvetica";
if (typeof ol_closefont=='undefined') var ol_closefont="Verdana,Arial,Helvetica";
if (typeof ol_textsize=='undefined') var ol_textsize="1";
if (typeof ol_captionsize=='undefined') var ol_captionsize="1";
if (typeof ol_closesize=='undefined') var ol_closesize="1";
if (typeof ol_width=='undefined') var ol_width="200";
if (typeof ol_border=='undefined') var ol_border="1";
if (typeof ol_cellpad=='undefined') var ol_cellpad=2;
if (typeof ol_offsetx=='undefined') var ol_offsetx=10;
if (typeof ol_offsety=='undefined') var ol_offsety=10;
if (typeof ol_text=='undefined') var ol_text="Default Text";
if (typeof ol_cap=='undefined') var ol_cap="";
if (typeof ol_sticky=='undefined') var ol_sticky=0;
if (typeof ol_background=='undefined') var ol_background="";
if (typeof ol_close=='undefined') var ol_close="Close";
if (typeof ol_hpos=='undefined') var ol_hpos=RIGHT;
if (typeof ol_status=='undefined') var ol_status="";
if (typeof ol_autostatus=='undefined') var ol_autostatus=0;
if (typeof ol_height=='undefined') var ol_height=-1;
if (typeof ol_snapx=='undefined') var ol_snapx=0;
if (typeof ol_snapy=='undefined') var ol_snapy=0;
if (typeof ol_fixx=='undefined') var ol_fixx=-1;
if (typeof ol_fixy=='undefined') var ol_fixy=-1;
if (typeof ol_relx=='undefined') var ol_relx=null;
if (typeof ol_rely=='undefined') var ol_rely=null;
if (typeof ol_fgbackground=='undefined') var ol_fgbackground="";
if (typeof ol_bgbackground=='undefined') var ol_bgbackground="";
if (typeof ol_padxl=='undefined') var ol_padxl=1;
if (typeof ol_padxr=='undefined') var ol_padxr=1;
if (typeof ol_padyt=='undefined') var ol_padyt=1;
if (typeof ol_padyb=='undefined') var ol_padyb=1;
if (typeof ol_fullhtml=='undefined') var ol_fullhtml=0;
if (typeof ol_vpos=='undefined') var ol_vpos=BELOW;
if (typeof ol_aboveheight=='undefined') var ol_aboveheight=0;
if (typeof ol_capicon=='undefined') var ol_capicon="";
if (typeof ol_frame=='undefined') var ol_frame=self;
if (typeof ol_timeout=='undefined') var ol_timeout=0;
if (typeof ol_function=='undefined') var ol_function=null;
if (typeof ol_delay=='undefined') var ol_delay=0;
if (typeof ol_hauto=='undefined') var ol_hauto=0;
if (typeof ol_vauto=='undefined') var ol_vauto=0;
if (typeof ol_closeclick=='undefined') var ol_closeclick=0;
if (typeof ol_wrap=='undefined') var ol_wrap=0;
if (typeof ol_followmouse=='undefined') var ol_followmouse=1;
if (typeof ol_mouseoff=='undefined') var ol_mouseoff=0;
if (typeof ol_closetitle=='undefined') var ol_closetitle='Close';
if (typeof ol_compatmode=='undefined') var ol_compatmode=0;
if (typeof ol_css=='undefined') var ol_css=CSSOFF;
if (typeof ol_fgclass=='undefined') var ol_fgclass="";
if (typeof ol_bgclass=='undefined') var ol_bgclass="";
if (typeof ol_textfontclass=='undefined') var ol_textfontclass="";
if (typeof ol_captionfontclass=='undefined') var ol_captionfontclass="";
if (typeof ol_closefontclass=='undefined') var ol_closefontclass="";

////////
// ARRAY CONFIGURATION
////////

// You can use these arrays to store popup text here instead of in the html.
if (typeof ol_texts=='undefined') var ol_texts = new Array("Text 0", "Text 1");
if (typeof ol_caps=='undefined') var ol_caps = new Array("Caption 0", "Caption 1");

////////
// END OF CONFIGURATION
// Don't change anything below this line, all configuration is above.
////////





////////
// INIT
////////
// Runtime variables init. Don't change for config!
var o3_text="";
var o3_cap="";
var o3_sticky=0;
var o3_background="";
var o3_close="Close";
var o3_hpos=RIGHT;
var o3_offsetx=2;
var o3_offsety=2;
var o3_fgcolor="";
var o3_bgcolor="";
var o3_textcolor="";
var o3_capcolor="";
var o3_closecolor="";
var o3_width=100;
var o3_border=1;
var o3_cellpad=2;
var o3_status="";
var o3_autostatus=0;
var o3_height=-1;
var o3_snapx=0;
var o3_snapy=0;
var o3_fixx=-1;
var o3_fixy=-1;
var o3_relx=null;
var o3_rely=null;
var o3_fgbackground="";
var o3_bgbackground="";
var o3_padxl=0;
var o3_padxr=0;
var o3_padyt=0;
var o3_padyb=0;
var o3_fullhtml=0;
var o3_vpos=BELOW;
var o3_aboveheight=0;
var o3_capicon="";
var o3_textfont="Verdana,Arial,Helvetica";
var o3_captionfont="Verdana,Arial,Helvetica";
var o3_closefont="Verdana,Arial,Helvetica";
var o3_textsize="1";
var o3_captionsize="1";
var o3_closesize="1";
var o3_frame=self;
var o3_timeout=0;
var o3_timerid=0;
var o3_allowmove=0;
var o3_function=null; 
var o3_delay=0;
var o3_delayid=0;
var o3_hauto=0;
var o3_vauto=0;
var o3_closeclick=0;
var o3_wrap=0;
var o3_followmouse=1;
var o3_mouseoff=0;
var o3_closetitle='';
var o3_compatmode=0;
var o3_css=CSSOFF;
var o3_fgclass="";
var o3_bgclass="";
var o3_textfontclass="";
var o3_captionfontclass="";
var o3_closefontclass="";

// Display state variables
var o3_x = 0;
var o3_y = 0;
var o3_showingsticky = 0;
var o3_removecounter = 0;

// Our layer
var over = null;
var fnRef, hoveringSwitch = false;
var olHideDelay;

// Decide browser version
var isMac = (navigator.userAgent.indexOf("Mac") != -1);
var olOp = (navigator.userAgent.toLowerCase().indexOf('opera') > -1 && document.createTextNode);  // Opera 7
var olNs4 = (navigator.appName=='Netscape' && parseInt(navigator.appVersion) == 4);
var olNs6 = (document.getElementById) ? true : false;
var olKq = (olNs6 && /konqueror/i.test(navigator.userAgent));
var olIe4 = (document.all) ? true : false;
var olIe5 = false; 
var olIe55 = false; // Added additional variable to identify IE5.5+
var docRoot = 'document.body';

// Resize fix for NS4.x to keep track of layer
if (olNs4) {
	var oW = window.innerWidth;
	var oH = window.innerHeight;
	window.onresize = function() { if (oW != window.innerWidth || oH != window.innerHeight) location.reload(); }
}

// Microsoft Stupidity Check(tm).
if (olIe4) {
	var agent = navigator.userAgent;
	if (/MSIE/.test(agent)) {
		var versNum = parseFloat(agent.match(/MSIE[ ](\d\.\d+)\.*/i)[1]);
		if (versNum >= 5){
			olIe5=true;
			olIe55=(versNum>=5.5&&!olOp) ? true : false;
			if (olNs6) olNs6=false;
		}
	}
	if (olNs6) olIe4 = false;
}

// Check for compatability mode.
if (document.compatMode && document.compatMode == 'CSS1Compat') {
	docRoot= ((olIe4 && !olOp) ? 'document.documentElement' : docRoot);
}

// Add window onload handlers to indicate when all modules have been loaded
// For Netscape 6+ and Mozilla, uses addEventListener method on the window object
// For IE it uses the attachEvent method of the window object and for Netscape 4.x
// it sets the window.onload handler to the OLonload_handler function for Bubbling
if(window.addEventListener) window.addEventListener("load",OLonLoad_handler,false);
else if (window.attachEvent) window.attachEvent("onload",OLonLoad_handler);

var capExtent;

////////
// PUBLIC FUNCTIONS
////////

// overlib(arg0,...,argN)
// Loads parameters into global runtime variables.
function overlib() {
	if (!olLoaded || isExclusive(overlib.arguments)) return true;
	if (olCheckMouseCapture) olMouseCapture();
	if (over) {
		over = (typeof over.id != 'string') ? o3_frame.document.all['overDiv'] : over;
		cClick();
	}

	// Load defaults to runtime.
  olHideDelay=0;
	o3_text=ol_text;
	o3_cap=ol_cap;
	o3_sticky=ol_sticky;
	o3_background=ol_background;
	o3_close=ol_close;
	o3_hpos=ol_hpos;
	o3_offsetx=ol_offsetx;
	o3_offsety=ol_offsety;
	o3_fgcolor=ol_fgcolor;
	o3_bgcolor=ol_bgcolor;
	o3_textcolor=ol_textcolor;
	o3_capcolor=ol_capcolor;
	o3_closecolor=ol_closecolor;
	o3_width=ol_width;
	o3_border=ol_border;
	o3_cellpad=ol_cellpad;
	o3_status=ol_status;
	o3_autostatus=ol_autostatus;
	o3_height=ol_height;
	o3_snapx=ol_snapx;
	o3_snapy=ol_snapy;
	o3_fixx=ol_fixx;
	o3_fixy=ol_fixy;
	o3_relx=ol_relx;
	o3_rely=ol_rely;
	o3_fgbackground=ol_fgbackground;
	o3_bgbackground=ol_bgbackground;
	o3_padxl=ol_padxl;
	o3_padxr=ol_padxr;
	o3_padyt=ol_padyt;
	o3_padyb=ol_padyb;
	o3_fullhtml=ol_fullhtml;
	o3_vpos=ol_vpos;
	o3_aboveheight=ol_aboveheight;
	o3_capicon=ol_capicon;
	o3_textfont=ol_textfont;
	o3_captionfont=ol_captionfont;
	o3_closefont=ol_closefont;
	o3_textsize=ol_textsize;
	o3_captionsize=ol_captionsize;
	o3_closesize=ol_closesize;
	o3_timeout=ol_timeout;
	o3_function=ol_function;
	o3_delay=ol_delay;
	o3_hauto=ol_hauto;
	o3_vauto=ol_vauto;
	o3_closeclick=ol_closeclick;
	o3_wrap=ol_wrap;	
	o3_followmouse=ol_followmouse;
	o3_mouseoff=ol_mouseoff;
	o3_closetitle=ol_closetitle;
	o3_css=ol_css;
	o3_compatmode=ol_compatmode;
	o3_fgclass=ol_fgclass;
	o3_bgclass=ol_bgclass;
	o3_textfontclass=ol_textfontclass;
	o3_captionfontclass=ol_captionfontclass;
	o3_closefontclass=ol_closefontclass;
	
	setRunTimeVariables();
	
	fnRef = '';
	
	// Special for frame support, over must be reset...
	o3_frame = ol_frame;
	
	if(!(over=createDivContainer())) return false;

	parseTokens('o3_', overlib.arguments);
	if (!postParseChecks()) return false;

	if (o3_delay == 0) {
		return runHook("olMain", FREPLACE);
 	} else {
		o3_delayid = setTimeout("runHook('olMain', FREPLACE)", o3_delay);
		return false;
	}
}

// Clears popups if appropriate
function nd(time) {
	if (olLoaded && !isExclusive()) {
		hideDelay(time);  // delay popup close if time specified

		if (o3_removecounter >= 1) { o3_showingsticky = 0 };
		
		if (o3_showingsticky == 0) {
			o3_allowmove = 0;
			if (over != null && o3_timerid == 0) runHook("hideObject", FREPLACE, over);
		} else {
			o3_removecounter++;
		}
	}
	
	return true;
}

// The Close onMouseOver function for stickies
function cClick() {
	if (olLoaded) {
		runHook("hideObject", FREPLACE, over);
		o3_showingsticky = 0;	
	}	
	return false;
}

// Method for setting page specific defaults.
function overlib_pagedefaults() {
	parseTokens('ol_', overlib_pagedefaults.arguments);
}


////////
// OVERLIB MAIN FUNCTION
////////

// This function decides what it is we want to display and how we want it done.
function olMain() {
	var layerhtml, styleType;
 	runHook("olMain", FBEFORE);
 	
	if (o3_background!="" || o3_fullhtml) {
		// Use background instead of box.
		layerhtml = runHook('ol_content_background', FALTERNATE, o3_css, o3_text, o3_background, o3_fullhtml);
	} else {
		// They want a popup box.
		styleType = (pms[o3_css-1-pmStart] == "cssoff" || pms[o3_css-1-pmStart] == "cssclass");

		// Prepare popup background
		if (o3_fgbackground != "") o3_fgbackground = "background=\""+o3_fgbackground+"\"";
		if (o3_bgbackground != "") o3_bgbackground = (styleType ? "background=\""+o3_bgbackground+"\"" : o3_bgbackground);

		// Prepare popup colors
		if (o3_fgcolor != "") o3_fgcolor = (styleType ? "bgcolor=\""+o3_fgcolor+"\"" : o3_fgcolor);
		if (o3_bgcolor != "") o3_bgcolor = (styleType ? "bgcolor=\""+o3_bgcolor+"\"" : o3_bgcolor);

		// Prepare popup height
		if (o3_height > 0) o3_height = (styleType ? "height=\""+o3_height+"\"" : o3_height);
		else o3_height = "";

		// Decide which kinda box.
		if (o3_cap=="") {
			// Plain
			layerhtml = runHook('ol_content_simple', FALTERNATE, o3_css, o3_text);
		} else {
			// With caption
			if (o3_sticky) {
				// Show close text
				layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, o3_close);
			} else {
				// No close text
				layerhtml = runHook('ol_content_caption', FALTERNATE, o3_css, o3_text, o3_cap, "");
			}
		}
	}	

	// We want it to stick!
	if (o3_sticky) {
		if (o3_timerid > 0) {
			clearTimeout(o3_timerid);
			o3_timerid = 0;
		}
		o3_showingsticky = 1;
		o3_removecounter = 0;
	}

	// Created a separate routine to generate the popup to make it easier
	// to implement a plugin capability
	if (!runHook("createPopup", FREPLACE, layerhtml)) return false;

	// Prepare status bar
	if (o3_autostatus > 0) {
		o3_status = o3_text;
		if (o3_autostatus > 1) o3_status = o3_cap;
	}

	// When placing the layer the first time, even stickies may be moved.
	o3_allowmove = 0;

	// Initiate a timer for timeout
	if (o3_timeout > 0) {          
		if (o3_timerid > 0) clearTimeout(o3_timerid);
		o3_timerid = setTimeout("cClick()", o3_timeout);
	}

	// Show layer
	runHook("disp", FREPLACE, o3_status);
	runHook("olMain", FAFTER);

	return (olOp && event && event.type == 'mouseover' && !o3_status) ? '' : (o3_status != '');
}

////////
// LAYER GENERATION FUNCTIONS
////////
// These functions just handle popup content with tags that should adhere to the W3C standards specification.

// Makes simple table without caption
function ol_content_simple(text) {
	var cpIsMultiple = /,/.test(o3_cellpad);
	var txt = '<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_height)+'><tr><td><table width="100%" border="0" '+((olNs4||!cpIsMultiple) ? 'cellpadding="'+o3_cellpad+'" ' : '')+'cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' : ((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td></tr></table></td></tr></table>';

	set_background("");
	return txt;
}

// Makes table with caption and optional close link
function ol_content_caption(text,title,close) {
	var nameId, txt, cpIsMultiple = /,/.test(o3_cellpad);
	var closing, closeevent;

	closing = "";
	closeevent = "onmouseover";
	if (o3_closeclick == 1) closeevent = (o3_closetitle ? "title='" + o3_closetitle +"'" : "") + " onclick";
	if (o3_capicon != "") {
	  nameId = ' hspace = \"5\"'+' align = \"middle\" alt = \"\"';
	  if (typeof o3_dragimg != 'undefined' && o3_dragimg) nameId =' hspace=\"5\"'+' name=\"'+o3_dragimg+'\" id=\"'+o3_dragimg+'\" align=\"middle\" alt=\"Drag Enabled\" title=\"Drag Enabled\"';
	  o3_capicon = '<img src=\"'+o3_capicon+'\"'+nameId+' />';
	}

	if (close != "")
		closing = '<td '+(!o3_compatmode && o3_closefontclass ? 'class="'+o3_closefontclass : 'align="RIGHT')+'"><a href="javascript:return '+fnRef+'cClick();"'+((o3_compatmode && o3_closefontclass) ? ' class="' + o3_closefontclass + '" ' : ' ')+closeevent+'="return '+fnRef+'cClick();">'+(o3_closefontclass ? '' : wrapStr(0,o3_closesize,'close'))+close+(o3_closefontclass ? '' : wrapStr(1,o3_closesize,'close'))+'</a></td>';
	txt = '<table width="'+o3_width+ '" border="0" cellpadding="'+o3_border+'" cellspacing="0" '+(o3_bgclass ? 'class="'+o3_bgclass+'"' : o3_bgcolor+' '+o3_bgbackground+' '+o3_height)+'><tr><td><table width="100%" border="0" cellpadding="2" cellspacing="0"><tr><td'+(o3_captionfontclass ? ' class="'+o3_captionfontclass+'">' : '>')+(o3_captionfontclass ? '' : '<b>'+wrapStr(0,o3_captionsize,'caption'))+o3_capicon+title+(o3_captionfontclass ? '' : wrapStr(1,o3_captionsize)+'</b>')+'</td>'+closing+'</tr></table><table width="100%" border="0" '+((olNs4||!cpIsMultiple) ? 'cellpadding="'+o3_cellpad+'" ' : '')+'cellspacing="0" '+(o3_fgclass ? 'class="'+o3_fgclass+'"' : o3_fgcolor+' '+o3_fgbackground+' '+o3_height)+'><tr><td valign="TOP"'+(o3_textfontclass ? ' class="'+o3_textfontclass+'">' :((!olNs4&&cpIsMultiple) ? ' style="'+setCellPadStr(o3_cellpad)+'">' : '>'))+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize)) + '</td></tr></table></td></tr></table>';

	set_background("");
	return txt;
}

// Sets the background picture,padding and lots more. :)
function ol_content_background(text,picture,hasfullhtml) {
	if (hasfullhtml) {
		txt=text;
	} else {
		txt='<table width="'+o3_width+'" border="0" cellpadding="0" cellspacing="0" height="'+o3_height+'"><tr><td colspan="3" height="'+o3_padyt+'"></td></tr><tr><td width="'+o3_padxl+'"></td><td valign="TOP" width="'+(o3_width-o3_padxl-o3_padxr)+(o3_textfontclass ? '" class="'+o3_textfontclass : '')+'">'+(o3_textfontclass ? '' : wrapStr(0,o3_textsize,'text'))+text+(o3_textfontclass ? '' : wrapStr(1,o3_textsize))+'</td><td width="'+o3_padxr+'"></td></tr><tr><td colspan="3" height="'+o3_padyb+'"></td></tr></table>';
	}

	set_background(picture);
	return txt;
}

// Loads a picture into the div.
function set_background(pic) {
	if (pic == "") {
		if (olNs4) {
			over.background.src = null; 
		} else if (over.style) {
			over.style.backgroundImage = "none";
		}
	} else {
		if (olNs4) {
			over.background.src = pic;
		} else if (over.style) {
			over.style.width=o3_width + 'px';
			over.style.backgroundImage = "url("+pic+")";
		}
	}
}

////////
// HANDLING FUNCTIONS
////////
var olShowId=-1;

// Displays the popup
function disp(statustext) {
	runHook("disp", FBEFORE);
	
	if (o3_allowmove == 0) {
		runHook("placeLayer", FREPLACE);
		(olNs6&&olShowId<0) ? olShowId=setTimeout("runHook('showObject', FREPLACE, over)", 1) : runHook("showObject", FREPLACE, over);
		o3_allowmove = (o3_sticky || o3_followmouse==0) ? 0 : 1;
	}
	
	runHook("disp", FAFTER);

	if (statustext != "") self.status = statustext;
}

// Creates the actual popup structure
function createPopup(lyrContent){
	runHook("createPopup", FBEFORE);
	
	if (o3_wrap) {
		var wd,ww,theObj = (olNs4 ? over : over.style);
		theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0);
		layerWrite(lyrContent);
		wd = (olNs4 ? over.clip.width : over.offsetWidth);
		if (wd > (ww=windowWidth())) {
			lyrContent=lyrContent.replace(/\&nbsp;/g, ' ');
			o3_width=ww;
			o3_wrap=0;
		} 
	}

	layerWrite(lyrContent);
	
	// Have to set o3_width for placeLayer() routine if o3_wrap is turned on
	if (o3_wrap) o3_width=(olNs4 ? over.clip.width : over.offsetWidth);
	
	runHook("createPopup", FAFTER, lyrContent);

	return true;
}

// Decides where we want the popup.
function placeLayer() {
	var placeX, placeY, widthFix = 0;
	
	// HORIZONTAL PLACEMENT, re-arranged to work in Safari
	if (o3_frame.innerWidth) widthFix=18; 
	iwidth = windowWidth();

	// Horizontal scroll offset
	winoffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollLeft') : o3_frame.pageXOffset;

	placeX = runHook('horizontalPlacement',FCHAIN,iwidth,winoffset,widthFix);

	// VERTICAL PLACEMENT, re-arranged to work in Safari
	if (o3_frame.innerHeight) {
		iheight=o3_frame.innerHeight;
	} else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientHeight=='number'")&&eval('o3_frame.'+docRoot+'.clientHeight')) { 
		iheight=eval('o3_frame.'+docRoot+'.clientHeight');
	}			

	// Vertical scroll offset
	scrolloffset=(olIe4) ? eval('o3_frame.'+docRoot+'.scrollTop') : o3_frame.pageYOffset;
	placeY = runHook('verticalPlacement',FCHAIN,iheight,scrolloffset);

	// Actually move the object.
	repositionTo(over, placeX, placeY);
}

// Moves the layer
function olMouseMove(e) {
	var e = (e) ? e : event;

	if (e.pageX) {
		o3_x = e.pageX;
		o3_y = e.pageY;
	} else if (e.clientX) {
		o3_x = eval('e.clientX+o3_frame.'+docRoot+'.scrollLeft');
		o3_y = eval('e.clientY+o3_frame.'+docRoot+'.scrollTop');
	}
	
	if (o3_allowmove == 1) runHook("placeLayer", FREPLACE);

	// MouseOut handler
	if (hoveringSwitch && !olNs4 && runHook("cursorOff", FREPLACE)) {
		(olHideDelay ? hideDelay(olHideDelay) : cClick());
		hoveringSwitch = !hoveringSwitch;
	}
}

// Fake function for 3.0 users.
function no_overlib() { return ver3fix; }

// Capture the mouse and chain other scripts.
function olMouseCapture() {
	capExtent = document;
	var fN, str = '', l, k, f, wMv, sS, mseHandler = olMouseMove;
	var re = /function[ ]*(\w*)\(/;
	
	wMv = (!olIe4 && window.onmousemove);
	if (document.onmousemove || wMv) {
		if (wMv) capExtent = window;
		f = capExtent.onmousemove.toString();
		fN = f.match(re);
		if (fN == null) {
			str = f+'(e); ';
		} else if (fN[1] == 'anonymous' || fN[1] == 'olMouseMove' || (wMv && fN[1] == 'onmousemove')) {
			if (!olOp && wMv) {
				l = f.indexOf('{')+1;
				k = f.lastIndexOf('}');
				sS = f.substring(l,k);
				if ((l = sS.indexOf('(')) != -1) {
					sS = sS.substring(0,l).replace(/^\s+/,'').replace(/\s+$/,'');
					if (eval("typeof " + sS + " == 'undefined'")) window.onmousemove = null;
					else str = sS + '(e);';
				}
			}
			if (!str) {
				olCheckMouseCapture = false;
				return;
			}
		} else {
			if (fN[1]) str = fN[1]+'(e); ';
			else {
				l = f.indexOf('{')+1;
				k = f.lastIndexOf('}');
				str = f.substring(l,k) + '\n';
			}
		}
		str += 'olMouseMove(e); ';
		mseHandler = new Function('e', str);
	}

	capExtent.onmousemove = mseHandler;
	if (olNs4) capExtent.captureEvents(Event.MOUSEMOVE);
}

////////
// PARSING FUNCTIONS
////////

// Does the actual command parsing.
function parseTokens(pf, ar) {
	// What the next argument is expected to be.
	var v, i, mode=-1, par = (pf != 'ol_');	
	var fnMark = (par && !ar.length ? 1 : 0);

	for (i = 0; i < ar.length; i++) {
		if (mode < 0) {
			// Arg is maintext,unless its a number between pmStart and pmUpper
			// then its a command.
			if (typeof ar[i] == 'number' && ar[i] > pmStart && ar[i] < pmUpper) {
				fnMark = (par ? 1 : 0);
				i--;   // backup one so that the next block can parse it
			} else {
				switch(pf) {
					case 'ol_':
						ol_text = ar[i].toString();
						break;
					default:
						o3_text=ar[i].toString();  
				}
			}
			mode = 0;
		} else {
			// Note: NS4 doesn't like switch cases with vars.
			if (ar[i] >= pmCount || ar[i]==DONOTHING) { continue; }
			if (ar[i]==INARRAY) { fnMark = 0; eval(pf+'text=ol_texts['+ar[++i]+'].toString()'); continue; }
			if (ar[i]==CAPARRAY) { eval(pf+'cap=ol_caps['+ar[++i]+'].toString()'); continue; }
			if (ar[i]==STICKY) { if (pf!='ol_') eval(pf+'sticky=1'); continue; }
			if (ar[i]==BACKGROUND) { eval(pf+'background="'+ar[++i]+'"'); continue; }
			if (ar[i]==NOCLOSE) { if (pf!='ol_') opt_NOCLOSE(); continue; }
			if (ar[i]==CAPTION) { eval(pf+"cap='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CENTER || ar[i]==LEFT || ar[i]==RIGHT) { eval(pf+'hpos='+ar[i]); if(pf!='ol_') olHautoFlag=1; continue; }
			if (ar[i]==OFFSETX) { eval(pf+'offsetx='+ar[++i]); continue; }
			if (ar[i]==OFFSETY) { eval(pf+'offsety='+ar[++i]); continue; }
			if (ar[i]==FGCOLOR) { eval(pf+'fgcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==BGCOLOR) { eval(pf+'bgcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==TEXTCOLOR) { eval(pf+'textcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==CAPCOLOR) { eval(pf+'capcolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==CLOSECOLOR) { eval(pf+'closecolor="'+ar[++i]+'"'); continue; }
			if (ar[i]==WIDTH) { eval(pf+'width='+ar[++i]); continue; }
			if (ar[i]==BORDER) { eval(pf+'border='+ar[++i]); continue; }
			if (ar[i]==CELLPAD) { i=opt_MULTIPLEARGS(++i,ar,(pf+'cellpad')); continue; }
			if (ar[i]==STATUS) { eval(pf+"status='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==AUTOSTATUS) { eval(pf +'autostatus=('+pf+'autostatus == 1) ? 0 : 1'); continue; }
			if (ar[i]==AUTOSTATUSCAP) { eval(pf +'autostatus=('+pf+'autostatus == 2) ? 0 : 2'); continue; }
			if (ar[i]==HEIGHT) { eval(pf+'height='+pf+'aboveheight='+ar[++i]); continue; } // Same param again.
			if (ar[i]==CLOSETEXT) { eval(pf+"close='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==SNAPX) { eval(pf+'snapx='+ar[++i]); continue; }
			if (ar[i]==SNAPY) { eval(pf+'snapy='+ar[++i]); continue; }
			if (ar[i]==FIXX) { eval(pf+'fixx='+ar[++i]); continue; }
			if (ar[i]==FIXY) { eval(pf+'fixy='+ar[++i]); continue; }
			if (ar[i]==RELX) { eval(pf+'relx='+ar[++i]); continue; }
			if (ar[i]==RELY) { eval(pf+'rely='+ar[++i]); continue; }
			if (ar[i]==FGBACKGROUND) { eval(pf+'fgbackground="'+ar[++i]+'"'); continue; }
			if (ar[i]==BGBACKGROUND) { eval(pf+'bgbackground="'+ar[++i]+'"'); continue; }
			if (ar[i]==PADX) { eval(pf+'padxl='+ar[++i]); eval(pf+'padxr='+ar[++i]); continue; }
			if (ar[i]==PADY) { eval(pf+'padyt='+ar[++i]); eval(pf+'padyb='+ar[++i]); continue; }
			if (ar[i]==FULLHTML) { if (pf!='ol_') eval(pf+'fullhtml=1'); continue; }
			if (ar[i]==BELOW || ar[i]==ABOVE) { eval(pf+'vpos='+ar[i]); if (pf!='ol_') olVautoFlag=1; continue; }
			if (ar[i]==CAPICON) { eval(pf+'capicon="'+ar[++i]+'"'); continue; }
			if (ar[i]==TEXTFONT) { eval(pf+"textfont='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CAPTIONFONT) { eval(pf+"captionfont='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CLOSEFONT) { eval(pf+"closefont='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==TEXTSIZE) { eval(pf+'textsize="'+ar[++i]+'"'); continue; }
			if (ar[i]==CAPTIONSIZE) { eval(pf+'captionsize="'+ar[++i]+'"'); continue; }
			if (ar[i]==CLOSESIZE) { eval(pf+'closesize="'+ar[++i]+'"'); continue; }
			if (ar[i]==TIMEOUT) { eval(pf+'timeout='+ar[++i]); continue; }
			if (ar[i]==FUNCTION) { if (pf=='ol_') { if (typeof ar[i+1]!='number') { v=ar[++i]; ol_function=(typeof v=='function' ? v : null); }} else {fnMark = 0; v = null; if (typeof ar[i+1]!='number') v = ar[++i];  opt_FUNCTION(v); } continue; }
			if (ar[i]==DELAY) { eval(pf+'delay='+ar[++i]); continue; }
			if (ar[i]==HAUTO) { eval(pf+'hauto=('+pf+'hauto == 0) ? 1 : 0'); continue; }
			if (ar[i]==VAUTO) { eval(pf+'vauto=('+pf+'vauto == 0) ? 1 : 0'); continue; }
			if (ar[i]==CLOSECLICK) { eval(pf +'closeclick=('+pf+'closeclick == 0) ? 1 : 0'); continue; }
			if (ar[i]==WRAP) { eval(pf +'wrap=('+pf+'wrap == 0) ? 1 : 0'); continue; }
			if (ar[i]==FOLLOWMOUSE) { eval(pf +'followmouse=('+pf+'followmouse == 1) ? 0 : 1'); continue; }
			if (ar[i]==MOUSEOFF) { eval(pf +'mouseoff=('+pf+'mouseoff==0) ? 1 : 0'); v=ar[i+1]; if (pf != 'ol_' && eval(pf+'mouseoff') && typeof v == 'number' && (v < pmStart || v > pmUpper)) olHideDelay=ar[++i]; continue; }
			if (ar[i]==CLOSETITLE) { eval(pf+"closetitle='"+escSglQuote(ar[++i])+"'"); continue; }
			if (ar[i]==CSSOFF||ar[i]==CSSCLASS) { eval(pf+'css='+ar[i]); continue; }
			if (ar[i]==COMPATMODE) { eval(pf+'compatmode=('+pf+'compatmode==0) ? 1 : 0'); continue; }
			if (ar[i]==FGCLASS) { eval(pf+'fgclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==BGCLASS) { eval(pf+'bgclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==TEXTFONTCLASS) { eval(pf+'textfontclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==CAPTIONFONTCLASS) { eval(pf+'captionfontclass="'+ar[++i]+'"'); continue; }
			if (ar[i]==CLOSEFONTCLASS) { eval(pf+'closefontclass="'+ar[++i]+'"'); continue; }
			i = parseCmdLine(pf, i, ar);
		}
	}

	if (fnMark && o3_function) o3_text = o3_function();
	
	if ((pf == 'o3_') && o3_wrap) {
		o3_width = 0;
		
		var tReg=/<.*\n*>/ig;
		if (!tReg.test(o3_text)) o3_text = o3_text.replace(/[ ]+/g, '&nbsp;');
		if (!tReg.test(o3_cap))o3_cap = o3_cap.replace(/[ ]+/g, '&nbsp;');
	}
	if ((pf == 'o3_') && o3_sticky) {
		if (!o3_close && (o3_frame != ol_frame)) o3_close = ol_close;
		if (o3_mouseoff && (o3_frame == ol_frame)) opt_NOCLOSE(' ');
	}
}


////////
// LAYER FUNCTIONS
////////

// Writes to a layer
function layerWrite(txt) {
	txt += "\n";
	if (olNs4) {
		var lyr = o3_frame.document.layers['overDiv'].document
		lyr.write(txt)
		lyr.close()
	} else if (typeof over.innerHTML != 'undefined') {
		if (olIe5 && isMac) over.innerHTML = '';
		over.innerHTML = txt;
	} else {
		range = o3_frame.document.createRange();
		range.setStartAfter(over);
		domfrag = range.createContextualFragment(txt);
		
		while (over.hasChildNodes()) {
			over.removeChild(over.lastChild);
		}
		
		over.appendChild(domfrag);
	}
}

// Make an object visible
function showObject(obj) {
	runHook("showObject", FBEFORE);

	var theObj=(olNs4 ? obj : obj.style);
	theObj.visibility = 'visible';

	runHook("showObject", FAFTER);
}

// Hides an object
function hideObject(obj) {
	runHook("hideObject", FBEFORE);

	var theObj=(olNs4 ? obj : obj.style);
	if (olNs6 && olShowId>0) { clearTimeout(olShowId); olShowId=0; }
	theObj.visibility = 'hidden';
	theObj.top = theObj.left = ((olIe4&&!olOp) ? 0 : -10000) + (!olNs4 ? 'px' : 0);

	if (o3_timerid > 0) clearTimeout(o3_timerid);
	if (o3_delayid > 0) clearTimeout(o3_delayid);

	o3_timerid = 0;
	o3_delayid = 0;
	self.status = "";

	if (obj.onmouseout||obj.onmouseover) {
		if (olNs4) obj.releaseEvents(Event.MOUSEOUT || Event.MOUSEOVER);
		obj.onmouseout = obj.onmouseover = null;
	}

	runHook("hideObject", FAFTER);
}

// Move a layer
function repositionTo(obj, xL, yL) {
	var theObj=(olNs4 ? obj : obj.style);
	theObj.left = xL + (!olNs4 ? 'px' : 0);
	theObj.top = yL + (!olNs4 ? 'px' : 0);
}

// Check position of cursor relative to overDiv DIVision; mouseOut function
function cursorOff() {
	var left = parseInt(over.style.left);
	var top = parseInt(over.style.top);
	var right = left + (over.offsetWidth >= parseInt(o3_width) ? over.offsetWidth : parseInt(o3_width));
	var bottom = top + (over.offsetHeight >= o3_aboveheight ? over.offsetHeight : o3_aboveheight);

	if (o3_x < left || o3_x > right || o3_y < top || o3_y > bottom) return true;

	return false;
}


////////
// COMMAND FUNCTIONS
////////

// Calls callme or the default function.
function opt_FUNCTION(callme) {
	o3_text = (callme ? (typeof callme=='string' ? (/.+\(.*\)/.test(callme) ? eval(callme) : callme) : callme()) : (o3_function ? o3_function() : 'No Function'));

	return 0;
}

// Handle hovering
function opt_NOCLOSE(unused) {
	if (!unused) o3_close = "";

	if (olNs4) {
		over.captureEvents(Event.MOUSEOUT || Event.MOUSEOVER);
		over.onmouseover = function () { if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid = 0; } }
		over.onmouseout = function (e) { if (olHideDelay) hideDelay(olHideDelay); else cClick(e); }
	} else {
		over.onmouseover = function () {hoveringSwitch = true; if (o3_timerid > 0) { clearTimeout(o3_timerid); o3_timerid =0; } }
	}

	return 0;
}

// Function to scan command line arguments for multiples
function opt_MULTIPLEARGS(i, args, parameter) {
  var k=i, re, pV, str='';

  for(k=i; k<args.length; k++) {
		if(typeof args[k] == 'number' && args[k]>pmStart) break;
		str += args[k] + ',';
	}
	if (str) str = str.substring(0,--str.length);

	k--;  // reduce by one so the for loop this is in works correctly
	pV=(olNs4 && /cellpad/i.test(parameter)) ? str.split(',')[0] : str;
	eval(parameter + '="' + pV + '"');

	return k;
}

// Remove &nbsp; in texts when done.
function nbspCleanup() {
	if (o3_wrap) {
		o3_text = o3_text.replace(/\&nbsp;/g, ' ');
		o3_cap = o3_cap.replace(/\&nbsp;/g, ' ');
	}
}

// Escape embedded single quotes in text strings
function escSglQuote(str) {
  return str.toString().replace(/'/g,"\\'");
}

// Onload handler for window onload event
function OLonLoad_handler(e) {
	var re = /\w+\(.*\)[;\s]+/g, olre = /overlib\(|nd\(|cClick\(/, fn, l, i;

	if(!olLoaded) olLoaded=1;

  // Remove it for Gecko based browsers
	if(window.removeEventListener && e.eventPhase == 3) window.removeEventListener("load",OLonLoad_handler,false);
	else if(window.detachEvent) { // and for IE and Opera 4.x but execute calls to overlib, nd, or cClick()
		window.detachEvent("onload",OLonLoad_handler);
		var fN = document.body.getAttribute('onload');
		if (fN) {
			fN=fN.toString().match(re);
			if (fN && fN.length) {
				for (i=0; i<fN.length; i++) {
					if (/anonymous/.test(fN[i])) continue;
					while((l=fN[i].search(/\)[;\s]+/)) != -1) {
						fn=fN[i].substring(0,l+1);
						fN[i] = fN[i].substring(l+2);
						if (olre.test(fn)) eval(fn);
					}
				}
			}
		}
	}
}

// Wraps strings in Layer Generation Functions with the correct tags
//    endWrap true(if end tag) or false if start tag
//    fontSizeStr - font size string such as '1' or '10px'
//    whichString is being wrapped -- 'text', 'caption', or 'close'
function wrapStr(endWrap,fontSizeStr,whichString) {
	var fontStr, fontColor, isClose=((whichString=='close') ? 1 : 0), hasDims=/[%\-a-z]+$/.test(fontSizeStr);
	fontSizeStr = (olNs4) ? (!hasDims ? fontSizeStr : '1') : fontSizeStr;
	if (endWrap) return (hasDims&&!olNs4) ? (isClose ? '</span>' : '</div>') : '</font>';
	else {
		fontStr='o3_'+whichString+'font';
		fontColor='o3_'+((whichString=='caption')? 'cap' : whichString)+'color';
		return (hasDims&&!olNs4) ? (isClose ? '<span style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">' : '<div style="font-family: '+quoteMultiNameFonts(eval(fontStr))+'; color: '+eval(fontColor)+'; font-size: '+fontSizeStr+';">') : '<font face="'+eval(fontStr)+'" color="'+eval(fontColor)+'" size="'+(parseInt(fontSizeStr)>7 ? '7' : fontSizeStr)+'">';
	}
}

// Quotes Multi word font names; needed for CSS Standards adherence in font-family
function quoteMultiNameFonts(theFont) {
	var v, pM=theFont.split(',');
	for (var i=0; i<pM.length; i++) {
		v=pM[i];
		v=v.replace(/^\s+/,'').replace(/\s+$/,'');
		if(/\s/.test(v) && !/['"]/.test(v)) {
			v="\'"+v+"\'";
			pM[i]=v;
		}
	}
	return pM.join();
}

// dummy function which will be overridden 
function isExclusive(args) {
	return false;
}

// Sets cellpadding style string value
function setCellPadStr(parameter) {
	var Str='', j=0, ary = new Array(), top, bottom, left, right;

	Str+='padding: ';
	ary=parameter.replace(/\s+/g,'').split(',');

	switch(ary.length) {
		case 2:
			top=bottom=ary[j];
			left=right=ary[++j];
			break;
		case 3:
			top=ary[j];
			left=right=ary[++j];
			bottom=ary[++j];
			break;
		case 4:
			top=ary[j];
			right=ary[++j];
			bottom=ary[++j];
			left=ary[++j];
			break;
	}

	Str+= ((ary.length==1) ? ary[0] + 'px;' : top + 'px ' + right + 'px ' + bottom + 'px ' + left + 'px;');

	return Str;
}

// function will delay close by time milliseconds
function hideDelay(time) {
	if (time&&!o3_delay) {
		if (o3_timerid > 0) clearTimeout(o3_timerid);

		o3_timerid=setTimeout("cClick()",(o3_timeout=time));
	}
}

// Was originally in the placeLayer() routine; separated out for future ease
function horizontalPlacement(browserWidth, horizontalScrollAmount, widthFix) {
	var placeX, iwidth=browserWidth, winoffset=horizontalScrollAmount;
	var parsedWidth = parseInt(o3_width);

	if (o3_fixx > -1 || o3_relx != null) {
		// Fixed position
		placeX=(o3_relx != null ? ( o3_relx < 0 ? winoffset +o3_relx+ iwidth - parsedWidth - widthFix : winoffset+o3_relx) : o3_fixx);
	} else {  
		// If HAUTO, decide what to use.
		if (o3_hauto == 1) {
			if ((o3_x - winoffset) > (iwidth / 2)) {
				o3_hpos = LEFT;
			} else {
				o3_hpos = RIGHT;
			}
		}  		

		// From mouse
		if (o3_hpos == CENTER) { // Center
			placeX = o3_x+o3_offsetx-(parsedWidth/2);

			if (placeX < winoffset) placeX = winoffset;
		}

		if (o3_hpos == RIGHT) { // Right
			placeX = o3_x+o3_offsetx;

			if ((placeX+parsedWidth) > (winoffset+iwidth - widthFix)) {
				placeX = iwidth+winoffset - parsedWidth - widthFix;
				if (placeX < 0) placeX = 0;
			}
		}
		if (o3_hpos == LEFT) { // Left
			placeX = o3_x-o3_offsetx-parsedWidth;
			if (placeX < winoffset) placeX = winoffset;
		}  	

		// Snapping!
		if (o3_snapx > 1) {
			var snapping = placeX % o3_snapx;

			if (o3_hpos == LEFT) {
				placeX = placeX - (o3_snapx+snapping);
			} else {
				// CENTER and RIGHT
				placeX = placeX+(o3_snapx - snapping);
			}

			if (placeX < winoffset) placeX = winoffset;
		}
	}	

	return placeX;
}

// was originally in the placeLayer() routine; separated out for future ease
function verticalPlacement(browserHeight,verticalScrollAmount) {
	var placeY, iheight=browserHeight, scrolloffset=verticalScrollAmount;
	var parsedHeight=(o3_aboveheight ? parseInt(o3_aboveheight) : (olNs4 ? over.clip.height : over.offsetHeight));

	if (o3_fixy > -1 || o3_rely != null) {
		// Fixed position
		placeY=(o3_rely != null ? (o3_rely < 0 ? scrolloffset+o3_rely+iheight - parsedHeight : scrolloffset+o3_rely) : o3_fixy);
	} else {
		// If VAUTO, decide what to use.
		if (o3_vauto == 1) {
			if ((o3_y - scrolloffset) > (iheight / 2) && o3_vpos == BELOW && (o3_y + parsedHeight + o3_offsety - (scrolloffset + iheight) > 0)) {
				o3_vpos = ABOVE;
			} else if (o3_vpos == ABOVE && (o3_y - (parsedHeight + o3_offsety) - scrolloffset < 0)) {
				o3_vpos = BELOW;
			}
		}

		// From mouse
		if (o3_vpos == ABOVE) {
			if (o3_aboveheight == 0) o3_aboveheight = parsedHeight; 

			placeY = o3_y - (o3_aboveheight+o3_offsety);
			if (placeY < scrolloffset) placeY = scrolloffset;
		} else {
			// BELOW
			placeY = o3_y+o3_offsety;
		} 

		// Snapping!
		if (o3_snapy > 1) {
			var snapping = placeY % o3_snapy;  			

			if (o3_aboveheight > 0 && o3_vpos == ABOVE) {
				placeY = placeY - (o3_snapy+snapping);
			} else {
				placeY = placeY+(o3_snapy - snapping);
			} 			

			if (placeY < scrolloffset) placeY = scrolloffset;
		}
	}

	return placeY;
}

// checks positioning flags
function checkPositionFlags() {
	if (olHautoFlag) olHautoFlag = o3_hauto=0;
	if (olVautoFlag) olVautoFlag = o3_vauto=0;
	return true;
}

// get Browser window width
function windowWidth() {
	var w;
	if (o3_frame.innerWidth) w=o3_frame.innerWidth;
	else if (eval('o3_frame.'+docRoot)&&eval("typeof o3_frame."+docRoot+".clientWidth=='number'")&&eval('o3_frame.'+docRoot+'.clientWidth')) 
		w=eval('o3_frame.'+docRoot+'.clientWidth');
	return w;			
}

// create the div container for popup content if it doesn't exist
function createDivContainer(id,frm,zValue) {
	id = (id || 'overDiv'), frm = (frm || o3_frame), zValue = (zValue || 1000);
	var objRef, divContainer = layerReference(id);

	if (divContainer == null) {
		if (olNs4) {
			divContainer = frm.document.layers[id] = new Layer(window.innerWidth, frm);
			objRef = divContainer;
		} else {
			var body = (olIe4 ? frm.document.all.tags('BODY')[0] : frm.document.getElementsByTagName("BODY")[0]);
			if (olIe4&&!document.getElementById) {
				body.insertAdjacentHTML("beforeEnd",'<div id="'+id+'"></div>');
				divContainer=layerReference(id);
			} else {
				divContainer = frm.document.createElement("DIV");
				divContainer.id = id;
				body.appendChild(divContainer);
			}
			objRef = divContainer.style;
		}

		objRef.position = 'absolute';
		objRef.visibility = 'hidden';
		objRef.zIndex = zValue;
		if (olIe4&&!olOp) objRef.left = objRef.top = '0px';
		else objRef.left = objRef.top =  -10000 + (!olNs4 ? 'px' : 0);
	}

	return divContainer;
}

// get reference to a layer with ID=id
function layerReference(id) {
	return (olNs4 ? o3_frame.document.layers[id] : (document.all ? o3_frame.document.all[id] : o3_frame.document.getElementById(id)));
}
////////
//  UTILITY FUNCTIONS
////////

// Checks if something is a function.
function isFunction(fnRef) {
	var rtn = true;

	if (typeof fnRef == 'object') {
		for (var i = 0; i < fnRef.length; i++) {
			if (typeof fnRef[i]=='function') continue;
			rtn = false;
			break;
		}
	} else if (typeof fnRef != 'function') {
		rtn = false;
	}
	
	return rtn;
}

// Converts an array into an argument string for use in eval.
function argToString(array, strtInd, argName) {
	var jS = strtInd, aS = '', ar = array;
	argName=(argName ? argName : 'ar');
	
	if (ar.length > jS) {
		for (var k = jS; k < ar.length; k++) aS += argName+'['+k+'], ';
		aS = aS.substring(0, aS.length-2);
	}
	
	return aS;
}

// Places a hook in the correct position in a hook point.
function reOrder(hookPt, fnRef, order) {
	var newPt = new Array(), match, i, j;

	if (!order || typeof order == 'undefined' || typeof order == 'number') return hookPt;
	
	if (typeof order=='function') {
		if (typeof fnRef=='object') {
			newPt = newPt.concat(fnRef);
		} else {
			newPt[newPt.length++]=fnRef;
		}
		
		for (i = 0; i < hookPt.length; i++) {
			match = false;
			if (typeof fnRef == 'function' && hookPt[i] == fnRef) {
				continue;
			} else {
				for(j = 0; j < fnRef.length; j++) if (hookPt[i] == fnRef[j]) {
					match = true;
					break;
				}
			}
			if (!match) newPt[newPt.length++] = hookPt[i];
		}

		newPt[newPt.length++] = order;

	} else if (typeof order == 'object') {
		if (typeof fnRef == 'object') {
			newPt = newPt.concat(fnRef);
		} else {
			newPt[newPt.length++] = fnRef;
		}
		
		for (j = 0; j < hookPt.length; j++) {
			match = false;
			if (typeof fnRef == 'function' && hookPt[j] == fnRef) {
				continue;
			} else {
				for (i = 0; i < fnRef.length; i++) if (hookPt[j] == fnRef[i]) {
					match = true;
					break;
				}
			}
			if (!match) newPt[newPt.length++]=hookPt[j];
		}

		for (i = 0; i < newPt.length; i++) hookPt[i] = newPt[i];
		newPt.length = 0;
		
		for (j = 0; j < hookPt.length; j++) {
			match = false;
			for (i = 0; i < order.length; i++) {
				if (hookPt[j] == order[i]) {
					match = true;
					break;
				}
			}
			if (!match) newPt[newPt.length++] = hookPt[j];
		}
		newPt = newPt.concat(order);
	}

	hookPt = newPt;

	return hookPt;
}

////////
//  PLUGIN ACTIVATION FUNCTIONS
////////

// Runs plugin functions to set runtime variables.
function setRunTimeVariables(){
	if (typeof runTime != 'undefined' && runTime.length) {
		for (var k = 0; k < runTime.length; k++) {
			runTime[k]();
		}
	}
}

// Runs plugin functions to parse commands.
function parseCmdLine(pf, i, args) {
	if (typeof cmdLine != 'undefined' && cmdLine.length) { 
		for (var k = 0; k < cmdLine.length; k++) { 
			var j = cmdLine[k](pf, i, args);
			if (j >- 1) {
				i = j;
				break;
			}
		}
	}

	return i;
}

// Runs plugin functions to do things after parse.
function postParseChecks(pf,args){
	if (typeof postParse != 'undefined' && postParse.length) {
		for (var k = 0; k < postParse.length; k++) {
			if (postParse[k](pf,args)) continue;
			return false;  // end now since have an error
		}
	}
	return true;
}


////////
//  PLUGIN REGISTRATION FUNCTIONS
////////

// Registers commands and creates constants.
function registerCommands(cmdStr) {
	if (typeof cmdStr!='string') return;

	var pM = cmdStr.split(',');
	pms = pms.concat(pM);

	for (var i = 0; i< pM.length; i++) {
		eval(pM[i].toUpperCase()+'='+pmCount++);
	}
}

// Registers no-parameter commands
function registerNoParameterCommands(cmdStr) {
	if (!cmdStr && typeof cmdStr != 'string') return;
	pmt=(!pmt) ? cmdStr : pmt + ',' + cmdStr;
}

// Register a function to hook at a certain point.
function registerHook(fnHookTo, fnRef, hookType, optPm) {
	var hookPt, last = typeof optPm;
	
	if (fnHookTo == 'plgIn'||fnHookTo == 'postParse') return;
	if (typeof hookPts[fnHookTo] == 'undefined') hookPts[fnHookTo] = new FunctionReference();

	hookPt = hookPts[fnHookTo];

	if (hookType != null) {
		if (hookType == FREPLACE) {
			hookPt.ovload = fnRef;  // replace normal overlib routine
			if (fnHookTo.indexOf('ol_content_') > -1) hookPt.alt[pms[CSSOFF-1-pmStart]]=fnRef; 

		} else if (hookType == FBEFORE || hookType == FAFTER) {
			var hookPt=(hookType == 1 ? hookPt.before : hookPt.after);

			if (typeof fnRef == 'object') {
				hookPt = hookPt.concat(fnRef);
			} else {
				hookPt[hookPt.length++] = fnRef;
			}

			if (optPm) hookPt = reOrder(hookPt, fnRef, optPm);

		} else if (hookType == FALTERNATE) {
			if (last=='number') hookPt.alt[pms[optPm-1-pmStart]] = fnRef;
		} else if (hookType == FCHAIN) {
			hookPt = hookPt.chain; 
			if (typeof fnRef=='object') hookPt=hookPt.concat(fnRef); // add other functions 
			else hookPt[hookPt.length++]=fnRef;
		}

		return;
	}
}

// Register a function that will set runtime variables.
function registerRunTimeFunction(fn) {
	if (isFunction(fn)) {
		if (typeof fn == 'object') {
			runTime = runTime.concat(fn);
		} else {
			runTime[runTime.length++] = fn;
		}
	}
}

// Register a function that will handle command parsing.
function registerCmdLineFunction(fn){
	if (isFunction(fn)) {
		if (typeof fn == 'object') {
			cmdLine = cmdLine.concat(fn);
		} else {
			cmdLine[cmdLine.length++] = fn;
		}
	}
}

// Register a function that does things after command parsing. 
function registerPostParseFunction(fn){
	if (isFunction(fn)) {
		if (typeof fn == 'object') {
			postParse = postParse.concat(fn);
		} else {
			postParse[postParse.length++] = fn;
		}
	}
}

////////
//  PLUGIN REGISTRATION FUNCTIONS
////////

// Runs any hooks registered.
function runHook(fnHookTo, hookType) {
	var l = hookPts[fnHookTo], k, rtnVal = null, optPm, arS, ar = runHook.arguments;

	if (hookType == FREPLACE) {
		arS = argToString(ar, 2);

		if (typeof l == 'undefined' || !(l = l.ovload)) rtnVal = eval(fnHookTo+'('+arS+')');
		else rtnVal = eval('l('+arS+')');

	} else if (hookType == FBEFORE || hookType == FAFTER) {
		if (typeof l != 'undefined') {
			l=(hookType == 1 ? l.before : l.after);
	
			if (l.length) {
				arS = argToString(ar, 2);
				for (var k = 0; k < l.length; k++) eval('l[k]('+arS+')');
			}
		}
	} else if (hookType == FALTERNATE) {
		optPm = ar[2];
		arS = argToString(ar, 3);

		if (typeof l == 'undefined' || (l = l.alt[pms[optPm-1-pmStart]]) == 'undefined') {
			rtnVal = eval(fnHookTo+'('+arS+')');
		} else {
			rtnVal = eval('l('+arS+')');
		}
	} else if (hookType == FCHAIN) {
		arS=argToString(ar,2);
		l=l.chain;

		for (k=l.length; k > 0; k--) if((rtnVal=eval('l[k-1]('+arS+')'))!=void(0)) break;
	}

	return rtnVal;
}

////////
// OBJECT CONSTRUCTORS
////////

// Object for handling hooks.
function FunctionReference() {
	this.ovload = null;
	this.before = new Array();
	this.after = new Array();
	this.alt = new Array();
	this.chain = new Array();
}

// Object for simple access to the overLIB version used.
// Examples: simpleversion:351 major:3 minor:5 revision:1
function Info(version, prerelease) {
	this.version = version;
	this.prerelease = prerelease;

	this.simpleversion = Math.round(this.version*100);
	this.major = parseInt(this.simpleversion / 100);
	this.minor = parseInt(this.simpleversion / 10) - this.major * 10;
	this.revision = parseInt(this.simpleversion) - this.major * 100 - this.minor * 10;
	this.meets = meets;
}

// checks for Core Version required
function meets(reqdVersion) {
	return (!reqdVersion) ? false : this.simpleversion >= Math.round(100*parseFloat(reqdVersion));
}


////////
// STANDARD REGISTRATIONS
////////
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSOFF);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSOFF);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSOFF);
registerHook("ol_content_simple", ol_content_simple, FALTERNATE, CSSCLASS);
registerHook("ol_content_caption", ol_content_caption, FALTERNATE, CSSCLASS);
registerHook("ol_content_background", ol_content_background, FALTERNATE, CSSCLASS);
registerPostParseFunction(checkPositionFlags);
registerHook("hideObject", nbspCleanup, FAFTER);
registerHook("horizontalPlacement", horizontalPlacement, FCHAIN);
registerHook("verticalPlacement", verticalPlacement, FCHAIN);
if (olNs4||(olIe5&&isMac)||olKq) olLoaded=1;
registerNoParameterCommands('sticky,autostatus,autostatuscap,fullhtml,hauto,vauto,closeclick,wrap,followmouse,mouseoff,compatmode');
///////
// ESTABLISH MOUSECAPTURING
///////

// Capture events, alt. diffuses the overlib function.
var olCheckMouseCapture=true;
if ((olNs4 || olNs6 || olIe4)) {
	olMouseCapture();
} else {
	overlib = no_overlib;
	nd = no_overlib;
	ver3fix = true;
}


/* jquery/jquery.js */

/*! jQuery v1.6.4 http://jquery.com/ | http://jquery.org/license */
(function(a,b){function cu(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cr(a){if(!cg[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){ch||(ch=c.createElement("iframe"),ch.frameBorder=ch.width=ch.height=0),b.appendChild(ch);if(!ci||!ch.createElement)ci=(ch.contentWindow||ch.contentDocument).document,ci.write((c.compatMode==="CSS1Compat"?"<!doctype html>":"")+"<html><body>"),ci.close();d=ci.createElement(a),ci.body.appendChild(d),e=f.css(d,"display"),b.removeChild(ch)}cg[a]=e}return cg[a]}function cq(a,b){var c={};f.each(cm.concat.apply([],cm.slice(0,b)),function(){c[this]=a});return c}function cp(){cn=b}function co(){setTimeout(cp,0);return cn=f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ce(){try{return new a.XMLHttpRequest}catch(b){}}function b$(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g<i;g++){if(g===1)for(h in a.converters)typeof h=="string"&&(e[h.toLowerCase()]=a.converters[h]);l=k,k=d[g];if(k==="*")k=l;else if(l!=="*"&&l!==k){m=l+" "+k,n=e[m]||e["* "+k];if(!n){p=b;for(o in e){j=o.split(" ");if(j[0]===l||j[0]==="*"){p=e[j[1]+" "+k];if(p){o=e[o],o===!0?n=p:p===!0&&(n=o);break}}}}!n&&!p&&f.error("No conversion from "+m.replace(" "," to ")),n!==!0&&(c=n?n(c):p(o(c)))}}return c}function bZ(a,c,d){var e=a.contents,f=a.dataTypes,g=a.responseFields,h,i,j,k;for(i in g)i in d&&(c[g[i]]=d[i]);while(f[0]==="*")f.shift(),h===b&&(h=a.mimeType||c.getResponseHeader("content-type"));if(h)for(i in e)if(e[i]&&e[i].test(h)){f.unshift(i);break}if(f[0]in d)j=f[0];else{for(i in d){if(!f[0]||a.converters[i+" "+f[0]]){j=i;break}k||(k=i)}j=j||k}if(j){j!==f[0]&&f.unshift(j);return d[j]}}function bY(a,b,c,d){if(f.isArray(b))f.each(b,function(b,e){c||bA.test(a)?d(a,e):bY(a+"["+(typeof e=="object"||f.isArray(e)?b:"")+"]",e,c,d)});else if(!c&&b!=null&&typeof b=="object")for(var e in b)bY(a+"["+e+"]",b[e],c,d);else d(a,b)}function bX(a,c){var d,e,g=f.ajaxSettings.flatOptions||{};for(d in c)c[d]!==b&&((g[d]?a:e||(e={}))[d]=c[d]);e&&f.extend(!0,a,e)}function bW(a,c,d,e,f,g){f=f||c.dataTypes[0],g=g||{},g[f]=!0;var h=a[f],i=0,j=h?h.length:0,k=a===bP,l;for(;i<j&&(k||!l);i++)l=h[i](c,d,e),typeof l=="string"&&(!k||g[l]?l=b:(c.dataTypes.unshift(l),l=bW(a,c,d,e,l,g)));(k||!l)&&!g["*"]&&(l=bW(a,c,d,e,"*",g));return l}function bV(a){return function(b,c){typeof b!="string"&&(c=b,b="*");if(f.isFunction(c)){var d=b.toLowerCase().split(bL),e=0,g=d.length,h,i,j;for(;e<g;e++)h=d[e],j=/^\+/.test(h),j&&(h=h.substr(1)||"*"),i=a[h]=a[h]||[],i[j?"unshift":"push"](c)}}}function by(a,b,c){var d=b==="width"?a.offsetWidth:a.offsetHeight,e=b==="width"?bt:bu;if(d>0){c!=="border"&&f.each(e,function(){c||(d-=parseFloat(f.css(a,"padding"+this))||0),c==="margin"?d+=parseFloat(f.css(a,c+this))||0:d-=parseFloat(f.css(a,"border"+this+"Width"))||0});return d+"px"}d=bv(a,b,b);if(d<0||d==null)d=a.style[b]||0;d=parseFloat(d)||0,c&&f.each(e,function(){d+=parseFloat(f.css(a,"padding"+this))||0,c!=="padding"&&(d+=parseFloat(f.css(a,"border"+this+"Width"))||0),c==="margin"&&(d+=parseFloat(f.css(a,c+this))||0)});return d+"px"}function bl(a,b){b.src?f.ajax({url:b.src,async:!1,dataType:"script"}):f.globalEval((b.text||b.textContent||b.innerHTML||"").replace(bd,"/*$0*/")),b.parentNode&&b.parentNode.removeChild(b)}function bk(a){f.nodeName(a,"input")?bj(a):"getElementsByTagName"in a&&f.grep(a.getElementsByTagName("input"),bj)}function bj(a){if(a.type==="checkbox"||a.type==="radio")a.defaultChecked=a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a,b){var c;if(b.nodeType===1){b.clearAttributes&&b.clearAttributes(),b.mergeAttributes&&b.mergeAttributes(a),c=b.nodeName.toLowerCase();if(c==="object")b.outerHTML=a.outerHTML;else if(c!=="input"||a.type!=="checkbox"&&a.type!=="radio"){if(c==="option")b.selected=a.defaultSelected;else if(c==="input"||c==="textarea")b.defaultValue=a.defaultValue}else a.checked&&(b.defaultChecked=b.checked=a.checked),b.value!==a.value&&(b.value=a.value);b.removeAttribute(f.expando)}}function bg(a,b){if(b.nodeType===1&&!!f.hasData(a)){var c=f.expando,d=f.data(a),e=f.data(b,d);if(d=d[c]){var g=d.events;e=e[c]=f.extend({},d);if(g){delete e.handle,e.events={};for(var h in g)for(var i=0,j=g[h].length;i<j;i++)f.event.add(b,h+(g[h][i].namespace?".":"")+g[h][i].namespace,g[h][i],g[h][i].data)}}}}function bf(a,b){return f.nodeName(a,"table")?a.getElementsByTagName("tbody")[0]||a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a,b,c){b=b||0;if(f.isFunction(b))return f.grep(a,function(a,d){var e=!!b.call(a,d,a);return e===c});if(b.nodeType)return f.grep(a,function(a,d){return a===b===c});if(typeof b=="string"){var d=f.grep(a,function(a){return a.nodeType===1});if(Q.test(b))return f.filter(b,d,!c);b=f.filter(b,d)}return f.grep(a,function(a,d){return f.inArray(a,b)>=0===c})}function U(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function M(a,b){return(a&&a!=="*"?a+".":"")+b.replace(y,"`").replace(z,"&")}function L(a){var b,c,d,e,g,h,i,j,k,l,m,n,o,p=[],q=[],r=f._data(this,"events");if(!(a.liveFired===this||!r||!r.live||a.target.disabled||a.button&&a.type==="click")){a.namespace&&(n=new RegExp("(^|\\.)"+a.namespace.split(".").join("\\.(?:.*\\.)?")+"(\\.|$)")),a.liveFired=this;var s=r.live.slice(0);for(i=0;i<s.length;i++)g=s[i],g.origType.replace(w,"")===a.type?q.push(g.selector):s.splice(i--,1);e=f(a.target).closest(q,a.currentTarget);for(j=0,k=e.length;j<k;j++){m=e[j];for(i=0;i<s.length;i++){g=s[i];if(m.selector===g.selector&&(!n||n.test(g.namespace))&&!m.elem.disabled){h=m.elem,d=null;if(g.preType==="mouseenter"||g.preType==="mouseleave")a.type=g.preType,d=f(a.relatedTarget).closest(g.selector)[0],d&&f.contains(h,d)&&(d=h);(!d||d!==h)&&p.push({elem:h,handleObj:g,level:m.level})}}}for(j=0,k=p.length;j<k;j++){e=p[j];if(c&&e.level>c)break;a.currentTarget=e.elem,a.data=e.handleObj.data,a.handleObj=e.handleObj,o=e.handleObj.origHandler.apply(e.elem,arguments);if(o===!1||a.isPropagationStopped()){c=e.level,o===!1&&(b=!1);if(a.isImmediatePropagationStopped())break}}return b}}function J(a,c,d){var e=f.extend({},d[0]);e.type=a,e.originalEvent={},e.liveFired=b,f.event.handle.call(c,e),e.isDefaultPrevented()&&d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a,c,d){var e=c+"defer",g=c+"queue",h=c+"mark",i=f.data(a,e,b,!0);i&&(d==="queue"||!f.data(a,g,b,!0))&&(d==="mark"||!f.data(a,h,b,!0))&&setTimeout(function(){!f.data(a,g,b,!0)&&!f.data(a,h,b,!0)&&(f.removeData(a,e,!0),i.resolve())},0)}function l(a){for(var b in a)if(b!=="toJSON")return!1;return!0}function k(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(j,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)}catch(g){}f.data(a,c,d)}else d=b}return d}var c=a.document,d=a.navigator,e=a.location,f=function(){function K(){if(!e.isReady){try{c.documentElement.doScroll("left")}catch(a){setTimeout(K,1);return}e.ready()}}var e=function(a,b){return new e.fn.init(a,b,h)},f=a.jQuery,g=a.$,h,i=/^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/\d/,n=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,o=/^[\],:{}\s]*$/,p=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,q=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,r=/(?:^|:|,)(?:\s*\[)+/g,s=/(webkit)[ \/]([\w.]+)/,t=/(opera)(?:.*version)?[ \/]([\w.]+)/,u=/(msie) ([\w.]+)/,v=/(mozilla)(?:.*? rv:([\w.]+))?/,w=/-([a-z]|[0-9])/ig,x=/^-ms-/,y=function(a,b){return(b+"").toUpperCase()},z=d.userAgent,A,B,C,D=Object.prototype.toString,E=Object.prototype.hasOwnProperty,F=Array.prototype.push,G=Array.prototype.slice,H=String.prototype.trim,I=Array.prototype.indexOf,J={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=n.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.6.4",length:0,size:function(){return this.length},toArray:function(){return G.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?F.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),B.done(a);return this},eq:function(a){return a===-1?this.slice(a):this.slice(a,+a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(G.apply(this,arguments),"slice",G.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:F,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j<k;j++)if((a=arguments[j])!=null)for(c in a){d=i[c],f=a[c];if(i===f)continue;l&&f&&(e.isPlainObject(f)||(g=e.isArray(f)))?(g?(g=!1,h=d&&e.isArray(d)?d:[]):h=d&&e.isPlainObject(d)?d:{},i[c]=e.extend(l,h,f)):f!==b&&(i[c]=f)}return i},e.extend({noConflict:function(b){a.$===e&&(a.$=g),b&&a.jQuery===e&&(a.jQuery=f);return e},isReady:!1,readyWait:1,holdReady:function(a){a?e.readyWait++:e.ready(!0)},ready:function(a){if(a===!0&&!--e.readyWait||a!==!0&&!e.isReady){if(!c.body)return setTimeout(e.ready,1);e.isReady=!0;if(a!==!0&&--e.readyWait>0)return;B.resolveWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").unbind("ready")}},bindReady:function(){if(!B){B=e._Deferred();if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",C,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",C),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&K()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNaN:function(a){return a==null||!m.test(a)||isNaN(a)},type:function(a){return a==null?String(a):J[D.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!E.call(a,"constructor")&&!E.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||E.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw a},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(o.test(b.replace(p,"@").replace(q,"]").replace(r,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(x,"ms-").replace(w,y)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g<h;)if(c.apply(a[g++],d)===!1)break}else if(i){for(f in a)if(c.call(a[f],f,a[f])===!1)break}else for(;g<h;)if(c.call(a[g],g,a[g++])===!1)break;return a},trim:H?function(a){return a==null?"":H.call(a)}:function(a){return a==null?"":(a+"").replace(k,"").replace(l,"")},makeArray:function(a,b){var c=b||[];if(a!=null){var d=e.type(a);a.length==null||d==="string"||d==="function"||d==="regexp"||e.isWindow(a)?F.call(c,a):e.merge(c,a)}return c},inArray:function(a,b){if(!b)return-1;if(I)return I.call(b,a);for(var c=0,d=b.length;c<d;c++)if(b[c]===a)return c;return-1},merge:function(a,c){var d=a.length,e=0;if(typeof c.length=="number")for(var f=c.length;e<f;e++)a[d++]=c[e];else while(c[e]!==b)a[d++]=c[e++];a.length=d;return a},grep:function(a,b,c){var d=[],e;c=!!c;for(var f=0,g=a.length;f<g;f++)e=!!b(a[f],f),c!==e&&d.push(a[f]);return d},map:function(a,c,d){var f,g,h=[],i=0,j=a.length,k=a instanceof e||j!==b&&typeof j=="number"&&(j>0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i<j;i++)f=c(a[i],i,d),f!=null&&(h[h.length]=f);else for(g in a)f=c(a[g],g,d),f!=null&&(h[h.length]=f);return h.concat.apply([],h)},guid:1,proxy:function(a,c){if(typeof c=="string"){var d=a[c];c=a,a=d}if(!e.isFunction(a))return b;var f=G.call(arguments,2),g=function(){return a.apply(c,f.concat(G.call(arguments)))};g.guid=a.guid=a.guid||g.guid||e.guid++;return g},access:function(a,c,d,f,g,h){var i=a.length;if(typeof c=="object"){for(var j in c)e.access(a,j,c[j],f,g,d);return a}if(d!==b){f=!h&&f&&e.isFunction(d);for(var k=0;k<i;k++)g(a[k],c,f?d.call(a[k],k,g(a[k],c)):d,h);return a}return i?g(a[0],c):b},now:function(){return(new Date).getTime()},uaMatch:function(a){a=a.toLowerCase();var b=s.exec(a)||t.exec(a)||u.exec(a)||a.indexOf("compatible")<0&&v.exec(a)||[];return{browser:b[1]||"",version:b[2]||"0"}},sub:function(){function a(b,c){return new a.fn.init(b,c)}e.extend(!0,a,this),a.superclass=this,a.fn=a.prototype=this(),a.fn.constructor=a,a.sub=this.sub,a.fn.init=function(d,f){f&&f instanceof e&&!(f instanceof a)&&(f=a(f));return e.fn.init.call(this,d,f,b)},a.fn.init.prototype=a.fn;var b=a(c);return a},browser:{}}),e.each("Boolean Number String Function Array Date RegExp Object".split(" "),function(a,b){J["[object "+b+"]"]=b.toLowerCase()}),A=e.uaMatch(z),A.browser&&(e.browser[A.browser]=!0,e.browser.version=A.version),e.browser.webkit&&(e.browser.safari=!0),j.test(" ")&&(k=/^[\s\xA0]+/,l=/[\s\xA0]+$/),h=e(c),c.addEventListener?C=function(){c.removeEventListener("DOMContentLoaded",C,!1),e.ready()}:c.attachEvent&&(C=function(){c.readyState==="complete"&&(c.detachEvent("onreadystatechange",C),e.ready())});return e}(),g="done fail isResolved isRejected promise then always pipe".split(" "),h=[].slice;f.extend({_Deferred:function(){var a=[],b,c,d,e={done:function(){if(!d){var c=arguments,g,h,i,j,k;b&&(k=b,b=0);for(g=0,h=c.length;g<h;g++)i=c[g],j=f.type(i),j==="array"?e.done.apply(e,i):j==="function"&&a.push(i);k&&e.resolveWith(k[0],k[1])}return this},resolveWith:function(e,f){if(!d&&!b&&!c){f=f||[],c=1;try{while(a[0])a.shift().apply(e,f)}finally{b=[e,f],c=0}}return this},resolve:function(){e.resolveWith(this,arguments);return this},isResolved:function(){return!!c||!!b},cancel:function(){d=1,a=[];return this}};return e},Deferred:function(a){var b=f._Deferred(),c=f._Deferred(),d;f.extend(b,{then:function(a,c){b.done(a).fail(c);return this},always:function(){return b.done.apply(b,arguments).fail.apply(this,arguments)},fail:c.done,rejectWith:c.resolveWith,reject:c.resolve,isRejected:c.isResolved,pipe:function(a,c){return f.Deferred(function(d){f.each({done:[a,"resolve"],fail:[c,"reject"]},function(a,c){var e=c[0],g=c[1],h;f.isFunction(e)?b[a](function(){h=e.apply(this,arguments),h&&f.isFunction(h.promise)?h.promise().then(d.resolve,d.reject):d[g+"With"](this===b?d:this,[h])}):b[a](d[g])})}).promise()},promise:function(a){if(a==null){if(d)return d;d=a={}}var c=g.length;while(c--)a[g[c]]=b[g[c]];return a}}),b.done(c.cancel).fail(b.cancel),delete b.cancel,a&&a.call(b,b);return b},when:function(a){function i(a){return function(c){b[a]=arguments.length>1?h.call(arguments,0):c,--e||g.resolveWith(g,h.call(b,0))}}var b=arguments,c=0,d=b.length,e=d,g=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred();if(d>1){for(;c<d;c++)b[c]&&f.isFunction(b[c].promise)?b[c].promise().then(i(c),g.reject):--e;e||g.resolveWith(g,b)}else g!==a&&g.resolveWith(g,d?[a]:[]);return g.promise()}}),f.support=function(){var a=c.createElement("div"),b=c.documentElement,d,e,g,h,i,j,k,l,m,n,o,p,q,r,s,t,u;a.setAttribute("className","t"),a.innerHTML="   <link/><table></table><a href='/a' style='top:1px;float:left;opacity:.55;'>a</a><input type='checkbox'/>",d=a.getElementsByTagName("*"),e=a.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=a.getElementsByTagName("input")[0],k={leadingWhitespace:a.firstChild.nodeType===3,tbody:!a.getElementsByTagName("tbody").length,htmlSerialize:!!a.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55$/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:a.className!=="t",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,k.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,k.optDisabled=!h.disabled;try{delete a.test}catch(v){k.deleteExpando=!1}!a.addEventListener&&a.attachEvent&&a.fireEvent&&(a.attachEvent("onclick",function(){k.noCloneEvent=!1}),a.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),k.radioValue=i.value==="t",i.setAttribute("checked","checked"),a.appendChild(i),l=c.createDocumentFragment(),l.appendChild(a.firstChild),k.checkClone=l.cloneNode(!0).cloneNode(!0).lastChild.checked,a.innerHTML="",a.style.width=a.style.paddingLeft="1px",m=c.getElementsByTagName("body")[0],o=c.createElement(m?"div":"body"),p={visibility:"hidden",width:0,height:0,border:0,margin:0,background:"none"},m&&f.extend(p,{position:"absolute",left:"-1000px",top:"-1000px"});for(t in p)o.style[t]=p[t];o.appendChild(a),n=m||b,n.insertBefore(o,n.firstChild),k.appendChecked=i.checked,k.boxModel=a.offsetWidth===2,"zoom"in a.style&&(a.style.display="inline",a.style.zoom=1,k.inlineBlockNeedsLayout=a.offsetWidth===2,a.style.display="",a.innerHTML="<div style='width:4px;'></div>",k.shrinkWrapBlocks=a.offsetWidth!==2),a.innerHTML="<table><tr><td style='padding:0;border:0;display:none'></td><td>t</td></tr></table>",q=a.getElementsByTagName("td"),u=q[0].offsetHeight===0,q[0].style.display="",q[1].style.display="none",k.reliableHiddenOffsets=u&&q[0].offsetHeight===0,a.innerHTML="",c.defaultView&&c.defaultView.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",a.appendChild(j),k.reliableMarginRight=(parseInt((c.defaultView.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0),o.innerHTML="",n.removeChild(o);if(a.attachEvent)for(t in{submit:1,change:1,focusin:1})s="on"+t,u=s in a,u||(a.setAttribute(s,"return;"),u=typeof a[s]=="function"),k[t+"Bubbles"]=u;o=l=g=h=m=j=a=i=null;return k}(),f.boxModel=f.support.boxModel;var i=/^(?:\{.*\}|\[.*\])$/,j=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!l(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i=f.expando,j=typeof c=="string",k=a.nodeType,l=k?f.cache:a,m=k?a[f.expando]:a[f.expando]&&f.expando;if((!m||e&&m&&l[m]&&!l[m][i])&&j&&d===b)return;m||(k?a[f.expando]=m=++f.uuid:m=f.expando),l[m]||(l[m]={},k||(l[m].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?l[m][i]=f.extend(l[m][i],c):l[m]=f.extend(l[m],c);g=l[m],e&&(g[i]||(g[i]={}),g=g[i]),d!==b&&(g[f.camelCase(c)]=d);if(c==="events"&&!g[c])return g[i]&&g[i].events;j?(h=g[c],h==null&&(h=g[f.camelCase(c)])):h=g;return h}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e=f.expando,g=a.nodeType,h=g?f.cache:a,i=g?a[f.expando]:f.expando;if(!h[i])return;if(b){d=c?h[i][e]:h[i];if(d){d[b]||(b=f.camelCase(b)),delete d[b];if(!l(d))return}}if(c){delete h[i][e];if(!l(h[i]))return}var j=h[i][e];f.support.deleteExpando||!h.setInterval?delete h[i]:h[i]=null,j?(h[i]={},g||(h[i].toJSON=f.noop),h[i][e]=j):g&&(f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando]=null)}},_data:function(a,b,c){return f.data(a,b,c,!0)},acceptData:function(a){if(a.nodeName){var b=f.noData[a.nodeName.toLowerCase()];if(b)return b!==!0&&a.getAttribute("classid")===b}return!0}}),f.fn.extend({data:function(a,c){var d=null;if(typeof a=="undefined"){if(this.length){d=f.data(this[0]);if(this[0].nodeType===1){var e=this[0].attributes,g;for(var h=0,i=e.length;h<i;h++)g=e[h].name,g.indexOf("data-")===0&&(g=f.camelCase(g.substring(5)),k(this[0],g,d[g]))}}return d}if(typeof a=="object")return this.each(function(){f.data(this,a)});var j=a.split(".");j[1]=j[1]?"."+j[1]:"";if(c===b){d=this.triggerHandler("getData"+j[1]+"!",[j[0]]),d===b&&this.length&&(d=f.data(this[0],a),d=k(this[0],a,d));return d===b&&j[1]?this.data(j[0]):d}return this.each(function(){var b=f(this),d=[j[0],c];b.triggerHandler("setData"+j[1]+"!",d),f.data(this,a,c),b.triggerHandler("changeData"+j[1]+"!",d)})},removeData:function(a){return this.each(function(){f.removeData(this,a)})}}),f.extend({_mark:function(a,c){a&&(c=(c||"fx")+"mark",f.data(a,c,(f.data(a,c,b,!0)||0)+1,!0))},_unmark:function(a,c,d){a!==!0&&(d=c,c=a,a=!1);if(c){d=d||"fx";var e=d+"mark",g=a?0:(f.data(c,e,b,!0)||1)-1;g?f.data(c,e,g,!0):(f.removeData(c,e,!0),m(c,d,"mark"))}},queue:function(a,c,d){if(a){c=(c||"fx")+"queue";var e=f.data(a,c,b,!0);d&&(!e||f.isArray(d)?e=f.data(a,c,f.makeArray(d),!0):e.push(d));return e||[]}},dequeue:function(a,b){b=b||"fx";var c=f.queue(a,b),d=c.shift(),e;d==="inprogress"&&(d=c.shift()),d&&(b==="fx"&&c.unshift("inprogress"),d.call(a,function(){f.dequeue(a,b)})),c.length||(f.removeData(a,b+"queue",!0),m(a,b,"queue"))}}),f.fn.extend({queue:function(a,c){typeof a!="string"&&(c=a,a="fx");if(c===b)return f.queue(this[0],a);return this.each(function(){var b=f.queue(this,a,c);a==="fx"&&b[0]!=="inprogress"&&f.dequeue(this,a)})},dequeue:function(a){return this.each(function(){f.dequeue(this,a)})},delay:function(a,b){a=f.fx?f.fx.speeds[a]||a:a,b=b||"fx";return this.queue(b,function(){var c=this;setTimeout(function(){f.dequeue(c,b)},a)})},clearQueue:function(a){return this.queue(a||"fx",[])},promise:function(a,c){function m(){--h||d.resolveWith(e,[e])}typeof a!="string"&&(c=a,a=b),a=a||"fx";var d=f.Deferred(),e=this,g=e.length,h=1,i=a+"defer",j=a+"queue",k=a+"mark",l;while(g--)if(l=f.data(e[g],i,b,!0)||(f.data(e[g],j,b,!0)||f.data(e[g],k,b,!0))&&f.data(e[g],i,f._Deferred(),!0))h++,l.done(m);m();return d.promise()}});var n=/[\n\t\r]/g,o=/\s+/,p=/\r/g,q=/^(?:button|input)$/i,r=/^(?:button|input|object|select|textarea)$/i,s=/^a(?:rea)?$/i,t=/^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i,u,v;f.fn.extend({attr:function(a,b){return f.access(this,a,b,!0,f.attr)},removeAttr:function(a){return this.each(function(){f.removeAttr(this,a)})},prop:function(a,b){return f.access(this,a,b,!0,f.prop)},removeProp:function(a){a=f.propFix[a]||a;return this.each(function(){try{this[a]=b,delete this[a]}catch(c){}})},addClass:function(a){var b,c,d,e,g,h,i;if(f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this,b,this.className))});if(a&&typeof a=="string"){b=a.split(o);for(c=0,d=this.length;c<d;c++){e=this[c];if(e.nodeType===1)if(!e.className&&b.length===1)e.className=a;else{g=" "+e.className+" ";for(h=0,i=b.length;h<i;h++)~g.indexOf(" "+b[h]+" ")||(g+=b[h]+" ");e.className=f.trim(g)}}}return this},removeClass:function(a){var c,d,e,g,h,i,j;if(f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this,b,this.className))});if(a&&typeof a=="string"||a===b){c=(a||"").split(o);for(d=0,e=this.length;d<e;d++){g=this[d];if(g.nodeType===1&&g.className)if(a){h=(" "+g.className+" ").replace(n," ");for(i=0,j=c.length;i<j;i++)h=h.replace(" "+c[i]+" "," ");g.className=f.trim(h)}else g.className=""}}return this},toggleClass:function(a,b){var c=typeof a,d=typeof b=="boolean";if(f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this,c,this.className,b),b)});return this.each(function(){if(c==="string"){var e,g=0,h=f(this),i=b,j=a.split(o);while(e=j[g++])i=d?i:!h.hasClass(e),h[i?"addClass":"removeClass"](e)}else if(c==="undefined"||c==="boolean")this.className&&f._data(this,"__className__",this.className),this.className=this.className||a===!1?"":f._data(this,"__className__")||""})},hasClass:function(a){var b=" "+a+" ";for(var c=0,d=this.length;c<d;c++)if(this[c].nodeType===1&&(" "+this[c].className+" ").replace(n," ").indexOf(b)>-1)return!0;return!1},val:function(a){var c,d,e=this[0];if(!arguments.length){if(e){c=f.valHooks[e.nodeName.toLowerCase()]||f.valHooks[e.type];if(c&&"get"in c&&(d=c.get(e,"value"))!==b)return d;d=e.value;return typeof d=="string"?d.replace(p,""):d==null?"":d}return b}var g=f.isFunction(a);return this.each(function(d){var e=f(this),h;if(this.nodeType===1){g?h=a.call(this,d,e.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c=a.selectedIndex,d=[],e=a.options,g=a.type==="select-one";if(c<0)return null;for(var h=g?c:0,i=g?c+1:e.length;h<i;h++){var j=e[h];if(j.selected&&(f.support.optDisabled?!j.disabled:j.getAttribute("disabled")===null)&&(!j.parentNode.disabled||!f.nodeName(j.parentNode,"optgroup"))){b=f(j).val();if(g)return b;d.push(b)}}if(g&&!d.length&&e.length)return f(e[c]).val();return d},set:function(a,b){var c=f.makeArray(b);f(a).find("option").each(function(){this.selected=f.inArray(f(this).val(),c)>=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attrFix:{tabindex:"tabIndex"},attr:function(a,c,d,e){var g=a.nodeType;if(!a||g===3||g===8||g===2)return b;if(e&&c in f.attrFn)return f(a)[c](d);if(!("getAttribute"in a))return f.prop(a,c,d);var h,i,j=g!==1||!f.isXMLDoc(a);j&&(c=f.attrFix[c]||c,i=f.attrHooks[c],i||(t.test(c)?i=v:u&&(i=u)));if(d!==b){if(d===null){f.removeAttr(a,c);return b}if(i&&"set"in i&&j&&(h=i.set(a,d,c))!==b)return h;a.setAttribute(c,""+d);return d}if(i&&"get"in i&&j&&(h=i.get(a,c))!==null)return h;h=a.getAttribute(c);return h===null?b:h},removeAttr:function(a,b){var c;a.nodeType===1&&(b=f.attrFix[b]||b,f.attr(a,b,""),a.removeAttribute(b),t.test(b)&&(c=f.propFix[b]||b)in a&&(a[c]=!1))},attrHooks:{type:{set:function(a,b){if(q.test(a.nodeName)&&a.parentNode)f.error("type property can't be changed");else if(!f.support.radioValue&&b==="radio"&&f.nodeName(a,"input")){var c=a.value;a.setAttribute("type",b),c&&(a.value=c);return b}}},value:{get:function(a,b){if(u&&f.nodeName(a,"button"))return u.get(a,b);return b in a?a.value:null},set:function(a,b,c){if(u&&f.nodeName(a,"button"))return u.set(a,b,c);a.value=b}}},propFix:{tabindex:"tabIndex",readonly:"readOnly","for":"htmlFor","class":"className",maxlength:"maxLength",cellspacing:"cellSpacing",cellpadding:"cellPadding",rowspan:"rowSpan",colspan:"colSpan",usemap:"useMap",frameborder:"frameBorder",contenteditable:"contentEditable"},prop:function(a,c,d){var e=a.nodeType;if(!a||e===3||e===8||e===2)return b;var g,h,i=e!==1||!f.isXMLDoc(a);i&&(c=f.propFix[c]||c,h=f.propHooks[c]);return d!==b?h&&"set"in h&&(g=h.set(a,d,c))!==b?g:a[c]=d:h&&"get"in h&&(g=h.get(a,c))!==null?g:a[c]},propHooks:{tabIndex:{get:function(a){var c=a.getAttributeNode("tabindex");return c&&c.specified?parseInt(c.value,10):r.test(a.nodeName)||s.test(a.nodeName)&&a.href?0:b}}}}),f.attrHooks.tabIndex=f.propHooks.tabIndex,v={get:function(a,c){var d;return f.prop(a,c)===!0||(d=a.getAttributeNode(c))&&d.nodeValue!==!1?c.toLowerCase():b},set:function(a,b,c){var d;b===!1?f.removeAttr(a,c):(d=f.propFix[c]||c,d in a&&(a[d]=!0),a.setAttribute(c,c.toLowerCase()));return c}},f.support.getSetAttribute||(u=f.valHooks.button={get:function(a,c){var d;d=a.getAttributeNode(c);return d&&d.nodeValue!==""?d.nodeValue:b},set:function(a,b,d){var e=a.getAttributeNode(d);e||(e=c.createAttribute(d),a.setAttributeNode(e));return e.nodeValue=b+""}},f.each(["width","height"],function(a,b){f.attrHooks[b]=f.extend(f.attrHooks[b],{set:function(a,c){if(c===""){a.setAttribute(b,"auto");return c}}})})),f.support.hrefNormalized||f.each(["href","src","width","height"],function(a,c){f.attrHooks[c]=f.extend(f.attrHooks[c],{get:function(a){var d=a.getAttribute(c,2);return d===null?b:d}})}),f.support.style||(f.attrHooks.style={get:function(a){return a.style.cssText.toLowerCase()||b},set:function(a,b){return a.style.cssText=""+b}}),f.support.optSelected||(f.propHooks.selected=f.extend(f.propHooks.selected,{get:function(a){var b=a.parentNode;b&&(b.selectedIndex,b.parentNode&&b.parentNode.selectedIndex);return null}})),f.support.checkOn||f.each(["radio","checkbox"],function(){f.valHooks[this]={get:function(a){return a.getAttribute("value")===null?"on":a.value}}}),f.each(["radio","checkbox"],function(){f.valHooks[this]=f.extend(f.valHooks[this],{set:function(a,b){if(f.isArray(b))return a.checked=f.inArray(f(a).val(),b)>=0}})});var w=/\.(.*)$/,x=/^(?:textarea|input|select)$/i,y=/\./g,z=/ /g,A=/[^\w\s.|`]/g,B=function(a){return a.replace(A,"\\$&")};f.event={add:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){if(d===!1)d=C;else if(!d)return;var g,h;d.handler&&(g=d,d=g.handler),d.guid||(d.guid=f.guid++);var i=f._data(a);if(!i)return;var j=i.events,k=i.handle;j||(i.events=j={}),k||(i.handle=k=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.handle.apply(k.elem,arguments):b}),k.elem=a,c=c.split(" ");var l,m=0,n;while(l=c[m++]){h=g?f.extend({},g):{handler:d,data:e},l.indexOf(".")>-1?(n=l.split("."),l=n.shift(),h.namespace=n.slice(0).sort().join(".")):(n=[],h.namespace=""),h.type=l,h.guid||(h.guid=d.guid);var o=j[l],p=f.event.special[l]||{};if(!o){o=j[l]=[];if(!p.setup||p.setup.call(a,e,n,k)===!1)a.addEventListener?a.addEventListener(l,k,!1):a.attachEvent&&a.attachEvent("on"+l,k)}p.add&&(p.add.call(a,h),h.handler.guid||(h.handler.guid=d.guid)),o.push(h),f.event.global[l]=!0}a=null}},global:{},remove:function(a,c,d,e){if(a.nodeType!==3&&a.nodeType!==8){d===!1&&(d=C);var g,h,i,j,k=0,l,m,n,o,p,q,r,s=f.hasData(a)&&f._data(a),t=s&&s.events;if(!s||!t)return;c&&c.type&&(d=c.handler,c=c.type);if(!c||typeof c=="string"&&c.charAt(0)==="."){c=c||"";for(h in t)f.event.remove(a,h+c);return}c=c.split(" ");while(h=c[k++]){r=h,q=null,l=h.indexOf(".")<0,m=[],l||(m=h.split("."),h=m.shift(),n=new RegExp("(^|\\.)"+f.map(m.slice(0).sort(),B).join("\\.(?:.*\\.)?")+"(\\.|$)")),p=t[h];if(!p)continue;if(!d){for(j=0;j<p.length;j++){q=p[j];if(l||n.test(q.namespace))f.event.remove(a,r,q.handler,j),p.splice(j--,1)}continue}o=f.event.special[h]||{};for(j=e||0;j<p.length;j++){q=p[j];if(d.guid===q.guid){if(l||n.test(q.namespace))e==null&&p.splice(j--,1),o.remove&&o.remove.call(a,q);if(e!=null)break}}if(p.length===0||e!=null&&p.length===1)(!o.teardown||o.teardown.call(a,m)===!1)&&f.removeEvent(a,h,s.handle),g=null,delete 
t[h]}if(f.isEmptyObject(t)){var u=s.handle;u&&(u.elem=null),delete s.events,delete s.handle,f.isEmptyObject(s)&&f.removeData(a,b,!0)}}},customEvent:{getData:!0,setData:!0,changeData:!0},trigger:function(c,d,e,g){var h=c.type||c,i=[],j;h.indexOf("!")>=0&&(h=h.slice(0,-1),j=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if(!!e&&!f.event.customEvent[h]||!!f.event.global[h]){c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.exclusive=j,c.namespace=i.join("."),c.namespace_re=new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)");if(g||!e)c.preventDefault(),c.stopPropagation();if(!e){f.each(f.cache,function(){var a=f.expando,b=this[a];b&&b.events&&b.events[h]&&f.event.trigger(c,d,b.handle.elem)});return}if(e.nodeType===3||e.nodeType===8)return;c.result=b,c.target=e,d=d!=null?f.makeArray(d):[],d.unshift(c);var k=e,l=h.indexOf(":")<0?"on"+h:"";do{var m=f._data(k,"handle");c.currentTarget=k,m&&m.apply(k,d),l&&f.acceptData(k)&&k[l]&&k[l].apply(k,d)===!1&&(c.result=!1,c.preventDefault()),k=k.parentNode||k.ownerDocument||k===c.target.ownerDocument&&a}while(k&&!c.isPropagationStopped());if(!c.isDefaultPrevented()){var n,o=f.event.special[h]||{};if((!o._default||o._default.call(e.ownerDocument,c)===!1)&&(h!=="click"||!f.nodeName(e,"a"))&&f.acceptData(e)){try{l&&e[h]&&(n=e[l],n&&(e[l]=null),f.event.triggered=h,e[h]())}catch(p){}n&&(e[l]=n),f.event.triggered=b}}return c.result}},handle:function(c){c=f.event.fix(c||a.event);var d=((f._data(this,"events")||{})[c.type]||[]).slice(0),e=!c.exclusive&&!c.namespace,g=Array.prototype.slice.call(arguments,0);g[0]=c,c.currentTarget=this;for(var h=0,i=d.length;h<i;h++){var j=d[h];if(e||c.namespace_re.test(j.namespace)){c.handler=j.handler,c.data=j.data,c.handleObj=j;var k=j.handler.apply(this,g);k!==b&&(c.result=k,k===!1&&(c.preventDefault(),c.stopPropagation()));if(c.isImmediatePropagationStopped())break}}return c.result},props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "),fix:function(a){if(a[f.expando])return a;var d=a;a=f.Event(d);for(var e=this.props.length,g;e;)g=this.props[--e],a[g]=d[g];a.target||(a.target=a.srcElement||c),a.target.nodeType===3&&(a.target=a.target.parentNode),!a.relatedTarget&&a.fromElement&&(a.relatedTarget=a.fromElement===a.target?a.toElement:a.fromElement);if(a.pageX==null&&a.clientX!=null){var h=a.target.ownerDocument||c,i=h.documentElement,j=h.body;a.pageX=a.clientX+(i&&i.scrollLeft||j&&j.scrollLeft||0)-(i&&i.clientLeft||j&&j.clientLeft||0),a.pageY=a.clientY+(i&&i.scrollTop||j&&j.scrollTop||0)-(i&&i.clientTop||j&&j.clientTop||0)}a.which==null&&(a.charCode!=null||a.keyCode!=null)&&(a.which=a.charCode!=null?a.charCode:a.keyCode),!a.metaKey&&a.ctrlKey&&(a.metaKey=a.ctrlKey),!a.which&&a.button!==b&&(a.which=a.button&1?1:a.button&2?3:a.button&4?2:0);return a},guid:1e8,proxy:f.proxy,special:{ready:{setup:f.bindReady,teardown:f.noop},live:{add:function(a){f.event.add(this,M(a.origType,a.selector),f.extend({},a,{handler:L,guid:a.handler.guid}))},remove:function(a){f.event.remove(this,M(a.origType,a.selector),a)}},beforeunload:{setup:function(a,b,c){f.isWindow(this)&&(this.onbeforeunload=c)},teardown:function(a,b){this.onbeforeunload===b&&(this.onbeforeunload=null)}}}},f.removeEvent=c.removeEventListener?function(a,b,c){a.removeEventListener&&a.removeEventListener(b,c,!1)}:function(a,b,c){a.detachEvent&&a.detachEvent("on"+b,c)},f.Event=function(a,b){if(!this.preventDefault)return new f.Event(a,b);a&&a.type?(this.originalEvent=a,this.type=a.type,this.isDefaultPrevented=a.defaultPrevented||a.returnValue===!1||a.getPreventDefault&&a.getPreventDefault()?D:C):this.type=a,b&&f.extend(this,b),this.timeStamp=f.now(),this[f.expando]=!0},f.Event.prototype={preventDefault:function(){this.isDefaultPrevented=D;var a=this.originalEvent;!a||(a.preventDefault?a.preventDefault():a.returnValue=!1)},stopPropagation:function(){this.isPropagationStopped=D;var a=this.originalEvent;!a||(a.stopPropagation&&a.stopPropagation(),a.cancelBubble=!0)},stopImmediatePropagation:function(){this.isImmediatePropagationStopped=D,this.stopPropagation()},isDefaultPrevented:C,isPropagationStopped:C,isImmediatePropagationStopped:C};var E=function(a){var b=a.relatedTarget,c=!1,d=a.type;a.type=a.data,b!==this&&(b&&(c=f.contains(this,b)),c||(f.event.handle.apply(this,arguments),a.type=d))},F=function(a){a.type=a.data,f.event.handle.apply(this,arguments)};f.each({mouseenter:"mouseover",mouseleave:"mouseout"},function(a,b){f.event.special[a]={setup:function(c){f.event.add(this,b,c&&c.selector?F:E,a)},teardown:function(a){f.event.remove(this,b,a&&a.selector?F:E)}}}),f.support.submitBubbles||(f.event.special.submit={setup:function(a,b){if(!f.nodeName(this,"form"))f.event.add(this,"click.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="submit"||c==="image")&&f(b).closest("form").length&&J("submit",this,arguments)}),f.event.add(this,"keypress.specialSubmit",function(a){var b=a.target,c=f.nodeName(b,"input")||f.nodeName(b,"button")?b.type:"";(c==="text"||c==="password")&&f(b).closest("form").length&&a.keyCode===13&&J("submit",this,arguments)});else return!1},teardown:function(a){f.event.remove(this,".specialSubmit")}});if(!f.support.changeBubbles){var G,H=function(a){var b=f.nodeName(a,"input")?a.type:"",c=a.value;b==="radio"||b==="checkbox"?c=a.checked:b==="select-multiple"?c=a.selectedIndex>-1?f.map(a.options,function(a){return a.selected}).join("-"):"":f.nodeName(a,"select")&&(c=a.selectedIndex);return c},I=function(c){var d=c.target,e,g;if(!!x.test(d.nodeName)&&!d.readOnly){e=f._data(d,"_change_data"),g=H(d),(c.type!=="focusout"||d.type!=="radio")&&f._data(d,"_change_data",g);if(e===b||g===e)return;if(e!=null||g)c.type="change",c.liveFired=b,f.event.trigger(c,arguments[1],d)}};f.event.special.change={filters:{focusout:I,beforedeactivate:I,click:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(c==="radio"||c==="checkbox"||f.nodeName(b,"select"))&&I.call(this,a)},keydown:function(a){var b=a.target,c=f.nodeName(b,"input")?b.type:"";(a.keyCode===13&&!f.nodeName(b,"textarea")||a.keyCode===32&&(c==="checkbox"||c==="radio")||c==="select-multiple")&&I.call(this,a)},beforeactivate:function(a){var b=a.target;f._data(b,"_change_data",H(b))}},setup:function(a,b){if(this.type==="file")return!1;for(var c in G)f.event.add(this,c+".specialChange",G[c]);return x.test(this.nodeName)},teardown:function(a){f.event.remove(this,".specialChange");return x.test(this.nodeName)}},G=f.event.special.change.filters,G.focus=G.beforeactivate}f.support.focusinBubbles||f.each({focus:"focusin",blur:"focusout"},function(a,b){function e(a){var c=f.event.fix(a);c.type=b,c.originalEvent={},f.event.trigger(c,null,c.target),c.isDefaultPrevented()&&a.preventDefault()}var d=0;f.event.special[b]={setup:function(){d++===0&&c.addEventListener(a,e,!0)},teardown:function(){--d===0&&c.removeEventListener(a,e,!0)}}}),f.each(["bind","one"],function(a,c){f.fn[c]=function(a,d,e){var g;if(typeof a=="object"){for(var h in a)this[c](h,d,a[h],e);return this}if(arguments.length===2||d===!1)e=d,d=b;c==="one"?(g=function(a){f(this).unbind(a,g);return e.apply(this,arguments)},g.guid=e.guid||f.guid++):g=e;if(a==="unload"&&c!=="one")this.one(a,d,e);else for(var i=0,j=this.length;i<j;i++)f.event.add(this[i],a,g,d);return this}}),f.fn.extend({unbind:function(a,b){if(typeof a=="object"&&!a.preventDefault)for(var c in a)this.unbind(c,a[c]);else for(var d=0,e=this.length;d<e;d++)f.event.remove(this[d],a,b);return this},delegate:function(a,b,c,d){return this.live(b,c,d,a)},undelegate:function(a,b,c){return arguments.length===0?this.unbind("live"):this.die(b,null,c,a)},trigger:function(a,b){return this.each(function(){f.event.trigger(a,b,this)})},triggerHandler:function(a,b){if(this[0])return f.event.trigger(a,b,this[0],!0)},toggle:function(a){var b=arguments,c=a.guid||f.guid++,d=0,e=function(c){var e=(f.data(this,"lastToggle"+a.guid)||0)%d;f.data(this,"lastToggle"+a.guid,e+1),c.preventDefault();return b[e].apply(this,arguments)||!1};e.guid=c;while(d<b.length)b[d++].guid=c;return this.click(e)},hover:function(a,b){return this.mouseenter(a).mouseleave(b||a)}});var K={focus:"focusin",blur:"focusout",mouseenter:"mouseover",mouseleave:"mouseout"};f.each(["live","die"],function(a,c){f.fn[c]=function(a,d,e,g){var h,i=0,j,k,l,m=g||this.selector,n=g?this:f(this.context);if(typeof a=="object"&&!a.preventDefault){for(var o in a)n[c](o,d,a[o],m);return this}if(c==="die"&&!a&&g&&g.charAt(0)==="."){n.unbind(g);return this}if(d===!1||f.isFunction(d))e=d||C,d=b;a=(a||"").split(" ");while((h=a[i++])!=null){j=w.exec(h),k="",j&&(k=j[0],h=h.replace(w,""));if(h==="hover"){a.push("mouseenter"+k,"mouseleave"+k);continue}l=h,K[h]?(a.push(K[h]+k),h=h+k):h=(K[h]||h)+k;if(c==="live")for(var p=0,q=n.length;p<q;p++)f.event.add(n[p],"live."+M(h,m),{data:d,selector:m,handler:e,origType:h,origHandler:e,preType:l});else n.unbind("live."+M(h,m),e)}return this}}),f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "),function(a,b){f.fn[b]=function(a,c){c==null&&(c=a,a=null);return arguments.length>0?this.bind(b,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0)}),function(){function u(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}if(i.nodeType===1){f||(i.sizcache=c,i.sizset=g);if(typeof b!="string"){if(i===b){j=!0;break}}else if(k.filter(b,[i]).length>0){j=i;break}}i=i[a]}d[g]=j}}}function t(a,b,c,d,e,f){for(var g=0,h=d.length;g<h;g++){var i=d[g];if(i){var j=!1;i=i[a];while(i){if(i.sizcache===c){j=d[i.sizset];break}i.nodeType===1&&!f&&(i.sizcache=c,i.sizset=g);if(i.nodeName.toLowerCase()===b){j=i;break}i=i[a]}d[g]=j}}}var a=/((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d=0,e=Object.prototype.toString,g=!1,h=!0,i=/\\/g,j=/\W/;[0,0].sort(function(){h=!1;return 0});var k=function(b,d,f,g){f=f||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return f;var i,j,n,o,q,r,s,t,u=!0,w=k.isXML(d),x=[],y=b;do{a.exec(""),i=a.exec(y);if(i){y=i[3],x.push(i[1]);if(i[2]){o=i[3];break}}}while(i);if(x.length>1&&m.exec(b))if(x.length===2&&l.relative[x[0]])j=v(x[0]+x[1],d);else{j=l.relative[x[0]]?[d]:k(x.shift(),d);while(x.length)b=x.shift(),l.relative[b]&&(b+=x.shift()),j=v(b,j)}else{!g&&x.length>1&&d.nodeType===9&&!w&&l.match.ID.test(x[0])&&!l.match.ID.test(x[x.length-1])&&(q=k.find(x.shift(),d,w),d=q.expr?k.filter(q.expr,q.set)[0]:q.set[0]);if(d){q=g?{expr:x.pop(),set:p(g)}:k.find(x.pop(),x.length===1&&(x[0]==="~"||x[0]==="+")&&d.parentNode?d.parentNode:d,w),j=q.expr?k.filter(q.expr,q.set):q.set,x.length>0?n=p(j):u=!1;while(x.length)r=x.pop(),s=r,l.relative[r]?s=x.pop():r="",s==null&&(s=d),l.relative[r](n,s,w)}else n=x=[]}n||(n=j),n||k.error(r||b);if(e.call(n)==="[object Array]")if(!u)f.push.apply(f,n);else if(d&&d.nodeType===1)for(t=0;n[t]!=null;t++)n[t]&&(n[t]===!0||n[t].nodeType===1&&k.contains(d,n[t]))&&f.push(j[t]);else for(t=0;n[t]!=null;t++)n[t]&&n[t].nodeType===1&&f.push(j[t]);else p(n,f);o&&(k(o,h,f,g),k.uniqueSort(f));return f};k.uniqueSort=function(a){if(r){g=h,a.sort(r);if(g)for(var b=1;b<a.length;b++)a[b]===a[b-1]&&a.splice(b--,1)}return a},k.matches=function(a,b){return k(a,null,null,b)},k.matchesSelector=function(a,b){return k(b,null,null,[a]).length>0},k.find=function(a,b,c){var d;if(!a)return[];for(var e=0,f=l.order.length;e<f;e++){var g,h=l.order[e];if(g=l.leftMatch[h].exec(a)){var j=g[1];g.splice(1,1);if(j.substr(j.length-1)!=="\\"){g[1]=(g[1]||"").replace(i,""),d=l.find[h](g,b,c);if(d!=null){a=a.replace(l.match[h],"");break}}}}d||(d=typeof b.getElementsByTagName!="undefined"?b.getElementsByTagName("*"):[]);return{set:d,expr:a}},k.filter=function(a,c,d,e){var f,g,h=a,i=[],j=c,m=c&&c[0]&&k.isXML(c[0]);while(a&&c.length){for(var n in l.filter)if((f=l.leftMatch[n].exec(a))!=null&&f[2]){var o,p,q=l.filter[n],r=f[1];g=!1,f.splice(1,1);if(r.substr(r.length-1)==="\\")continue;j===i&&(i=[]);if(l.preFilter[n]){f=l.preFilter[n](f,j,d,i,e,m);if(!f)g=o=!0;else if(f===!0)continue}if(f)for(var s=0;(p=j[s])!=null;s++)if(p){o=q(p,f,s,j);var t=e^!!o;d&&o!=null?t?g=!0:j[s]=!1:t&&(i.push(p),g=!0)}if(o!==b){d||(j=i),a=a.replace(l.match[n],"");if(!g)return[];break}}if(a===h)if(g==null)k.error(a);else break;h=a}return j},k.error=function(a){throw"Syntax error, unrecognized expression: "+a};var l=k.selectors={order:["ID","NAME","TAG"],match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/,NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/,ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/,TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/,CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/,POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/,PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/},leftMatch:{},attrMap:{"class":"className","for":"htmlFor"},attrHandle:{href:function(a){return a.getAttribute("href")},type:function(a){return a.getAttribute("type")}},relative:{"+":function(a,b){var c=typeof b=="string",d=c&&!j.test(b),e=c&&!d;d&&(b=b.toLowerCase());for(var f=0,g=a.length,h;f<g;f++)if(h=a[f]){while((h=h.previousSibling)&&h.nodeType!==1);a[f]=e||h&&h.nodeName.toLowerCase()===b?h||!1:h===b}e&&k.filter(b,a,!0)},">":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!j.test(b)){b=b.toLowerCase();for(;e<f;e++){c=a[e];if(c){var g=c.parentNode;a[e]=g.nodeName.toLowerCase()===b?g:!1}}}else{for(;e<f;e++)c=a[e],c&&(a[e]=d?c.parentNode:c.parentNode===b);d&&k.filter(b,a,!0)}},"":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("parentNode",b,f,a,e,c)},"~":function(a,b,c){var e,f=d++,g=u;typeof b=="string"&&!j.test(b)&&(b=b.toLowerCase(),e=b,g=t),g("previousSibling",b,f,a,e,c)}},find:{ID:function(a,b,c){if(typeof b.getElementById!="undefined"&&!c){var d=b.getElementById(a[1]);return d&&d.parentNode?[d]:[]}},NAME:function(a,b){if(typeof b.getElementsByName!="undefined"){var c=[],d=b.getElementsByName(a[1]);for(var e=0,f=d.length;e<f;e++)d[e].getAttribute("name")===a[1]&&c.push(d[e]);return c.length===0?null:c}},TAG:function(a,b){if(typeof b.getElementsByTagName!="undefined")return b.getElementsByTagName(a[1])}},preFilter:{CLASS:function(a,b,c,d,e,f){a=" "+a[1].replace(i,"")+" ";if(f)return a;for(var g=0,h;(h=b[g])!=null;g++)h&&(e^(h.className&&(" "+h.className+" ").replace(/[\t\n\r]/g," ").indexOf(a)>=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(i,"")},TAG:function(a,b){return a[1].replace(i,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||k.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&k.error(a[0]);a[0]=d++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(i,"");!f&&l.attrMap[g]&&(a[1]=l.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(i,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=k(b[3],null,null,c);else{var g=k.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(l.match.POS.test(b[0])||l.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!k(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return b<c[3]-0},gt:function(a,b,c){return b>c[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=l.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||k.getText([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h<i;h++)if(g[h]===a)return!1;return!0}k.error(e)},CHILD:function(a,b){var c=b[1],d=a;switch(c){case"only":case"first":while(d=d.previousSibling)if(d.nodeType===1)return!1;if(c==="first")return!0;d=a;case"last":while(d=d.nextSibling)if(d.nodeType===1)return!1;return!0;case"nth":var e=b[2],f=b[3];if(e===1&&f===0)return!0;var g=b[0],h=a.parentNode;if(h&&(h.sizcache!==g||!a.nodeIndex)){var i=0;for(d=h.firstChild;d;d=d.nextSibling)d.nodeType===1&&(d.nodeIndex=++i);h.sizcache=g}var j=a.nodeIndex-f;return e===0?j===0:j%e===0&&j/e>=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=l.attrHandle[c]?l.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=l.setFilters[e];if(f)return f(a,c,b,d)}}},m=l.match.POS,n=function(a,b){return"\\"+(b-0+1)};for(var o in l.match)l.match[o]=new RegExp(l.match[o].source+/(?![^\[]*\])(?![^\(]*\))/.source),l.leftMatch[o]=new RegExp(/(^(?:.|\r|\n)*?)/.source+l.match[o].source.replace(/\\(\d+)/g,n));var p=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(q){p=function(a,b){var c=0,d=b||[];if(e.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var f=a.length;c<f;c++)d.push(a[c]);else for(;a[c];c++)d.push(a[c]);return d}}var r,s;c.documentElement.compareDocumentPosition?r=function(a,b){if(a===b){g=!0;return 0}if(!a.compareDocumentPosition||!b.compareDocumentPosition)return a.compareDocumentPosition?-1:1;return a.compareDocumentPosition(b)&4?-1:1}:(r=function(a,b){if(a===b){g=!0;return 0}if(a.sourceIndex&&b.sourceIndex)return a.sourceIndex-b.sourceIndex;var c,d,e=[],f=[],h=a.parentNode,i=b.parentNode,j=h;if(h===i)return s(a,b);if(!h)return-1;if(!i)return 1;while(j)e.unshift(j),j=j.parentNode;j=i;while(j)f.unshift(j),j=j.parentNode;c=e.length,d=f.length;for(var k=0;k<c&&k<d;k++)if(e[k]!==f[k])return s(e[k],f[k]);return k===c?s(a,f[k],-1):s(e[k],b,1)},s=function(a,b,c){if(a===b)return c;var d=a.nextSibling;while(d){if(d===b)return-1;d=d.nextSibling}return 1}),k.getText=function(a){var b="",c;for(var d=0;a[d];d++)c=a[d],c.nodeType===3||c.nodeType===4?b+=c.nodeValue:c.nodeType!==8&&(b+=k.getText(c.childNodes));return b},function(){var a=c.createElement("div"),d="script"+(new Date).getTime(),e=c.documentElement;a.innerHTML="<a name='"+d+"'/>",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(l.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},l.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(l.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="<a href='#'></a>",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(l.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=k,b=c.createElement("div"),d="__sizzle__";b.innerHTML="<p class='TEST'></p>";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){k=function(b,e,f,g){e=e||c;if(!g&&!k.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return p(e.getElementsByTagName(b),f);if(h[2]&&l.find.CLASS&&e.getElementsByClassName)return p(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return p([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return p([],f);if(i.id===h[3])return p([i],f)}try{return p(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var m=e,n=e.getAttribute("id"),o=n||d,q=e.parentNode,r=/^\s*[+~]/.test(b);n?o=o.replace(/'/g,"\\$&"):e.setAttribute("id",o),r&&q&&(e=e.parentNode);try{if(!r||q)return p(e.querySelectorAll("[id='"+o+"'] "+b),f)}catch(s){}finally{n||m.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)k[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}k.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!k.isXML(a))try{if(e||!l.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return k(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="<div class='test e'></div><div class='test'></div>";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;l.order.splice(1,0,"CLASS"),l.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?k.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:k.contains=function(){return!1},k.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var v=function(a,b){var c,d=[],e="",f=b.nodeType?[b]:b;while(c=l.match.PSEUDO.exec(a))e+=c[0],a=a.replace(l.match.PSEUDO,"");a=l.relative[a]?a+"*":a;for(var g=0,h=f.length;g<h;g++)k(a,f[g],d);return k.filter(e,d)};f.find=k,f.expr=k.selectors,f.expr[":"]=f.expr.filters,f.unique=k.uniqueSort,f.text=k.getText,f.isXMLDoc=k.isXML,f.contains=k.contains}();var N=/Until$/,O=/^(?:parents|prevUntil|prevAll)/,P=/,/,Q=/^.[^:#\[\.,]*$/,R=Array.prototype.slice,S=f.expr.match.POS,T={children:!0,contents:!0,next:!0,prev:!0};f.fn.extend({find:function(a){var b=this,c,d;if(typeof a!="string")return f(a).filter(function(){for(c=0,d=b.length;c<d;c++)if(f.contains(b[c],this))return!0});var e=this.pushStack("","find",a),g,h,i;for(c=0,d=this.length;c<d;c++){g=e.length,f.find(a,this[c],e);if(c>0)for(h=g;h<e.length;h++)for(i=0;i<g;i++)if(e[i]===e[h]){e.splice(h--,1);break}}return e},has:function(a){var b=f(a);return this.filter(function(){for(var a=0,c=b.length;a<c;a++)if(f.contains(this,b[a]))return!0})},not:function(a){return this.pushStack(V(this,a,!1),"not",a)},filter:function(a){return this.pushStack(V(this,a,!0),"filter",a)},is:function(a){return!!a&&(typeof a=="string"?f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h,i,j={},k=1;if(g&&a.length){for(d=0,e=a.length;d<e;d++)i=a[d],j[i]||(j[i]=S.test(i)?f(i,b||this.context):i);while(g&&g.ownerDocument&&g!==b){for(i in j)h=j[i],(h.jquery?h.index(g)>-1:f(g).is(h))&&c.push({selector:i,elem:g,level:k});g=g.parentNode,k++}}return c}var l=S.test(a)||typeof a!="string"?f(a,b||this.context):0;for(d=0,e=this.length;d<e;d++){g=this[d];while(g){if(l?l.index(g)>-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(U(c[0])||U(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c),g=R.call(arguments);N.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!T[a]?f.unique(e):e,(this.length>1||P.test(d))&&O.test(a)&&(e=e.reverse());return this.pushStack(e,a,g.join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/<tbody/i,_=/<|&#?\w+;/,ba=/<(?:script|object|embed|option|style)/i,bb=/checked\s*(?:[^=]|=\s*.checked.)/i,bc=/\/(java|ecma)script/i,bd=/^\s*<!(?:\[CDATA\[|\-\-)/,be={option:[1,"<select multiple='multiple'>","</select>"],legend:[1,"<fieldset>","</fieldset>"],thead:[1,"<table>","</table>"],tr:[2,"<table><tbody>","</tbody></table>"],td:[3,"<table><tbody><tr>","</tr></tbody></table>"],col:[2,"<table><tbody></tbody><colgroup>","</colgroup></table>"],area:[1,"<map>","</map>"],_default:[0,"",""]};be.optgroup=be.option,be.tbody=be.tfoot=be.colgroup=be.caption=be.thead,be.th=be.td,f.support.htmlSerialize||(be._default=[1,"div<div>","</div>"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){return this.each(function(){f(this).wrapAll(a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f(arguments[0]);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f(arguments[0]).toArray());return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function(){for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!be[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1></$2>");try{for(var c=0,d=this.length;c<d;c++)this[c].nodeType===1&&(f.cleanData(this[c].getElementsByTagName("*")),this[c].innerHTML=a)}catch(e){this.empty().append(a)}}else f.isFunction(a)?this.each(function(b){var c=f(this);c.html(a.call(this,b,c.html()))}):this.empty().append(a);return this},replaceWith:function(a){if(this[0]&&this[0].parentNode){if(f.isFunction(a))return this.each(function(b){var c=f(this),d=c.html();c.replaceWith(a.call(this,b,d))});typeof a!="string"&&(a=f(a).detach());return this.each(function(){var b=this.nextSibling,c=this.parentNode;f(this).remove(),b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a),"replaceWith",a):this},detach:function(a){return this.remove(a,!0)},domManip:function(a,c,d){var e,g,h,i,j=a[0],k=[];if(!f.support.checkClone&&arguments.length===3&&typeof j=="string"&&bb.test(j))return this.each(function(){f(this).domManip(a,c,d,!0)});if(f.isFunction(j))return this.each(function(e){var g=f(this);a[0]=j.call(this,e,c?g.html():b),g.domManip(a,c,d)});if(this[0]){i=j&&j.parentNode,f.support.parentNode&&i&&i.nodeType===11&&i.childNodes.length===this.length?e={fragment:i}:e=f.buildFragment(a,this,k),h=e.fragment,h.childNodes.length===1?g=h=h.firstChild:g=h.firstChild;if(g){c=c&&f.nodeName(g,"tr");for(var l=0,m=this.length,n=m-1;l<m;l++)d.call(c?bf(this[l],g):this[l],e.cacheable||m>1&&l<n?f.clone(h,!0,!0):h)}k.length&&f.each(k,bl)}return this}}),f.buildFragment=function(a,b,d){var e,g,h,i;b&&b[0]&&(i=b[0].ownerDocument||b[0]),i.createDocumentFragment||(i=c),a.length===1&&typeof a[0]=="string"&&a[0].length<512&&i===c&&a[0].charAt(0)==="<"&&!ba.test(a[0])&&(f.support.checkClone||!bb.test(a[0]))&&(g=!0,h=f.fragments[a[0]],h&&h!==1&&(e=h)),e||(e=i.createDocumentFragment(),f.clean
(a,i,e,d)),g&&(f.fragments[a[0]]=h?e:1);return{fragment:e,cacheable:g}},f.fragments={},f.each({appendTo:"append",prependTo:"prepend",insertBefore:"before",insertAfter:"after",replaceAll:"replaceWith"},function(a,b){f.fn[a]=function(c){var d=[],e=f(c),g=this.length===1&&this[0].parentNode;if(g&&g.nodeType===11&&g.childNodes.length===1&&e.length===1){e[b](this[0]);return this}for(var h=0,i=e.length;h<i;h++){var j=(h>0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d=a.cloneNode(!0),e,g,h;if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bh(a,d),e=bi(a),g=bi(d);for(h=0;e[h];++h)g[h]&&bh(e[h],g[h])}if(b){bg(a,d);if(c){e=bi(a),g=bi(d);for(h=0;e[h];++h)bg(e[h],g[h])}}e=g=null;return d},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1></$2>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=be[l]||be._default,n=m[0],o=b.createElement("div");o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]==="<table>"&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i<r;i++)bk(k[i]);else bk(k);k.nodeType?h.push(k):h=f.merge(h,k)}if(d){g=function(a){return!a.type||bc.test(a.type)};for(j=0;h[j];j++)if(e&&f.nodeName(h[j],"script")&&(!h[j].type||h[j].type.toLowerCase()==="text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]);else{if(h[j].nodeType===1){var s=f.grep(h[j].getElementsByTagName("script"),g);h.splice.apply(h,[j+1,0].concat(s))}d.appendChild(h[j])}}return h},cleanData:function(a){var b,c,d=f.cache,e=f.expando,g=f.event.special,h=f.support.deleteExpando;for(var i=0,j;(j=a[i])!=null;i++){if(j.nodeName&&f.noData[j.nodeName.toLowerCase()])continue;c=j[f.expando];if(c){b=d[c]&&d[c][e];if(b&&b.events){for(var k in b.events)g[k]?f.event.remove(j,k):f.removeEvent(j,k,b.handle);b.handle&&(b.handle.elem=null)}h?delete j[f.expando]:j.removeAttribute&&j.removeAttribute(f.expando),delete d[c]}}}});var bm=/alpha\([^)]*\)/i,bn=/opacity=([^)]*)/,bo=/([A-Z]|^ms)/g,bp=/^-?\d+(?:px)?$/i,bq=/^-?\d/,br=/^([\-+])=([\-+.\de]+)/,bs={position:"absolute",visibility:"hidden",display:"block"},bt=["Left","Right"],bu=["Top","Bottom"],bv,bw,bx;f.fn.css=function(a,c){if(arguments.length===2&&c===b)return this;return f.access(this,a,c,!0,function(a,c,d){return d!==b?f.style(a,c,d):f.css(a,c)})},f.extend({cssHooks:{opacity:{get:function(a,b){if(b){var c=bv(a,"opacity","opacity");return c===""?"1":c}return a.style.opacity}}},cssNumber:{fillOpacity:!0,fontWeight:!0,lineHeight:!0,opacity:!0,orphans:!0,widows:!0,zIndex:!0,zoom:!0},cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"},style:function(a,c,d,e){if(!!a&&a.nodeType!==3&&a.nodeType!==8&&!!a.style){var g,h,i=f.camelCase(c),j=a.style,k=f.cssHooks[i];c=f.cssProps[i]||i;if(d===b){if(k&&"get"in k&&(g=k.get(a,!1,e))!==b)return g;return j[c]}h=typeof d,h==="string"&&(g=br.exec(d))&&(d=+(g[1]+1)*+g[2]+parseFloat(f.css(a,c)),h="number");if(d==null||h==="number"&&isNaN(d))return;h==="number"&&!f.cssNumber[i]&&(d+="px");if(!k||!("set"in k)||(d=k.set(a,d))!==b)try{j[c]=d}catch(l){}}},css:function(a,c,d){var e,g;c=f.camelCase(c),g=f.cssHooks[c],c=f.cssProps[c]||c,c==="cssFloat"&&(c="float");if(g&&"get"in g&&(e=g.get(a,!0,d))!==b)return e;if(bv)return bv(a,c)},swap:function(a,b,c){var d={};for(var e in b)d[e]=a.style[e],a.style[e]=b[e];c.call(a);for(e in b)a.style[e]=d[e]}}),f.curCSS=f.css,f.each(["height","width"],function(a,b){f.cssHooks[b]={get:function(a,c,d){var e;if(c){if(a.offsetWidth!==0)return by(a,b,d);f.swap(a,bs,function(){e=by(a,b,d)});return e}},set:function(a,b){if(!bp.test(b))return b;b=parseFloat(b);if(b>=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return bn.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNaN(b)?"":"alpha(opacity="+b*100+")",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bm,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bm.test(g)?g.replace(bm,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bv(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bw=function(a,c){var d,e,g;c=c.replace(bo,"-$1").toLowerCase();if(!(e=a.ownerDocument.defaultView))return b;if(g=e.getComputedStyle(a,null))d=g.getPropertyValue(c),d===""&&!f.contains(a.ownerDocument.documentElement,a)&&(d=f.style(a,c));return d}),c.documentElement.currentStyle&&(bx=function(a,b){var c,d=a.currentStyle&&a.currentStyle[b],e=a.runtimeStyle&&a.runtimeStyle[b],f=a.style;!bp.test(d)&&bq.test(d)&&(c=f.left,e&&(a.runtimeStyle.left=a.currentStyle.left),f.left=b==="fontSize"?"1em":d||0,d=f.pixelLeft+"px",f.left=c,e&&(a.runtimeStyle.left=e));return d===""?"auto":d}),bv=bw||bx,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bz=/%20/g,bA=/\[\]$/,bB=/\r?\n/g,bC=/#.*$/,bD=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bE=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bF=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bG=/^(?:GET|HEAD)$/,bH=/^\/\//,bI=/\?/,bJ=/<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi,bK=/^(?:select|textarea)/i,bL=/\s+/,bM=/([?&])_=[^&]*/,bN=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bO=f.fn.load,bP={},bQ={},bR,bS,bT=["*/"]+["*"];try{bR=e.href}catch(bU){bR=c.createElement("a"),bR.href="",bR=bR.href}bS=bN.exec(bR.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bO)return bO.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("<div>").append(c.replace(bJ,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bK.test(this.nodeName)||bE.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bB,"\r\n")}}):{name:b.name,value:c.replace(bB,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.bind(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?bX(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),bX(a,b);return a},ajaxSettings:{url:bR,isLocal:bF.test(bS[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bT},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bV(bP),ajaxTransport:bV(bQ),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?bZ(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=b$(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.resolveWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f._Deferred(),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bD.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.done,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bC,"").replace(bH,bS[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bL),d.crossDomain==null&&(r=bN.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bS[1]&&r[2]==bS[2]&&(r[3]||(r[1]==="http:"?80:443))==(bS[3]||(bS[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),bW(bP,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bG.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bI.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bM,"$1_="+x);d.url=y+(y===d.url?(bI.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bT+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=bW(bQ,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){s<2?w(-1,z):f.error(z)}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)bY(g,a[g],c,e);return d.join("&").replace(bz,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var b_=f.now(),ca=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+b_++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ca.test(b.url)||e&&ca.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ca,l),b.url===j&&(e&&(k=k.replace(ca,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cb=a.ActiveXObject?function(){for(var a in cd)cd[a](0,1)}:!1,cc=0,cd;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ce()||cf()}:ce,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cb&&delete cd[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cc,cb&&(cd||(cd={},f(a).unload(cb)),cd[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var cg={},ch,ci,cj=/^(?:toggle|show|hide)$/,ck=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cl,cm=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cn;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cq("show",3),a,b,c);for(var g=0,h=this.length;g<h;g++)d=this[g],d.style&&(e=d.style.display,!f._data(d,"olddisplay")&&e==="none"&&(e=d.style.display=""),e===""&&f.css(d,"display")==="none"&&f._data(d,"olddisplay",cr(d.nodeName)));for(g=0;g<h;g++){d=this[g];if(d.style){e=d.style.display;if(e===""||e==="none")d.style.display=f._data(d,"olddisplay")||""}}return this},hide:function(a,b,c){if(a||a===0)return this.animate(cq("hide",3),a,b,c);for(var d=0,e=this.length;d<e;d++)if(this[d].style){var g=f.css(this[d],"display");g!=="none"&&!f._data(this[d],"olddisplay")&&f._data(this[d],"olddisplay",g)}for(d=0;d<e;d++)this[d].style&&(this[d].style.display="none");return this},_toggle:f.fn.toggle,toggle:function(a,b,c){var d=typeof a=="boolean";f.isFunction(a)&&f.isFunction(b)?this._toggle.apply(this,arguments):a==null||d?this.each(function(){var b=d?a:f(this).is(":hidden");f(this)[b?"show":"hide"]()}):this.animate(cq("toggle",3),a,b,c);return this},fadeTo:function(a,b,c,d){return this.filter(":hidden").css("opacity",0).show().end().animate({opacity:b},a,c,d)},animate:function(a,b,c,d){var e=f.speed(b,c,d);if(f.isEmptyObject(a))return this.each(e.complete,[!1]);a=f.extend({},a);return this[e.queue===!1?"each":"queue"](function(){e.queue===!1&&f._mark(this);var b=f.extend({},e),c=this.nodeType===1,d=c&&f(this).is(":hidden"),g,h,i,j,k,l,m,n,o;b.animatedProperties={};for(i in a){g=f.camelCase(i),i!==g&&(a[g]=a[i],delete a[i]),h=a[g],f.isArray(h)?(b.animatedProperties[g]=h[1],h=a[g]=h[0]):b.animatedProperties[g]=b.specialEasing&&b.specialEasing[g]||b.easing||"swing";if(h==="hide"&&d||h==="show"&&!d)return b.complete.call(this);c&&(g==="height"||g==="width")&&(b.overflow=[this.style.overflow,this.style.overflowX,this.style.overflowY],f.css(this,"display")==="inline"&&f.css(this,"float")==="none"&&(f.support.inlineBlockNeedsLayout?(j=cr(this.nodeName),j==="inline"?this.style.display="inline-block":(this.style.display="inline",this.style.zoom=1)):this.style.display="inline-block"))}b.overflow!=null&&(this.style.overflow="hidden");for(i in a)k=new f.fx(this,b,i),h=a[i],cj.test(h)?k[h==="toggle"?d?"show":"hide":h]():(l=ck.exec(h),m=k.cur(),l?(n=parseFloat(l[2]),o=l[3]||(f.cssNumber[i]?"":"px"),o!=="px"&&(f.style(this,i,(n||1)+o),m=(n||1)/k.cur()*m,f.style(this,i,m+o)),l[1]&&(n=(l[1]==="-="?-1:1)*n+m),k.custom(m,n,o)):k.custom(m,h,""));return!0})},stop:function(a,b){a&&this.queue([]),this.each(function(){var a=f.timers,c=a.length;b||f._unmark(!0,this);while(c--)a[c].elem===this&&(b&&a[c](!0),a.splice(c,1))}),b||this.dequeue();return this}}),f.each({slideDown:cq("show",1),slideUp:cq("hide",1),slideToggle:cq("toggle",1),fadeIn:{opacity:"show"},fadeOut:{opacity:"hide"},fadeToggle:{opacity:"toggle"}},function(a,b){f.fn[a]=function(a,c,d){return this.animate(b,a,c,d)}}),f.extend({speed:function(a,b,c){var d=a&&typeof a=="object"?f.extend({},a):{complete:c||!c&&b||f.isFunction(a)&&a,duration:a,easing:c&&b||b&&!f.isFunction(b)&&b};d.duration=f.fx.off?0:typeof d.duration=="number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default,d.old=d.complete,d.complete=function(a){f.isFunction(d.old)&&d.old.call(this),d.queue!==!1?f.dequeue(this):a!==!1&&f._unmark(this)};return d},easing:{linear:function(a,b,c,d){return c+d*a},swing:function(a,b,c,d){return(-Math.cos(a*Math.PI)/2+.5)*d+c}},timers:[],fx:function(a,b,c){this.options=b,this.elem=a,this.prop=c,b.orig=b.orig||{}}}),f.fx.prototype={update:function(){this.options.step&&this.options.step.call(this.elem,this.now,this),(f.fx.step[this.prop]||f.fx.step._default)(this)},cur:function(){if(this.elem[this.prop]!=null&&(!this.elem.style||this.elem.style[this.prop]==null))return this.elem[this.prop];var a,b=f.css(this.elem,this.prop);return isNaN(a=parseFloat(b))?!b||b==="auto"?0:b:a},custom:function(a,b,c){function g(a){return d.step(a)}var d=this,e=f.fx;this.startTime=cn||co(),this.start=a,this.end=b,this.unit=c||this.unit||(f.cssNumber[this.prop]?"":"px"),this.now=this.start,this.pos=this.state=0,g.elem=this.elem,g()&&f.timers.push(g)&&!cl&&(cl=setInterval(e.tick,e.interval))},show:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.show=!0,this.custom(this.prop==="width"||this.prop==="height"?1:0,this.cur()),f(this.elem).show()},hide:function(){this.options.orig[this.prop]=f.style(this.elem,this.prop),this.options.hide=!0,this.custom(this.cur(),0)},step:function(a){var b=cn||co(),c=!0,d=this.elem,e=this.options,g,h;if(a||b>=e.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),e.animatedProperties[this.prop]=!0;for(g in e.animatedProperties)e.animatedProperties[g]!==!0&&(c=!1);if(c){e.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){d.style["overflow"+b]=e.overflow[a]}),e.hide&&f(d).hide();if(e.hide||e.show)for(var i in e.animatedProperties)f.style(d,i,e.orig[i]);e.complete.call(d)}return!1}e.duration==Infinity?this.now=b:(h=b-this.startTime,this.state=h/e.duration,this.pos=f.easing[e.animatedProperties[this.prop]](this.state,h,0,1,e.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){for(var a=f.timers,b=0;b<a.length;++b)a[b]()||a.splice(b--,1);a.length||f.fx.stop()},interval:13,stop:function(){clearInterval(cl),cl=null},speeds:{slow:600,fast:200,_default:400},step:{opacity:function(a){f.style(a.elem,"opacity",a.now)},_default:function(a){a.elem.style&&a.elem.style[a.prop]!=null?a.elem.style[a.prop]=(a.prop==="width"||a.prop==="height"?Math.max(0,a.now):a.now)+a.unit:a.elem[a.prop]=a.now}}}),f.expr&&f.expr.filters&&(f.expr.filters.animated=function(a){return f.grep(f.timers,function(b){return a===b.elem}).length});var cs=/^t(?:able|d|h)$/i,ct=/^(?:body|html)$/i;"getBoundingClientRect"in c.documentElement?f.fn.offset=function(a){var b=this[0],c;if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);try{c=b.getBoundingClientRect()}catch(d){}var e=b.ownerDocument,g=e.documentElement;if(!c||!f.contains(g,b))return c?{top:c.top,left:c.left}:{top:0,left:0};var h=e.body,i=cu(e),j=g.clientTop||h.clientTop||0,k=g.clientLeft||h.clientLeft||0,l=i.pageYOffset||f.support.boxModel&&g.scrollTop||h.scrollTop,m=i.pageXOffset||f.support.boxModel&&g.scrollLeft||h.scrollLeft,n=c.top+l-j,o=c.left+m-k;return{top:n,left:o}}:f.fn.offset=function(a){var b=this[0];if(a)return this.each(function(b){f.offset.setOffset(this,a,b)});if(!b||!b.ownerDocument)return null;if(b===b.ownerDocument.body)return f.offset.bodyOffset(b);f.offset.initialize();var c,d=b.offsetParent,e=b,g=b.ownerDocument,h=g.documentElement,i=g.body,j=g.defaultView,k=j?j.getComputedStyle(b,null):b.currentStyle,l=b.offsetTop,m=b.offsetLeft;while((b=b.parentNode)&&b!==i&&b!==h){if(f.offset.supportsFixedPosition&&k.position==="fixed")break;c=j?j.getComputedStyle(b,null):b.currentStyle,l-=b.scrollTop,m-=b.scrollLeft,b===d&&(l+=b.offsetTop,m+=b.offsetLeft,f.offset.doesNotAddBorder&&(!f.offset.doesAddBorderForTableAndCells||!cs.test(b.nodeName))&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),e=d,d=b.offsetParent),f.offset.subtractsBorderForOverflowNotVisible&&c.overflow!=="visible"&&(l+=parseFloat(c.borderTopWidth)||0,m+=parseFloat(c.borderLeftWidth)||0),k=c}if(k.position==="relative"||k.position==="static")l+=i.offsetTop,m+=i.offsetLeft;f.offset.supportsFixedPosition&&k.position==="fixed"&&(l+=Math.max(h.scrollTop,i.scrollTop),m+=Math.max(h.scrollLeft,i.scrollLeft));return{top:l,left:m}},f.offset={initialize:function(){var a=c.body,b=c.createElement("div"),d,e,g,h,i=parseFloat(f.css(a,"marginTop"))||0,j="<div style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;'><div></div></div><table style='position:absolute;top:0;left:0;margin:0;border:5px solid #000;padding:0;width:1px;height:1px;' cellpadding='0' cellspacing='0'><tr><td></td></tr></table>";f.extend(b.style,{position:"absolute",top:0,left:0,margin:0,border:0,width:"1px",height:"1px",visibility:"hidden"}),b.innerHTML=j,a.insertBefore(b,a.firstChild),d=b.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,this.doesNotAddBorder=e.offsetTop!==5,this.doesAddBorderForTableAndCells=h.offsetTop===5,e.style.position="fixed",e.style.top="20px",this.supportsFixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",this.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,this.doesNotIncludeMarginInBodyOffset=a.offsetTop!==i,a.removeChild(b),f.offset.initialize=f.noop},bodyOffset:function(a){var b=a.offsetTop,c=a.offsetLeft;f.offset.initialize(),f.offset.doesNotIncludeMarginInBodyOffset&&(b+=parseFloat(f.css(a,"marginTop"))||0,c+=parseFloat(f.css(a,"marginLeft"))||0);return{top:b,left:c}},setOffset:function(a,b,c){var d=f.css(a,"position");d==="static"&&(a.style.position="relative");var e=f(a),g=e.offset(),h=f.css(a,"top"),i=f.css(a,"left"),j=(d==="absolute"||d==="fixed")&&f.inArray("auto",[h,i])>-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=ct.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!ct.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cu(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cu(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a&&a.style?parseFloat(f.css(a,d,"padding")):null},f.fn["outer"+c]=function(a){var b=this[0];return b&&b.style?parseFloat(f.css(b,d,a?"margin":"border")):null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNaN(j)?i:j}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f})(window);

/* jquery/jquery.corner.js */

/*!
 * jQuery corner plugin: simple corner rounding
 * Examples and documentation at: http://jquery.malsup.com/corner/
 * version 2.09 (11-MAR-2010)
 * Requires jQuery v1.3.2 or later
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 * Authors: Dave Methvin and Mike Alsup
 */

/**
 *  corner() takes a single string argument:  $('#myDiv').corner("effect corners width")
 *
 *  effect:  name of the effect to apply, such as round, bevel, notch, bite, etc (default is round). 
 *  corners: one or more of: top, bottom, tr, tl, br, or bl.  (default is all corners)
 *  width:   width of the effect; in the case of rounded corners this is the radius. 
 *           specify this value using the px suffix such as 10px (yes, it must be pixels).
 */
;(function($) { 

var style = document.createElement('div').style;
var moz = style['MozBorderRadius'] !== undefined;
var webkit = style['WebkitBorderRadius'] !== undefined;
var radius = style['borderRadius'] !== undefined || style['BorderRadius'] !== undefined;
var mode = document.documentMode || 0;
var noBottomFold = $.browser.msie && (($.browser.version < 8 && !mode) || mode < 8);

var expr = $.browser.msie && (function() {
    var div = document.createElement('div');
    try { div.style.setExpression('width','0+0'); div.style.removeExpression('width'); }
    catch(e) { return false; }
    return true;
})();
    
function sz(el, p) { 
    return parseInt($.css(el,p))||0; 
};
function hex2(s) {
    var s = parseInt(s).toString(16);
    return ( s.length < 2 ) ? '0'+s : s;
};
function gpc(node) {
    while(node) {
        var v = $.css(node,'backgroundColor');
        if (v && v != 'transparent' && v != 'rgba(0, 0, 0, 0)') {
	        if (v.indexOf('rgb') >= 0) { 
	            var rgb = v.match(/\d+/g); 
	            return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
	        }
            return v;
		}
		node = node.parentNode; // keep walking if transparent
    }
    return '#ffffff';
};

function getWidth(fx, i, width) {
    switch(fx) {
    case 'round':  return Math.round(width*(1-Math.cos(Math.asin(i/width))));
    case 'cool':   return Math.round(width*(1+Math.cos(Math.asin(i/width))));
    case 'sharp':  return Math.round(width*(1-Math.cos(Math.acos(i/width))));
    case 'bite':   return Math.round(width*(Math.cos(Math.asin((width-i-1)/width))));
    case 'slide':  return Math.round(width*(Math.atan2(i,width/i)));
    case 'jut':    return Math.round(width*(Math.atan2(width,(width-i-1))));
    case 'curl':   return Math.round(width*(Math.atan(i)));
    case 'tear':   return Math.round(width*(Math.cos(i)));
    case 'wicked': return Math.round(width*(Math.tan(i)));
    case 'long':   return Math.round(width*(Math.sqrt(i)));
    case 'sculpt': return Math.round(width*(Math.log((width-i-1),width)));
	case 'dogfold':
    case 'dog':    return (i&1) ? (i+1) : width;
    case 'dog2':   return (i&2) ? (i+1) : width;
    case 'dog3':   return (i&3) ? (i+1) : width;
    case 'fray':   return (i%2)*width;
    case 'notch':  return width; 
	case 'bevelfold':
    case 'bevel':  return i+1;
    }
};

$.fn.corner = function(options) {
    // in 1.3+ we can fix mistakes with the ready state
	if (this.length == 0) {
        if (!$.isReady && this.selector) {
            var s = this.selector, c = this.context;
            $(function() {
                $(s,c).corner(options);
            });
        }
        return this;
	}

    return this.each(function(index){
		var $this = $(this);
		// meta values override options
		var o = [$this.attr($.fn.corner.defaults.metaAttr) || '', options || ''].join(' ').toLowerCase();
		var keep = /keep/.test(o);                       // keep borders?
		var cc = ((o.match(/cc:(#[0-9a-f]+)/)||[])[1]);  // corner color
		var sc = ((o.match(/sc:(#[0-9a-f]+)/)||[])[1]);  // strip color
		var width = parseInt((o.match(/(\d+)px/)||[])[1]) || 10; // corner width
		var re = /round|bevelfold|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dogfold|dog/;
		var fx = ((o.match(re)||['round'])[0]);
		var fold = /dogfold|bevelfold/.test(o);
		var edges = { T:0, B:1 };
		var opts = {
			TL:  /top|tl|left/.test(o),       TR:  /top|tr|right/.test(o),
			BL:  /bottom|bl|left/.test(o),    BR:  /bottom|br|right/.test(o)
		};
		if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
			opts = { TL:1, TR:1, BL:1, BR:1 };
			
		// support native rounding
		if ($.fn.corner.defaults.useNative && fx == 'round' && (radius || moz || webkit) && !cc && !sc) {
			if (opts.TL)
				$this.css(radius ? 'border-top-left-radius' : moz ? '-moz-border-radius-topleft' : '-webkit-border-top-left-radius', width + 'px');
			if (opts.TR)
				$this.css(radius ? 'border-top-right-radius' : moz ? '-moz-border-radius-topright' : '-webkit-border-top-right-radius', width + 'px');
			if (opts.BL)
				$this.css(radius ? 'border-bottom-left-radius' : moz ? '-moz-border-radius-bottomleft' : '-webkit-border-bottom-left-radius', width + 'px');
			if (opts.BR)
				$this.css(radius ? 'border-bottom-right-radius' : moz ? '-moz-border-radius-bottomright' : '-webkit-border-bottom-right-radius', width + 'px');
			return;
		}
			
		var strip = document.createElement('div');
		$(strip).css({
			overflow: 'hidden',
			height: '1px',
			minHeight: '1px',
			fontSize: '1px',
			backgroundColor: sc || 'transparent',
			borderStyle: 'solid'
		});
	
        var pad = {
            T: parseInt($.css(this,'paddingTop'))||0,     R: parseInt($.css(this,'paddingRight'))||0,
            B: parseInt($.css(this,'paddingBottom'))||0,  L: parseInt($.css(this,'paddingLeft'))||0
        };

        if (typeof this.style.zoom != undefined) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        var cssHeight = $(this).outerHeight();

        for (var j in edges) {
            var bot = edges[j];
            // only add stips if needed
            if ((bot && (opts.BL || opts.BR)) || (!bot && (opts.TL || opts.TR))) {
                strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
                var d = document.createElement('div');
                $(d).addClass('jquery-corner');
                var ds = d.style;

                bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

                if (bot && cssHeight != 'auto') {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.bottom = ds.left = ds.padding = ds.margin = '0';
                    if (expr)
                        ds.setExpression('width', 'this.parentNode.offsetWidth');
                    else
                        ds.width = '100%';
                }
                else if (!bot && $.browser.msie) {
                    if ($.css(this,'position') == 'static')
                        this.style.position = 'relative';
                    ds.position = 'absolute';
                    ds.top = ds.left = ds.right = ds.padding = ds.margin = '0';
                    
                    // fix ie6 problem when blocked element has a border width
                    if (expr) {
                        var bw = sz(this,'borderLeftWidth') + sz(this,'borderRightWidth');
                        ds.setExpression('width', 'this.parentNode.offsetWidth - '+bw+'+ "px"');
                    }
                    else
                        ds.width = '100%';
                }
                else {
                	ds.position = 'relative';
                    ds.margin = !bot ? '-'+pad.T+'px -'+pad.R+'px '+(pad.T-width)+'px -'+pad.L+'px' : 
                                        (pad.B-width)+'px -'+pad.R+'px -'+pad.B+'px -'+pad.L+'px';                
                }

                for (var i=0; i < width; i++) {
                    var w = Math.max(0,getWidth(fx,i, width));
                    var e = strip.cloneNode(false);
                    e.style.borderWidth = '0 '+(opts[j+'R']?w:0)+'px 0 '+(opts[j+'L']?w:0)+'px';
                    bot ? d.appendChild(e) : d.insertBefore(e, d.firstChild);
                }
				
				if (fold && $.support.boxModel) {
					if (bot && noBottomFold) continue;
					for (var c in opts) {
						if (!opts[c]) continue;
						if (bot && (c == 'TL' || c == 'TR')) continue;
						if (!bot && (c == 'BL' || c == 'BR')) continue;
						
						var common = { position: 'absolute', border: 'none', margin: 0, padding: 0, overflow: 'hidden', backgroundColor: strip.style.borderColor };
						var $horz = $('<div/>').css(common).css({ width: width + 'px', height: '1px' });
						switch(c) {
						case 'TL': $horz.css({ bottom: 0, left: 0 }); break;
						case 'TR': $horz.css({ bottom: 0, right: 0 }); break;
						case 'BL': $horz.css({ top: 0, left: 0 }); break;
						case 'BR': $horz.css({ top: 0, right: 0 }); break;
						}
						d.appendChild($horz[0]);
						
						var $vert = $('<div/>').css(common).css({ top: 0, bottom: 0, width: '1px', height: width + 'px' });
						switch(c) {
						case 'TL': $vert.css({ left: width }); break;
						case 'TR': $vert.css({ right: width }); break;
						case 'BL': $vert.css({ left: width }); break;
						case 'BR': $vert.css({ right: width }); break;
						}
						d.appendChild($vert[0]);
					}
				}
            }
        }
    });
};

$.fn.uncorner = function() { 
	if (radius || moz || webkit)
		this.css(radius ? 'border-radius' : moz ? '-moz-border-radius' : '-webkit-border-radius', 0);
	$('div.jquery-corner', this).remove();
	return this;
};

// expose options
$.fn.corner.defaults = {
	useNative: true, // true if plugin should attempt to use native browser support for border radius rounding
	metaAttr:  'data-corner' // name of meta attribute to use for options
};
    
})(jQuery);


/* jquery/jquery.selectboxes.js */

/*
 *
 * Copyright (c) 2006-2009 Sam Collett (http://www.texotela.co.uk)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * Version 2.2.4
 * Demo: http://www.texotela.co.uk/code/jquery/select/
 *
 * $LastChangedDate$
 * $Rev$
 *
 */
 
;(function($) {
 
/**
 * Adds (single/multiple) options to a select box (or series of select boxes)
 *
 * @name     addOption
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     jQuery
 * @example  $("#myselect").addOption("Value", "Text"); // add single value (will be selected)
 * @example  $("#myselect").addOption("Value 2", "Text 2", false); // add single value (won't be selected)
 * @example  $("#myselect").addOption({"foo":"bar","bar":"baz"}, false); // add multiple values, but don't select
 *
 */
$.fn.addOption = function()
{
	var add = function(el, v, t, sO)
	{
		var option = document.createElement("option");
		option.value = v, option.text = t;
		// get options
		var o = el.options;
		// get number of options
		var oL = o.length;
		if(!el.cache)
		{
			el.cache = {};
			// loop through existing options, adding to cache
			for(var i = 0; i < oL; i++)
			{
				el.cache[o[i].value] = i;
			}
		}
		// add to cache if it isn't already
		if(typeof el.cache[v] == "undefined") el.cache[v] = oL;
		el.options[el.cache[v]] = option;
		if(sO)
		{
			option.selected = true;
		}
	};
	
	var a = arguments;
	if(a.length == 0) return this;
	// select option when added? default is true
	var sO = true;
	// multiple items
	var m = false;
	// other variables
	var items, v, t;
	if(typeof(a[0]) == "object")
	{
		m = true;
		items = a[0];
	}
	if(a.length >= 2)
	{
		if(typeof(a[1]) == "boolean") sO = a[1];
		else if(typeof(a[2]) == "boolean") sO = a[2];
		if(!m)
		{
			v = a[0];
			t = a[1];
		}
	}
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase() != "select") return;
			if(m)
			{
				for(var item in items)
				{
					add(this, item, items[item], sO);
				}
			}
			else
			{
				add(this, v, t, sO);
			}
		}
	);
	return this;
};

/**
 * Add options via ajax
 *
 * @name     ajaxAddOption
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     jQuery
 * @param    String url      Page to get options from (must be valid JSON)
 * @param    Object params   (optional) Any parameters to send with the request
 * @param    Boolean select  (optional) Select the added options, default true
 * @param    Function fn     (optional) Call this function with the select object as param after completion
 * @param    Array args      (optional) Array with params to pass to the function afterwards
 * @example  $("#myselect").ajaxAddOption("myoptions.php");
 * @example  $("#myselect").ajaxAddOption("myoptions.php", {"code" : "007"});
 * @example  $("#myselect").ajaxAddOption("myoptions.php", {"code" : "007"}, false, sortoptions, [{"dir": "desc"}]);
 *
 */
$.fn.ajaxAddOption = function(url, params, select, fn, args)
{
	if(typeof(url) != "string") return this;
	if(typeof(params) != "object") params = {};
	if(typeof(select) != "boolean") select = true;
	this.each(
		function()
		{
			var el = this;
			$.getJSON(url,
				params,
				function(r)
				{
					$(el).addOption(r, select);
					if(typeof fn == "function")
					{
						if(typeof args == "object")
						{
							fn.apply(el, args);
						} 
						else
						{
							fn.call(el);
						}
					}
				}
			);
		}
	);
	return this;
};

/**
 * Removes an option (by value or index) from a select box (or series of select boxes)
 *
 * @name     removeOption
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     jQuery
 * @param    String|RegExp|Number what  Option to remove
 * @param    Boolean selectedOnly       (optional) Remove only if it has been selected (default false)   
 * @example  $("#myselect").removeOption("Value"); // remove by value
 * @example  $("#myselect").removeOption(/^val/i); // remove options with a value starting with 'val'
 * @example  $("#myselect").removeOption(/./); // remove all options
 * @example  $("#myselect").removeOption(/./, true); // remove all options that have been selected
 * @example  $("#myselect").removeOption(0); // remove by index
 * @example  $("#myselect").removeOption(["myselect_1","myselect_2"]); // values contained in passed array
 *
 */
$.fn.removeOption = function()
{
	var a = arguments;
	if(a.length == 0) return this;
	var ta = typeof(a[0]);
	var v, index;
	// has to be a string or regular expression (object in IE, function in Firefox)
	if(ta == "string" || ta == "object" || ta == "function" )
	{
		v = a[0];
		// if an array, remove items
		if(v.constructor == Array)
		{
			var l = v.length;
			for(var i = 0; i<l; i++)
			{
				this.removeOption(v[i], a[1]); 
			}
			return this;
		}
	}
	else if(ta == "number") index = a[0];
	else return this;
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase() != "select") return;
			// clear cache
			if(this.cache) this.cache = null;
			// does the option need to be removed?
			var remove = false;
			// get options
			var o = this.options;
			if(!!v)
			{
				// get number of options
				var oL = o.length;
				for(var i=oL-1; i>=0; i--)
				{
					if(v.constructor == RegExp)
					{
						if(o[i].value.match(v))
						{
							remove = true;
						}
					}
					else if(o[i].value == v)
					{
						remove = true;
					}
					// if the option is only to be removed if selected
					if(remove && a[1] === true) remove = o[i].selected;
					if(remove)
					{
						o[i] = null;
					}
					remove = false;
				}
			}
			else
			{
				// only remove if selected?
				if(a[1] === true)
				{
					remove = o[index].selected;
				}
				else
				{
					remove = true;
				}
				if(remove)
				{
					this.remove(index);
				}
			}
		}
	);
	return this;
};

/**
 * Sort options (ascending or descending) in a select box (or series of select boxes)
 *
 * @name     sortOptions
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     jQuery
 * @param    Boolean ascending   (optional) Sort ascending (true/undefined), or descending (false)
 * @example  // ascending
 * $("#myselect").sortOptions(); // or $("#myselect").sortOptions(true);
 * @example  // descending
 * $("#myselect").sortOptions(false);
 *
 */
$.fn.sortOptions = function(ascending)
{
	// get selected values first
	var sel = $(this).selectedValues();
	var a = typeof(ascending) == "undefined" ? true : !!ascending;
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase() != "select") return;
			// get options
			var o = this.options;
			// get number of options
			var oL = o.length;
			// create an array for sorting
			var sA = [];
			// loop through options, adding to sort array
			for(var i = 0; i<oL; i++)
			{
				sA[i] = {
					v: o[i].value,
					t: o[i].text
				}
			}
			// sort items in array
			sA.sort(
				function(o1, o2)
				{
					// option text is made lowercase for case insensitive sorting
					o1t = o1.t.toLowerCase(), o2t = o2.t.toLowerCase();
					// if options are the same, no sorting is needed
					if(o1t == o2t) return 0;
					if(a)
					{
						return o1t < o2t ? -1 : 1;
					}
					else
					{
						return o1t > o2t ? -1 : 1;
					}
				}
			);
			// change the options to match the sort array
			for(var i = 0; i<oL; i++)
			{
				o[i].text = sA[i].t;
				o[i].value = sA[i].v;
			}
		}
	).selectOptions(sel, true); // select values, clearing existing ones
	return this;
};
/**
 * Selects an option by value
 *
 * @name     selectOptions
 * @author   Mathias Bank (http://www.mathias-bank.de), original function
 * @author   Sam Collett (http://www.texotela.co.uk), addition of regular expression matching
 * @type     jQuery
 * @param    String|RegExp|Array value  Which options should be selected
 * can be a string or regular expression, or an array of strings / regular expressions
 * @param    Boolean clear  Clear existing selected options, default false
 * @example  $("#myselect").selectOptions("val1"); // with the value 'val1'
 * @example  $("#myselect").selectOptions(["val1","val2","val3"]); // with the values 'val1' 'val2' 'val3'
 * @example  $("#myselect").selectOptions(/^val/i); // with the value starting with 'val', case insensitive
 *
 */
$.fn.selectOptions = function(value, clear)
{
	var v = value;
	var vT = typeof(value);
	// handle arrays
	if(vT == "object" && v.constructor == Array)
	{
		var $this = this;
		$.each(v, function()
			{
      				$this.selectOptions(this, clear);
    			}
		);
	};
	var c = clear || false;
	// has to be a string or regular expression (object in IE, function in Firefox)
	if(vT != "string" && vT != "function" && vT != "object") return this;
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase() != "select") return this;
			// get options
			var o = this.options;
			// get number of options
			var oL = o.length;
			for(var i = 0; i<oL; i++)
			{
				if(v.constructor == RegExp)
				{
					if(o[i].value.match(v))
					{
						o[i].selected = true;
					}
					else if(c)
					{
						o[i].selected = false;
					}
				}
				else
				{
					if(o[i].value == v)
					{
						o[i].selected = true;
					}
					else if(c)
					{
						o[i].selected = false;
					}
				}
			}
		}
	);
	return this;
};

/**
 * Copy options to another select
 *
 * @name     copyOptions
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     jQuery
 * @param    String to  Element to copy to
 * @param    String which  (optional) Specifies which options should be copied - 'all' or 'selected'. Default is 'selected'
 * @example  $("#myselect").copyOptions("#myselect2"); // copy selected options from 'myselect' to 'myselect2'
 * @example  $("#myselect").copyOptions("#myselect2","selected"); // same as above
 * @example  $("#myselect").copyOptions("#myselect2","all"); // copy all options from 'myselect' to 'myselect2'
 *
 */
$.fn.copyOptions = function(to, which)
{
	var w = which || "selected";
	if($(to).size() == 0) return this;
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase() != "select") return this;
			// get options
			var o = this.options;
			// get number of options
			var oL = o.length;
			for(var i = 0; i<oL; i++)
			{
				if(w == "all" || (w == "selected" && o[i].selected))
				{
					$(to).addOption(o[i].value, o[i].text);
				}
			}
		}
	);
	return this;
};

/**
 * Checks if a select box has an option with the supplied value
 *
 * @name     containsOption
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     Boolean|jQuery
 * @param    String|RegExp value  Which value to check for. Can be a string or regular expression
 * @param    Function fn          (optional) Function to apply if an option with the given value is found.
 * Use this if you don't want to break the chaining
 * @example  if($("#myselect").containsOption("val1")) alert("Has an option with the value 'val1'");
 * @example  if($("#myselect").containsOption(/^val/i)) alert("Has an option with the value starting with 'val'");
 * @example  $("#myselect").containsOption("val1", copyoption).doSomethingElseWithSelect(); // calls copyoption (user defined function) for any options found, chain is continued
 *
 */
$.fn.containsOption = function(value, fn)
{
	var found = false;
	var v = value;
	var vT = typeof(v);
	var fT = typeof(fn);
	// has to be a string or regular expression (object in IE, function in Firefox)
	if(vT != "string" && vT != "function" && vT != "object") return fT == "function" ? this: found;
	this.each(
		function()
		{
			if(this.nodeName.toLowerCase() != "select") return this;
			// option already found
			if(found && fT != "function") return false;
			// get options
			var o = this.options;
			// get number of options
			var oL = o.length;
			for(var i = 0; i<oL; i++)
			{
				if(v.constructor == RegExp)
				{
					if (o[i].value.match(v))
					{
						found = true;
						if(fT == "function") fn.call(o[i], i);
					}
				}
				else
				{
					if (o[i].value == v)
					{
						found = true;
						if(fT == "function") fn.call(o[i], i);
					}
				}
			}
		}
	);
	return fT == "function" ? this : found;
};

/**
 * Returns values which have been selected
 *
 * @name     selectedValues
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     Array
 * @example  $("#myselect").selectedValues();
 *
 */
$.fn.selectedValues = function()
{
	var v = [];
	this.selectedOptions().each(
		function()
		{
			v[v.length] = this.value;
		}
	);
	return v;
};

/**
 * Returns text which has been selected
 *
 * @name     selectedTexts
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     Array
 * @example  $("#myselect").selectedTexts();
 *
 */
$.fn.selectedTexts = function()
{
	var t = [];
	this.selectedOptions().each(
		function()
		{
			t[t.length] = this.text;
		}
	);
	return t;
};

/**
 * Returns options which have been selected
 *
 * @name     selectedOptions
 * @author   Sam Collett (http://www.texotela.co.uk)
 * @type     jQuery
 * @example  $("#myselect").selectedOptions();
 *
 */
$.fn.selectedOptions = function()
{
	return this.find("option:selected");
};

})(jQuery);

/* jquery/jquery.qtip.js */

/*
* qTip2 - Pretty powerful tooltips
* http://craigsworks.com/projects/qtip2/
*
* Version: nightly
* Copyright 2009-2010 Craig Michael Thompson - http://craigsworks.com
*
* Dual licensed under MIT or GPLv2 licenses
*   http://en.wikipedia.org/wiki/MIT_License
*   http://en.wikipedia.org/wiki/GNU_General_Public_License
*
* Date: Wed Mar  9 14:08:00 PST 2011
*/

"use strict"; // Enable ECMAScript "strict" operation for this function. See more: http://ejohn.org/blog/ecmascript-5-strict-mode-json-and-more/
/*jslint browser: true, onevar: true, undef: true, nomen: true, bitwise: true, regexp: true, newcap: true, immed: true, strict: true */
/*global window: false, jQuery: false */


(function($, window, undefined) {

	// Munge the primitives - Paul Irish tip
	var TRUE = true,
		FALSE = false,
		NULL = null,
		
		// Shortcut vars
		QTIP, PLUGINS, MOUSE,
		uitooltip = 'ui-tooltip',
		widget = 'ui-widget',
		disabled = 'ui-state-disabled',
		selector = 'div.qtip.'+uitooltip,
		focusClass = uitooltip + '-focus',
		hideOffset = '-31000px',
		replaceSuffix = '_replacedByqTip',
		oldtitle = 'oldtitle';

	// Simple console.error wrapper
	function debug() {
		var c = window.console;
		return c && (c.error || c.log || $.noop).apply(c, arguments);
	}
// Option object sanitizer
function sanitizeOptions(opts)
{
	var content;

	if(!opts || 'object' !== typeof opts) { return FALSE; }

	if('object' !== typeof opts.metadata) {
		opts.metadata = {
			type: opts.metadata
		};
	}

	if('content' in opts) {
		if('object' !== typeof opts.content || opts.content.jquery) {
			opts.content = {
				text: opts.content
			};
		}

		content = opts.content.text || FALSE;
		if(!$.isFunction(content) && ((!content && !content.attr) || content.length < 1 || ('object' === typeof content && !content.jquery))) {
			opts.content.text = FALSE;
		}

		if('title' in opts.content) {
			if('object' !== typeof opts.content.title) {
				opts.content.title = {
					text: opts.content.title
				};
			}

			content = opts.content.title.text || FALSE;
			if(!$.isFunction(content) && ((!content && !content.attr) || content.length < 1 || ('object' === typeof content && !content.jquery))) {
				opts.content.title.text = FALSE;
			}
		}
	}

	if('position' in opts) {
		if('object' !== typeof opts.position) {
			opts.position = {
				my: opts.position,
				at: opts.position
			};
		}
	}

	if('show' in opts) {
		if('object' !== typeof opts.show) {
			if(opts.show.jquery) {
				opts.show = { target: opts.show };
			}
			else {
				opts.show = { event: opts.show };
			}
		}
	}

	if('hide' in opts) {
		if('object' !== typeof opts.hide) {
			if(opts.hide.jquery) {
				opts.hide = { target: opts.hide };
			}
			else {
				opts.hide = { event: opts.hide };
			}
		}
	}

	if('style' in opts) {
		if('object' !== typeof opts.style) {
			opts.style = {
				classes: opts.style
			};
		}
	}

	// Sanitize plugin options
	$.each(PLUGINS, function() {
		if(this.sanitize) { this.sanitize(opts); }
	});

	return opts;
}

/*
* Core plugin implementation
*/
function QTip(target, options, id, attr)
{
	// Declare this reference
	var self = this,
		docBody = document.body,
		tooltipID = uitooltip + '-' + id,
		isPositioning = 0,
		tooltip, elements, cache;

	// Setup class attributes
	self.id = id;
	self.rendered = FALSE;
	self.elements = elements = { target: target };
	self.timers = { img: [] };
	self.options = options;
	self.checks = {};
	self.plugins = {};
	self.cache = cache = {
		event: {},
		target: NULL,
		disabled: FALSE,
		attr: attr
	};

	/*
	* Private core functions
	*/
	function convertNotation(notation)
	{
		var i = 0, obj, option = options, 

		// Split notation into array
		levels = notation.split('.');

		// Loop through
		while( option = option[ levels[i++] ] ) {
			if(i < levels.length) { obj = option; }
		}

		return [obj || options, levels.pop()];
	}

	function isVisible() {
		return tooltip && tooltip.css('left') !== hideOffset && tooltip.css('visibility') !== 'hidden';
	}

	function setWidget() {
		var on = options.style.widget;

		tooltip.toggleClass(widget, on);
		elements.content.toggleClass(widget+'-content', on);
		
		if(elements.titlebar){
			elements.titlebar.toggleClass(widget+'-header', on);
		}
		if(elements.button){
			elements.button.toggleClass(uitooltip+'-icon', !on);
		}
	}

	function removeTitle()
	{
		if(elements.title) {
			elements.titlebar.remove();
			elements.titlebar = elements.title = elements.button = NULL;
			self.reposition();
		}
	}

	function createButton()
	{
		var button = options.content.title.button;

		if(elements.button) { elements.button.remove(); }

		// Use custom button if one was supplied by user, else use default
		if(button.jquery) {
			elements.button = button;
		}
		else {
			elements.button = $('<a />', {
				'class': 'ui-state-default ' + (options.style.widget ? '' : uitooltip+'-icon'),
				'title': 'Close tooltip',
				'aria-label': 'Close tooltip'
			})
			.prepend(
				$('<span />', {
					'class': 'ui-icon ui-icon-close',
					'html': '&times;'
				})
			);
		}

		// Create button and setup attributes
		elements.button.appendTo(elements.titlebar)
			.attr('role', 'button')
			.hover(function(event){ $(this).toggleClass('ui-state-hover', event.type === 'mouseenter'); })
			.click(function(event) {
				if(!tooltip.hasClass(disabled)) { self.hide(event); }
				return FALSE;
			})
			.bind('mousedown keydown mouseup keyup mouseout', function(event) {
				$(this).toggleClass('ui-state-active ui-state-focus', event.type.substr(-4) === 'down');
			});

		// Redraw the tooltip when we're done
		self.redraw();
	}

	function createTitle()
	{
		var id = tooltipID+'-title';

		// Destroy previous title element, if present
		if(elements.titlebar) { removeTitle(); }

		// Create title bar and title elements
		elements.titlebar = $('<div />', {
			'class': uitooltip + '-titlebar ' + (options.style.widget ? 'ui-widget-header' : '')
		})
		.append(
			elements.title = $('<div />', {
				'id': id,
				'class': uitooltip + '-title',
				'aria-atomic': TRUE
			})
		)
		.insertBefore(elements.content);

		// Create button if enabled
		if(options.content.title.button) { createButton(); }

		// Redraw the tooltip dimensions if it's rendered
		else if(self.rendered){ self.redraw(); } 
	}

	function updateButton(button)
	{
		var elem = elements.button,
			title = elements.title;

		// Make sure tooltip is rendered and if not, return
		if(!self.rendered) { return FALSE; }

		if(!button) {
			elem.remove();
		}
		else {
			if(!title) {
				createTitle();
			}
			createButton();
		}
	}

	function updateTitle(content)
	{
		var elem = elements.title;

		// Make sure tooltip is rendered and if not, return
		if(!self.rendered || !content) { return FALSE; }

		// Use function to parse content
		if($.isFunction(content)) {
			content = content.call(target, self) || '';
		}

		// Append new content if its a DOM array and show it if hidden
		if(content.jquery && content.length > 0) {
			elem.empty().append(content.css({ display: 'block' }));
		}

		// Content is a regular string, insert the new content
		else { elem.html(content); }

		// Redraw and reposition
		self.redraw();
		if(self.rendered && isVisible()) {
			self.reposition(cache.event);
		}
	}

	function updateContent(content, reposition)
	{
		var elem = elements.content;

		// Make sure tooltip is rendered and content is defined. If not return
		if(!self.rendered || !content) { return FALSE; }

		// Use function to parse content
		if($.isFunction(content)) {
			content = content.call(target, self) || '';
		}

		// Append new content if its a DOM array and show it if hidden
		if(content.jquery && content.length > 0) {
			elem.empty().append(content.css({ display: 'block' }));
		}

		// Content is a regular string, insert the new content
		else { elem.html(content); }

		// Insert into 'fx' queue our image dimension checker which will halt the showing of the tooltip until image dimensions can be detected
		tooltip.queue('fx', function(next) {
			// Find all content images without dimensions
			var images = elem.find('img:not([height]):not([width])');

			// Update tooltip width and position when all images are loaded
			function imageLoad(img) {
				// Remove the image from the array
				images = images.not(img);

				// If queue is empty, update tooltip and continue the queue
				if(images.length === 0) {
					self.redraw();
					if(self.rendered && isVisible()) {
						self.reposition(cache.event);
					}

					next();
				}
			}

			// Apply the callback to img events and height checker method to ensure queue continues no matter what!
			images.each(function(i, elem) {
				// Apply the imageLoad to regular events to make sure the queue continues
				var events = ['abort','error','load','unload',''].join('.qtip-image ');
				$(this).bind(events, function() {
					clearTimeout(self.timers.img[i]);
					imageLoad(this);
				});

				// Apply a recursive method that polls the image for dimensions every 20ms
				(function timer(){
					// When the dimensions are found, remove the image from the queue
					if(elem.height && elem.width) {
						return imageLoad(elem);
					}

					self.timers.img[i] = setTimeout(timer, 20);
				}());

				return TRUE;
			});

			// If no images were found, continue with queue
			if(images.length === 0) { imageLoad(images);  }
		});

		return self;
	}

	function assignEvents(show, hide, tip, doc)
	{
		var namespace = '.qtip-'+id,
			posOptions = options.position,
			targets = {
				show: options.show.target,
				hide: options.hide.target,
				container: posOptions.container[0] === docBody ? $(document) : posOptions.container,
				doc: $(document)
			},
			events = {
				show: $.trim('' + options.show.event).split(' '),
				hide: $.trim('' + options.hide.event).split(' ')
			},
			IE6 = $.browser.msie && parseInt($.browser.version, 10) === 6;

		// Define show event method
		function showMethod(event)
		{
			if(tooltip.hasClass(disabled)) { return FALSE; }

			// If set, hide tooltip when inactive for delay period
			targets.show.trigger('qtip-'+id+'-inactive');

			// Clear hide timers
			clearTimeout(self.timers.show);
			clearTimeout(self.timers.hide);

			// Start show timer
			var callback = function(){ self.show(event); };
			if(options.show.delay > 0) {
				self.timers.show = setTimeout(callback, options.show.delay);
			}
			else{ callback(); }
		}

		// Define hide method
		function hideMethod(event)
		{
			if(tooltip.hasClass(disabled)) { return FALSE; }

			// Check if new target was actually the tooltip element
			var relatedTarget = $(event.relatedTarget || event.target),
				ontoTooltip = relatedTarget.closest(selector)[0] === tooltip[0],
				ontoTarget = relatedTarget[0] === targets.show[0];

			// Clear timers and stop animation queue
			clearTimeout(self.timers.show);
			clearTimeout(self.timers.hide);

			// Prevent hiding if tooltip is fixed and event target is the tooltip. Or if mouse positioning is enabled and cursor momentarily overlaps
			if((posOptions.target === 'mouse' && ontoTooltip) || (options.hide.fixed && ((/mouse(out|leave|move)/).test(event.type) && (ontoTooltip || ontoTarget))))
			{
				// Prevent default and popagation
				event.stopPropagation();
				event.preventDefault();
				return FALSE;
			}

			// If tooltip has displayed, start hide timer
			tooltip.stop(1, 1);

			if(options.hide.delay > 0) {
				self.timers.hide = setTimeout(function(){ self.hide(event); }, options.hide.delay);
			}
			else{ self.hide(event); }
		}

		// Define inactive method
		function inactiveMethod(event)
		{
			if(tooltip.hasClass(disabled)) { return FALSE; }

			// Clear timer
			clearTimeout(self.timers.inactive);
			self.timers.inactive = setTimeout(function(){ self.hide(event); }, options.hide.inactive);
		}

		function repositionMethod(event) {
			if(isVisible()) { self.reposition(event); }
		}

		// Assign tooltip events
		if(tip) {
			// Enable hide.fixed
			if(options.hide.fixed) {
				// Add tooltip as a hide target
				targets.hide = targets.hide.add(tooltip);

				// Clear hide timer on tooltip hover to prevent it from closing
				tooltip.bind('mouseover'+namespace, function() {
					if(!tooltip.hasClass(disabled)) {
						clearTimeout(self.timers.hide);
					}
				});
			}

			// If mouse positioning is on, apply a mouseleave event so we don't get problems with overlapping
			if(posOptions.target === 'mouse' && posOptions.adjust.mouse && options.hide.event) {
				tooltip.bind('mouseleave'+namespace, function(event) {
					if((event.relatedTarget || event.target) !== targets.show[0]) { self.hide(event); }
				});
			}

			// Focus/blur the tooltip
			tooltip.bind('mouseenter'+namespace+' mouseleave'+namespace, function(event) {
				self[ event.type === 'mouseenter' ? 'focus' : 'blur' ](event);
			});
		}

		// Assign hide events
		if(hide) {
			// Check if the tooltip hides when inactive
			if('number' === typeof options.hide.inactive)
			{
				// Bind inactive method to target as a custom event
				targets.show.bind('qtip-'+id+'-inactive', inactiveMethod);

				// Define events which reset the 'inactive' event handler
				$.each(QTIP.inactiveEvents, function(index, type){
					targets.hide.add(elements.tooltip).bind(type+namespace+'-inactive', inactiveMethod);
				});
			}

			// Apply hide events
			$.each(events.hide, function(index, type) {
				var showIndex = $.inArray(type, events.show),
					 targetHide = $(targets.hide);

				// Both events and targets are identical, apply events using a toggle
				if((showIndex > -1 && targetHide.add(targets.show).length === targetHide.length) || type === 'unfocus')
				{
					targets.show.bind(type+namespace, function(event)
					{
						if(isVisible()) { hideMethod(event); }
						else{ showMethod(event); }
					});

					// Don't bind the event again
					delete events.show[ showIndex ];
				}

				// Events are not identical, bind normally
				else{ targets.hide.bind(type+namespace, hideMethod); }
			});
		}

		// Apply show events
		if(show) {
			$.each(events.show, function(index, type) {
				targets.show.bind(type+namespace, showMethod);
			});
		}

		// Apply document events
		if(doc) {
			// Adjust positions of the tooltip on window resize if enabled
			if(posOptions.adjust.resize || posOptions.viewport) {
				$($.event.special.resize ? posOptions.viewport : window).bind('resize'+namespace, repositionMethod);
			}

			// Adjust tooltip position on scroll if screen adjustment is enabled
			if(posOptions.viewport || (IE6 && tooltip.css('position') === 'fixed')) {
				$(posOptions.viewport).bind('scroll'+namespace, repositionMethod);
			}

			// Hide tooltip on document mousedown if unfocus events are enabled
			if((/unfocus/i).test(options.hide.event)) {
				targets.doc.bind('mousedown'+namespace, function(event) {
					var $target = $(event.target);
					
					if($target.parents(selector).length === 0 && $target.add(target).length > 1 && isVisible() && !tooltip.hasClass(disabled)) {
						self.hide(event);
					}
				});
			}

			// If mouse is the target, update tooltip position on document mousemove
			if(posOptions.target === 'mouse') {
				targets.doc.bind('mousemove'+namespace, function(event) {
					// Update the tooltip position only if the tooltip is visible and adjustment is enabled
					if(posOptions.adjust.mouse && !tooltip.hasClass(disabled) && isVisible()) {
						self.reposition(event || MOUSE);
					}
				});
			}
		}
	}

	function unassignEvents(show, hide, tooltip, doc)
	{
		doc = parseInt(doc, 10) !== 0;
		var namespace = '.qtip-'+id,
			targets = {
				show: show && options.show.target[0],
				hide: hide && options.hide.target[0],
				tooltip: tooltip && self.rendered && elements.tooltip[0],
				content: tooltip && self.rendered && elements.content[0],
				container: doc && options.position.container[0] === docBody ? document : options.position.container[0],
				window: doc && window
			};

		// Check if tooltip is rendered
		if(self.rendered)
		{
			$([]).pushStack(
				$.grep(
					[ targets.show, targets.hide, targets.tooltip, targets.container, targets.content, targets.window ],
					function(i){ return typeof i === 'object'; }
				)
			)
			.unbind(namespace);
		}

		// Tooltip isn't yet rendered, remove render event
		else if(show) { options.show.target.unbind(namespace+'-create'); }
	}

	// Setup builtin .set() option checks
	self.checks.builtin = {
		// Core checks
		'^id$': function(obj, o, v) {
			var id = v === TRUE ? QTIP.nextid : v,
				tooltipID = uitooltip + '-' + id;

			if(id !== FALSE && id.length > 0 && !$('#'+tooltipID).length) {
				tooltip[0].id = tooltipID;
				elements.content[0].id = tooltipID + '-content';
				elements.title[0].id = tooltipID + '-title';
			}
		},

		// Content checks
		'^content.text$': function(obj, o, v){ updateContent(v); },
		'^content.title.text$': function(obj, o, v) {
			// Remove title if content is null
			if(!v) { return removeTitle(); }

			// If title isn't already created, create it now and update
			if(!elements.title && v) { createTitle(); }
			updateTitle(v);
		},
		'^content.title.button$': function(obj, o, v){ updateButton(v); },

		// Position checks
		'^position.(my|at)$': function(obj, o, v){
			// Parse new corner value into Corner objecct
			if('string' === typeof v) {
				obj[o] = new PLUGINS.Corner(v);
			}
		},

		'^position.container$': function(obj, o, v){
			if(self.rendered) { tooltip.appendTo(v); }
		},

		// Show & hide checks
		'^(show|hide).(event|target|fixed|delay|inactive)$': function(obj, o, v, p, match) {
			// Setup arguments
			var args = [1,0,0];
			args[match[0] === 'show' ? 'push' : 'unshift'](0);

			unassignEvents.apply(self, args);
			assignEvents.apply(self, [1,1,0,0]);
		},
		'^show.ready$': function() { if(!self.rendered) { self.show(); } },

		// Style checks
		'^style.classes$': function(obj, o, v) { 
			$.attr(tooltip[0], 'class', uitooltip + ' qtip ui-helper-reset ' + v);
		},
		'^style.widget|content.title': setWidget,

		// Events check
		'^events.(render|show|move|hide|focus|blur)$': function(obj, o, v) {
			tooltip[($.isFunction(v) ? '' : 'un') + 'bind']('tooltip'+o, v);
		}
	};

	/*
	* Public API methods
	*/
	$.extend(self, {
		render: function(show)
		{
			if(self.rendered) { return FALSE; } // If tooltip has already been rendered, exit

			var content = options.content.text,
				title = options.content.title.text,
				callback = $.Event('tooltiprender');

			// Add ARIA attributes to target
			$.attr(target[0], 'aria-describedby', tooltipID);

			// Create tooltip element
			tooltip = elements.tooltip = $('<div/>')
				.attr({
					'id': tooltipID,
					'class': uitooltip + ' qtip ui-helper-reset ' + options.style.classes,
					
					/* ARIA specific attributes */
					'role': 'alert',
					'aria-live': 'polite',
					'aria-atomic': FALSE,
					'aria-describedby': tooltipID + '-content',
					'aria-hidden': TRUE
				})
				.toggleClass(disabled, cache.disabled)
				.data('qtip', self)
				.appendTo(options.position.container)
				.append(
					// Create content element
					elements.content = $('<div />', {
						'class': uitooltip + '-content',
						'id': tooltipID + '-content',
						'aria-atomic': TRUE
					})
				);
			self.rendered = -1;

			// Update title
			if(title) { 
				createTitle();
				updateTitle(title);
			}

			// Set proper rendered flag and update content
			updateContent(content);
			self.rendered = TRUE;

			// Setup widget classes
			setWidget();

			// Initialize 'render' plugins
			$.each(PLUGINS, function() {
				if(this.initialize === 'render') { this(self); }
			});

			// Assign events
			assignEvents(1, 1, 1, 1);
			$.each(options.events, function(name, callback) {
				if(callback) {
					var events = name === 'toggle' ? 'tooltipshow tooltiphide' : 'tooltip'+name;
					tooltip.bind(events, callback);
				}
			});

			// Set visibility AFTER plugin initialization to prevent issues in IE
			tooltip.css('visibility', 'hidden')

			/* Queue this part of the render process in our fx queue so we can
			 * load images before the tooltip renders fully.
			 *
			 * See: updateContent method
			*/
			.queue('fx', function(next) {
				// Trigger tooltiprender event and pass original triggering event as original
				callback.originalEvent = cache.event;
				tooltip.trigger(callback, [self]);

				// Update tooltip position and show tooltip if needed
				if(options.show.ready || show) {
					self.show(cache.event);
				}

				// Move on and redraw the tooltip properly
				next(); self.redraw();
			});

			return self;
		},

		get: function(notation)
		{
			var result, o;

			switch(notation.toLowerCase())
			{
				case 'dimensions':
					result = {
						height: tooltip.outerHeight(), width: tooltip.outerWidth()
					};
				break;

				case 'offset':
					result = PLUGINS.offset(tooltip, options.position.container);
				break;

				default:
					o = convertNotation(notation.toLowerCase());
					result = o[0][ o[1] ];
					result = result.precedance ? result.string() : result;
				break;
			}

			return result;
		},

		set: function(option, value)
		{
			var rmove = /^position.(my|at|adjust|target|container)|style|content/i,
				reposition = FALSE,
				checks = self.checks,
				name;

			function callback(notation, args) {
				var category, rule, match;

				if(self.rendered) {
					for(category in checks) {
						for(rule in checks[category]) {
							if(match = (new RegExp(rule, 'i')).exec(notation)) {
								args.push(match);
								checks[category][rule].apply(self, args);
							}
						}
					}
				}

				// If we're not rendered and show.ready was set, render it
				else if(notation === 'show.ready' && args[2]) {
					isPositioning = 0; self.render(TRUE);
				}
			}

			// Convert singular option/value pair into object form
			if('string' === typeof option) {
				name = option; option = {}; option[name] = value;
			}
			else { option = $.extend(TRUE, {}, option); }

			// Set all of the defined options to their new values
			$.each(option, function(notation, value) {
				var obj = convertNotation( notation.toLowerCase() ), previous;
				
				// Set new obj value
				previous = obj[0][ obj[1] ];
				obj[0][ obj[1] ] = 'object' === typeof value && value.nodeType ? $(value) : value;

				// Set the new params for the callback and test it against reposition
				option[notation] = [obj[0], obj[1], value, previous];
				reposition = rmove.test(notation) || reposition;
			});

			// Re-sanitize options
			sanitizeOptions(options);

			/*
			 * Execute any valid callbacks for the set options
			 * Also set isPositioning so we don't get loads of redundant repositioning calls
			 */
			isPositioning = 1; $.each(option, callback); isPositioning = 0;

			// Update position on ANY style/position/content change if shown and rendered
			if(reposition && isVisible() && self.rendered) { self.reposition(); }

			return self;
		},

		toggle: function(state, event)
		{
			// Make sure tooltip is rendered
			if(!self.rendered) {
				if(state) { self.render(1); } // Render the tooltip if showing and it isn't already
				else { return FALSE; }
			}

			var type = state ? 'show' : 'hide',
				opts = options[type],
				visible = isVisible(),
				callback;

			// Detect state if valid one isn't provided
			if((typeof state).search('boolean|number')) { state = !visible; }

			// Return if element is already in correct state
			if(visible === state) { return self; }

			// Try to prevent flickering when tooltip overlaps show element
			if(event) {
				if((/over|enter/).test(event.type) && (/out|leave/).test(cache.event.type) &&
					event.target === options.show.target[0] && tooltip.has(event.relatedTarget).length){
					return self;
					}

				// Cache event
				cache.event = $.extend({}, event);
			}

			// Call API methods
			callback = $.Event('tooltip'+type); 
			callback.originalEvent = event ? cache.event : NULL;
			tooltip.trigger(callback, [self, 90]);
			if(callback.isDefaultPrevented()){ return self; }

			// Set ARIA hidden status attribute
			$.attr(tooltip[0], 'aria-hidden', !!!state);

			// Execute state specific properties
			if(state) {
				tooltip.hide().css({ visibility: '' }); // Hide it first so effects aren't skipped
				
				// Focus the tooltip
				self.focus(event);

				// Update tooltip position (without animation)
				self.reposition(event, 0);

				// Hide other tooltips if tooltip is solo, using it as the context
				if(opts.solo) { $(selector, opts.solo).not(tooltip).qtip('hide', callback); }
			}
			else {
				// Clear show timer if we're hiding 
				clearTimeout(self.timers.show);

				// Blur the tooltip
				self.blur(event);
			}

			// Define post-animation state specific properties
			function after() {
				// Prevent antialias from disappearing in IE by removing filter
				if(state) {
					if($.browser.msie) { tooltip[0].style.removeAttribute('filter'); }
				}
				// Hide the tooltip using negative offset and reset opacity
				else {
					tooltip.css({
						display: '',
						visibility: 'hidden',
						width: '',
						opacity: '',
						left: '',
						top: ''
					});
				}
			}

			// Clear animation queue
			tooltip.stop(1, 1);

			// Use custom function if provided
			if($.isFunction(opts.effect)) {
				opts.effect.call(tooltip, self);
				tooltip.queue('fx', function(next){ after.call(this, next); next(); });
			}

			// If no effect type is supplied, use a simple toggle
			else if(opts.effect === FALSE) {
				tooltip[ type ]();
				after.call(tooltip);
			}

			// Use basic fade function by default
			else { tooltip.fadeTo(90, state ? 1 : 0, after); }

			// If inactive hide method is set, active it
			if(state) { opts.target.trigger('qtip-'+id+'-inactive'); }

			return self;
		},

		show: function(event){ return self.toggle(TRUE, event); },

		hide: function(event){ return self.toggle(FALSE, event); },

		focus: function(event)
		{
			if(!self.rendered) { return FALSE; }

			var qtips = $(selector),
				curIndex = parseInt(tooltip[0].style.zIndex, 10),
				newIndex = QTIP.zindex + qtips.length,
				cachedEvent = $.extend({}, event),
				focusedElem, callback;

			// Only update the z-index if it has changed and tooltip is not already focused
			if(!tooltip.hasClass(focusClass))
			{
				// Only update z-index's if they've changed'
				if(curIndex !== newIndex) {
					// Reduce our z-index's and keep them properly ordered
					qtips.each(function() {
						if(this.style.zIndex > curIndex) {
							this.style.zIndex = this.style.zIndex - 1;
						}
					});

					// Fire blur event for focused tooltip
					qtips.filter('.' + focusClass).qtip('blur', cachedEvent);
				}

				// Call API method
				callback = $.Event('tooltipfocus');
				callback.originalEvent = cachedEvent;
				tooltip.trigger(callback, [self, newIndex]);

				// If callback wasn't FALSE
				if(!callback.isDefaultPrevented()) {
					// Set the new z-index
					tooltip.addClass(focusClass)[0].style.zIndex = newIndex;
				}
			}

			return self;
		},

		blur: function(event) {
			var cachedEvent = $.extend({}, event),
				callback;

			// Set focused status to FALSE
			tooltip.removeClass(focusClass);

			// Trigger blur event
			callback = $.Event('tooltipblur');
			callback.originalEvent = cachedEvent;
			tooltip.trigger(callback, [self]);

			return self;
		},

		reposition: function(event, effect)
		{
			if(!self.rendered || isPositioning) { return FALSE; }

			// Set positioning flag
			isPositioning = TRUE;
	
			var target = options.position.target,
				posOptions = options.position,
				my = posOptions.my, 
				at = posOptions.at,
				adjust = posOptions.adjust,
				elemWidth = tooltip.outerWidth(),
				elemHeight = tooltip.outerHeight(),
				targetWidth = 0,
				targetHeight = 0,
				callback = $.Event('tooltipmove'),
				fixed = tooltip.css('position') === 'fixed',
				viewport = posOptions.viewport.jquery ? posOptions.viewport : $(window),
				position = { left: 0, top: 0 },
				tip = (self.plugins.tip || {}).corner,
				readjust = {
					left: function(posLeft) {
						var viewportScroll = viewport.scrollLeft,
							myWidth = my.x === 'left' ? elemWidth : my.x === 'right' ? -elemWidth : -elemWidth / 2,
							atWidth = at.x === 'left' ? targetWidth : at.x === 'right' ? -targetWidth : -targetWidth / 2,
							tipAdjust = tip && tip.precedance === 'x' ? QTIP.defaults.style.tip.width : 0,
							overflowLeft = viewportScroll - posLeft - tipAdjust,
							overflowRight = posLeft + elemWidth - viewport.width - viewportScroll + tipAdjust,
							offset = myWidth - (my.precedance === 'x' || my.x === my.y ? atWidth : 0),
							isCenter = my.x === 'center';

						if(overflowLeft > 0 && (my.x !== 'left' || overflowRight > 0)) {
							position.left -= offset + (isCenter ? 0 : 2 * adjust.x);
						}
						else if(overflowRight > 0 && (my.x !== 'right' || overflowLeft > 0)  ) {
							position.left -= isCenter ? -offset : offset + (2 * adjust.x);
						}
						if(position.left !== posLeft && isCenter) { position.left -= adjust.x; }

						// Make sure we haven't made things worse with the adjustment and return the adjusted difference
						if(position.left < 0 && -position.left > overflowRight) { position.left = posLeft; }
						return position.left - posLeft;
					},
					top: function(posTop) {
						var viewportScroll = viewport.scrollTop,
							myHeight = my.y === 'top' ? elemHeight : my.y === 'bottom' ? -elemHeight : -elemHeight / 2,
							atHeight = at.y === 'top' ? targetHeight : at.y === 'bottom' ? -targetHeight : -targetHeight / 2,
							tipAdjust = tip && tip.precedance === 'y' ? QTIP.defaults.style.tip.height : 0,
							overflowTop = viewportScroll - posTop - tipAdjust,
							overflowBottom = posTop + elemHeight - viewport.height - viewportScroll + tipAdjust,
							offset = myHeight - (my.precedance === 'y' || my.x === my.y ? atHeight : 0),
							isCenter = my.y === 'center';

						if(overflowTop > 0 && (my.y !== 'top' || overflowBottom > 0)) {
							position.top -= offset + (isCenter ? 0 : 2 * adjust.y);
						}
						else if(overflowBottom > 0 && (my.y !== 'bottom' || overflowTop > 0)  ) {
							position.top -= isCenter ? -offset : offset + (2 * adjust.y);
						}
						if(position.top !== posTop && isCenter) { position.top -= adjust.y; }

						// Make sure we haven't made things worse with the adjustment and return the adjusted difference
						if(position.top < 0 && -position.top > overflowBottom) { position.top = posTop; }
						return position.top - posTop;
					}
				};
				effect = effect === undefined || !!effect || FALSE;

			// Cache our viewport details
			viewport = !viewport ? FALSE : {
				elem: viewport,
				height: viewport[ (viewport[0] === window ? 'h' : 'outerH') + 'eight' ](),
				width: viewport[ (viewport[0] === window ? 'w' : 'outerW') + 'idth' ](),
				scrollLeft: viewport.scrollLeft(),
				scrollTop: viewport.scrollTop()
			};

			// Check if mouse was the target
			if(target === 'mouse') {
				// Force left top to allow flipping
				at = { x: 'left', y: 'top' };

				// Use cached event if one isn't available for positioning
				event = event && (event.type === 'resize' || event.type === 'scroll') ? cache.event :
					adjust.mouse || !event || !event.pageX ? $.extend({}, MOUSE) : event;

				// Use event coordinates for position
				position = { top: event.pageY, left: event.pageX };
			}
			else {
				// Check if event targetting is being used
				if(target === 'event') {
					if(event && event.target && event.type !== 'scroll' && event.type !== 'resize') {
						target = cache.target = $(event.target);
					}
					else {
						target = cache.target;
					}
				}

				// Parse the target into a jQuery object and make sure there's an element present
				target = $(target).eq(0);
				if(target.length === 0) { return self; }

				// Check if window or document is the target
				else if(target[0] === document || target[0] === window) {
					targetWidth = target.width();
					targetHeight = target.height();

					if(target[0] === window) {
						position = {
							top: fixed ? 0 : viewport.scrollTop,
							left: fixed ? 0 : viewport.scrollLeft
						};
					}
				}

				// Use Imagemap/SVG plugins if needed
				else if(target.is('area') && PLUGINS.imagemap) {
					position = PLUGINS.imagemap(target, at);
				}
				else if(target[0].namespaceURI == 'http://www.w3.org/2000/svg' && PLUGINS.svg) {
					position = PLUGINS.svg(target, at);
				}

				else {
					targetWidth = target.outerWidth();
					targetHeight = target.outerHeight();

					position = PLUGINS.offset(target, posOptions.container);
				}

				// Parse returned plugin values into proper variables
				if(position.offset) {
					targetWidth = position.width;
					targetHeight = position.height;
					position = position.offset;
				}

				// Adjust position relative to target
				position.left += at.x === 'right' ? targetWidth : at.x === 'center' ? targetWidth / 2 : 0;
				position.top += at.y === 'bottom' ? targetHeight : at.y === 'center' ? targetHeight / 2 : 0;
			}

			// Adjust position relative to tooltip
			position.left += adjust.x + (my.x === 'right' ? -elemWidth : my.x === 'center' ? -elemWidth / 2 : 0);
			position.top += adjust.y + (my.y === 'bottom' ? -elemHeight : my.y === 'center' ? -elemHeight / 2 : 0);

			// Calculate collision offset values
			if(posOptions.viewport.jquery && target[0] !== window && target[0] !== docBody) {
				position.adjusted = { left: readjust.left(position.left), top: readjust.top(position.top) };
			}
			else {
				position.adjusted = { left: 0, top: 0 };
			}

			// Set tooltip position class
			tooltip.attr('class', function(i, val) {
				return $.attr(this, 'class').replace(/ui-tooltip-pos-\w+/i, '');
			})
			.addClass(uitooltip + '-pos-' + my.abbreviation());

			// Call API method
			callback.originalEvent = $.extend({}, event);
			tooltip.trigger(callback, [self, position, viewport.elem]);
			if(callback.isDefaultPrevented()){ return self; }
			delete position.adjusted;

			// If effect is disabled or positioning gives NaN out, set CSS directly
			if(!effect || !isNaN(position.left, position.top)) {
				tooltip.css(position);
			}
			
			// Use custom function if provided
			else if(isVisible() && $.isFunction(posOptions.effect)) {
				posOptions.effect.call(tooltip, self, position);
				tooltip.queue(function(next) {
					var elem = $(this);
					// Reset attributes to avoid cross-browser rendering bugs
					elem.css({ opacity: '', height: '' });
					if($.browser.msie && this.style) { this.style.removeAttribute('filter'); }

					next();
				});
			}

			// Set positioning flag
			isPositioning = FALSE;

			return self;
		},

		// IE max/min height/width simulartor function
		redraw: function()
		{
			var fluid = uitooltip + '-fluid',
			 auto = 'auto', dimensions;

			// Return if tooltip is not rendered
			if(self.rendered < 1) { return FALSE; }

			// Reset the height and width and add the fluid class to reset max/min widths
			tooltip.css({ width: auto, height: auto }).addClass(fluid);

			// Grab our tooltip dimensions
			dimensions = {
				height: tooltip.outerHeight(),
				width: tooltip.outerWidth()
			};

			// Determine actual width
			$.each(['width', 'height'], function(i, prop) {
				// Parse our max/min properties
				var max = parseInt(tooltip.css('max-'+prop), 10) || 0,
					min = parseInt(tooltip.css('min-'+prop), 10) || 0;

				// Determine new dimension size based on max/min/current values
				dimensions[prop] = max + min ? Math.min( Math.max( dimensions[prop], min ), max ) : dimensions[prop];
			});

			// Set the newly calculated dimensions and remvoe fluid class
			tooltip.css(dimensions).removeClass(fluid);

			return self;
		},

		disable: function(state)
		{
			var c = disabled;
			
			if('boolean' !== typeof state) {
				state = !(tooltip.hasClass(c) || cache.disabled);
			}
			 
			if(self.rendered) {
				tooltip.toggleClass(c, state);
				$.attr(tooltip[0], 'aria-disabled', state);
			}
			else {
				cache.disabled = !!state;
			}

			return self;
		},
		
		enable: function() { self.disable(FALSE); },

		destroy: function()
		{
			var t = target[0],
				title = $.data(t, oldtitle);

			// Destroy tooltip and  any associated plugins if rendered
			if(self.rendered) {
				tooltip.remove();
				
				$.each(self.plugins, function() {
					if(this.destroy) { this.destroy(); }
				});
			}

			// Clear timers and remove bound events
			clearTimeout(self.timers.show);
			clearTimeout(self.timers.hide);
			unassignEvents(1, 1, 1, 1);

			// Remove api object
			$.removeData(t, 'qtip');

			// Reset old title attribute if removed 
			if(title) {
				$.attr(t, 'title', title);
			}

			// Remove ARIA attributes and bound qtip events
			target.removeAttr('aria-describedby').unbind('.qtip');

			return target;
		}
	});
}

// Initialization method
function init(id, opts)
{
	var obj, posOptions, attr, config,

	// Setup element references
	elem = $(this),
	docBody = $(document.body),

	// Use document body instead of document element if needed
	newTarget = this === document ? docBody : elem,

	// Grab metadata from element if plugin is present
	metadata = (elem.metadata) ? elem.metadata(opts.metadata) : NULL,

	// If metadata type if HTML5, grab 'name' from the object instead, or use the regular data object otherwise
	metadata5 = opts.metadata.type === 'html5' && metadata ? metadata[opts.metadata.name] : NULL,

	// Grab data from metadata.name (or data-qtipopts as fallback) using .data() method,
	html5 = elem.data(opts.metadata.name || 'qtipopts');

	// If we don't get an object returned attempt to parse it manualyl without parseJSON
	try { html5 = typeof html5 === 'string' ? (new Function("return " + html5))() : html5; }
	catch(e) { debug('Unable to parse HTML5 attribute data: ' + html5); }

	// Merge in and sanitize metadata
	config = $.extend(TRUE, {}, QTIP.defaults, opts, 
		typeof html5 === 'object' ? sanitizeOptions(html5) : NULL,
		sanitizeOptions(metadata5 || metadata));

	// Remove metadata object so we don't interfere with other metadata calls
	if(metadata) { $.removeData(this, 'metadata'); }

	// Re-grab our positioning options now we've merged our metadata and set id to passed value
	posOptions = config.position;
	config.id = id;
	
	// Setup missing content if none is detected
	if('boolean' === typeof config.content.text) {
		attr = elem.attr(config.content.attr);

		// Grab from supplied attribute if available
		if(config.content.attr !== FALSE && attr) { config.content.text = attr; }

		// No valid content was found, abort render
		else { return FALSE; }
	}

	// Setup target options
	if(posOptions.container === FALSE) { posOptions.container = docBody; }
	if(posOptions.target === FALSE) { posOptions.target = newTarget; }
	if(config.show.target === FALSE) { config.show.target = newTarget; }
	if(config.show.solo === TRUE) { config.show.solo = docBody; }
	if(config.hide.target === FALSE) { config.hide.target = newTarget; }
	if(config.position.viewport === TRUE) { config.position.viewport = posOptions.container; }

	// Convert position corner values into x and y strings
	posOptions.at = new PLUGINS.Corner(posOptions.at);
	posOptions.my = new PLUGINS.Corner(posOptions.my);

	// Destroy previous tooltip if overwrite is enabled, or skip element if not
	if($.data(this, 'qtip')) {
		if(config.overwrite) {
			elem.qtip('destroy');
		}
		else if(config.overwrite === FALSE) {
			return FALSE;
		}
	}

	// Remove title attribute and store it if present
	if($.attr(this, 'title')) {
		$.data(this, oldtitle, $.attr(this, 'title'));
		elem.removeAttr('title');
	}

	// Initialize the tooltip and add API reference
	obj = new QTip(elem, config, id, !!attr);
	$.data(this, 'qtip', obj);

	// Catch remove events on target element to destroy redundant tooltip
	elem.bind('remove.qtip', function(){ obj.destroy(); });

	return obj;
}

// jQuery $.fn extension method
QTIP = $.fn.qtip = function(options, notation, newValue)
{
	var command = ('' + options).toLowerCase(), // Parse command
		returned = NULL,
		args = command === 'disable' ? [TRUE] : $.makeArray(arguments).slice(1, 10),
		event = args[args.length - 1],
		opts = this[0] ? $.data(this[0], 'qtip') : NULL;

	// Check for API request
	if((!arguments.length && opts) || command === 'api') {
		return opts;
	}

	// Execute API command if present
	else if('string' === typeof options)
	{
		this.each(function()
		{
			var api = $.data(this, 'qtip');
			if(!api) { return TRUE; }

			// Cache the event if possible
			if(event && event.timeStamp) { api.cache.event = event; }

			// Check for specific API commands
			if(command === 'option' && notation) {
				if($.isPlainObject(notation) || newValue !== undefined) {
					api.set(notation, newValue);
				}
				else {
					returned = api.get(notation);
					return FALSE;
				}
			}

			// Execute API command
			else if(api[command]) {
				api[command].apply(api[command], args);
			}
		});

		return returned !== NULL ? returned : this;
	}

	// No API commands. validate provided options and setup qTips
	else if('object' === typeof options || !arguments.length)
	{
		opts = sanitizeOptions($.extend(TRUE, {}, options));

		// Bind the qTips
		return QTIP.bind.call(this, opts, event);
	}
};

// $.fn.qtip Bind method
QTIP.bind = function(opts, event)
{
	return this.each(function(i) {
		var options, targets, events,

		// Find next available ID, or use custom ID if provided
		id = (!opts.id || opts.id === FALSE || opts.id.length < 1 || $('#'+uitooltip+'-'+opts.id).length) ? QTIP.nextid++ : opts.id,

		// Setup events namespace
		namespace = '.qtip-'+id+'-create',

		// Initialize the qTip and re-grab newly sanitized options
		api = init.call(this, id, opts);
		if(api === FALSE) { return TRUE; }
		options = api.options;

		// Initialize plugins
		$.each(PLUGINS, function() {
			if(this.initialize === 'initialize') { this(api); }
		});

		// Determine hide and show targets
		targets = { show: options.show.target, hide: options.hide.target };
		events = {
			show: $.trim('' + options.show.event).replace(/ /g, namespace+' ') + namespace,
			hide: $.trim('' + options.hide.event).replace(/ /g, namespace+' ') + namespace
		};

		// Define hoverIntent function
		function hoverIntent(event) {
			function render() {
				// Cache mouse coords,render and render the tooltip
				api.render(typeof event === 'object' || options.show.ready);

				// Unbind show and hide event
				targets.show.unbind(events.show);
				targets.hide.unbind(events.hide);
			}

			// Only continue if tooltip isn't disabled
			if(api.cache.disabled) { return FALSE; }

			// Cache the event data
			api.cache.event = $.extend({}, event);

			// Start the event sequence
			if(options.show.delay > 0) {
				clearTimeout(api.timers.show);
				api.timers.show = setTimeout(render, options.show.delay);
				if(events.show !== events.hide) {
					targets.hide.bind(events.hide, function() { clearTimeout(api.timers.show); });
				}
			}
			else { render(); }
		}

		// Bind show events to target
		targets.show.bind(events.show, hoverIntent);

		// Prerendering is enabled, create tooltip now
		if(options.show.ready || options.prerender) { hoverIntent(event); }
	});
};

// Setup base plugins
PLUGINS = QTIP.plugins = {
	// Corner object parser
	Corner: function(corner) {
		corner = ('' + corner).replace(/([A-Z])/, ' $1').replace(/middle/gi, 'center').toLowerCase();
		this.x = (corner.match(/left|right/i) || corner.match(/center/) || ['inherit'])[0].toLowerCase();
		this.y = (corner.match(/top|bottom|center/i) || ['inherit'])[0].toLowerCase();

		this.precedance = (corner.charAt(0).search(/^(t|b)/) > -1) ? 'y' : 'x';
		this.string = function() { return this.precedance === 'y' ? this.y+this.x : this.x+this.y; };
		this.abbreviation = function() { 
			var x = this.x.substr(0,1), y = this.y.substr(0,1);
			return x === y ? x : (x === 'c' || (x !== 'c' && y !== 'c')) ? y + x : x + y;
		};
	},

	// Custom (more correct for qTip!) offset calculator
	offset: function(elem, container) {
		var pos = elem.offset(),
			parent = container,
			deep = 0,
			docBody = document.body,
			coffset;

		function scroll(e, i) {
			pos.left += i * e.scrollLeft();
			pos.top += i * e.scrollTop();
		}

		if(parent) {
			// Compensate for non-static containers offset
			do {
				if(parent[0] === docBody) { break; }
				else if(parent.css('position') !== 'static') {
					coffset = parent.position();
					pos.left -= coffset.left + (parseInt(parent.css('borderLeftWidth'), 10) || 0);
					pos.top -= coffset.top + (parseInt(parent.css('borderTopWidth'), 10) || 0);
					
					deep++;
				}
			}
			while(parent = parent.offsetParent());

			// Compensate for containers scroll if it also has an offsetParent
			if(container[0] !== docBody || deep > 1) { scroll( container, 1 ); }
			if(PLUGINS.iOS) { scroll( $(window), -1 ); }
		}

		return pos;
	},
	
	/*
	 * iOS 4.0 and below scroll fix detection used in offset() function.
	 */
	iOS: parseFloat(
		('' + (/CPU.*OS ([0-9_]{3})|(CPU like).*AppleWebKit.*Mobile/i.exec(navigator.userAgent) || [0,'4_2'])[1])
		.replace('undefined', '3_2').replace('_','.')
	) < 4.1,
	
	/*
	 * jQuery-secpfic $.fn overrides 
	 */
	fn: {
		/* Allow other plugins to successfully retrieve the title of an element with a qTip applied */
		attr: function(attr, val) {
			if(!this.length) { return; }
			
			var self = this[0],
			title = 'title',
			api = $.data(self, 'qtip');
			
			if(attr === title) {
				if(arguments.length < 2) {
					return $.data(self, oldtitle);
				}
				else if(typeof api === 'object') {
					// If qTip is rendered and title was originally used as content, update it
					if(api && api.rendered && api.options.content.attr === title && api.cache.attr) {
						api.set('content.text', val);
					}
					
					// Use the regular attr method to set, then cache the result
					$.fn['attr'+replaceSuffix].apply(this, arguments);
					$.data(self, oldtitle, $.attr(self, title));
					return this.removeAttr('title');
				}
			}
		},
		
		/* Allow clone to correctly retrieve cached title attributes */
		clone: function(keepData) {
			var titles = $([]), elem;
			
			// Re-add cached titles before we clone
			$('*', this).add(this).each(function() {
				var title = $.data(this, oldtitle);
				if(title) {
					$.attr(this, 'title', title);
					titles = titles.add(this);
				}
			});
			
			// Clone our element using the real clone method
			elem = $.fn['clone'+replaceSuffix].apply(this, arguments);
			
			// Remove the old titles again
			titles.removeAttr('title');
			
			return elem;
		},
		
		/* 
		 * Taken directly from jQuery 1.8.2 widget source code
		 * Trigger 'remove' event on all elements on removal if jQuery UI isn't present 
		 */
		remove: $.ui ? NULL : function( selector, keepData ) {
			$(this).each(function() {
				if (!keepData) {
					if (!selector || $.filter( selector, [ this ] ).length) {
						$('*', this).add(this).each(function() {
							$(this).triggerHandler('remove');
						});
					}
				}
			});
		}
	}
};

// Apply the fn overrides above
$.each(PLUGINS.fn, function(name, func) {
	if(!func) { return TRUE; }
	
	var old = $.fn[name+replaceSuffix] = $.fn[name];
	$.fn[name] = function() {
		return func.apply(this, arguments) || old.apply(this, arguments);
	};
});

// Cache mousemove events for positioning purposes
$(window).bind('load.qtip', function() {
	var type = 'mousemove';
	$(document).bind(type+'.qtip', function(event) {
		MOUSE = { pageX: event.pageX, pageY: event.pageY, type: type };
	});
});

// Set global qTip properties
QTIP.version = 'nightly';
QTIP.nextid = 0;
QTIP.inactiveEvents = 'click dblclick mousedown mouseup mousemove mouseleave mouseenter'.split(' ');
QTIP.zindex = 15000;

// Define configuration defaults
QTIP.defaults = {
	prerender: FALSE,
	id: FALSE,
	overwrite: TRUE,
	content: {
		text: TRUE,
		attr: 'title',
		title: {
			text: FALSE,
			button: FALSE
		}
	},
	position: {
		my: 'top left',
		at: 'bottom right',
		target: FALSE,
		container: FALSE,
		viewport: FALSE,
		adjust: {
			x: 0, y: 0,
			mouse: TRUE,
			resize: TRUE
		},
		effect: TRUE
	},
	show: {
		target: FALSE,
		event: 'mouseenter',
		effect: TRUE,
		delay: 90,
		solo: FALSE,
		ready: FALSE
	},
	hide: {
		target: FALSE,
		event: 'mouseleave',
		effect: TRUE,
		delay: 0,
		fixed: FALSE,
		inactive: FALSE
	},
	style: {
		classes: '',
		widget: FALSE
	},
	events: {
		render: NULL,
		move: NULL,
		show: NULL,
		hide: NULL,
		toggle: NULL,
		focus: NULL,
		blur: NULL
	}
};function Ajax(api)
{
	var self = this,
		tooltip = api.elements.tooltip,
		opts = api.options.content.ajax,
		namespace = '.qtip-ajax',
		rscript = /<script\b[^<]*(?:(?!<\/script>)<[^<]*)*<\/script>/gi;

	api.checks.ajax = {
		'^content.ajax': function(obj, name, v) {
			// If content.ajax object was reset, set our local var
			if(name === 'ajax') { opts = v; }

			if(name === 'once') {
				self.once(opts.once);
			}
			else if(opts && opts.url) {
				self.load();
			}
			else {
				self.once(0);
			}
		}
	};

	$.extend(self, {
		init: function()
		{
			// Make sure ajax options are enabled before proceeding
			if(opts && opts.url) {
				self.load();
				tooltip.one('tooltipshow', function() { self.once(opts.once); });
			}
		},

		once: function(state)
		{
			tooltip[ (state ? 'un' : '') + 'bind' ]('tooltipshow'+namespace, self.load);
		},

		load: function()
		{
			var hasSelector = opts.url.indexOf(' '), 
				url = opts.url,
				selector;

			// Check if user delcared a content selector like in .load()
			if(hasSelector > -1) {
				selector = url.substr(hasSelector);
				url = url.substr(0, hasSelector);
			}

			// Define success handler
			function successHandler(content) { 
				if(selector) {
					// Create a dummy div to hold the results and grab the selector element
					content = $('<div/>')
						// inject the contents of the document in, removing the scripts
						// to avoid any 'Permission Denied' errors in IE
						.append(content.replace(rscript, ""))
						
						// Locate the specified elements
						.find(selector);
				}

				// Set the content
				api.set('content.text', content);
			}

			// Error handler
			function errorHandler(xh, status, error){ api.set('content.text', status + ': ' + error); }

			// Setup $.ajax option object and process the request
			$.ajax( $.extend({ success: successHandler, error: errorHandler, context: api }, opts, { url: url }) );

			return self;
		}
	});

	self.init();
}


PLUGINS.ajax = function(api)
{
	var self = api.plugins.ajax;
	
	return 'object' === typeof self ? self : (api.plugins.ajax = new Ajax(api));
};

PLUGINS.ajax.initialize = 'render';

// Setup plugin sanitization
PLUGINS.ajax.sanitize = function(options)
{
	var content = options.content, opts;
	if(content && 'ajax' in content) {
		opts = content.ajax;
		if(typeof opts !== 'object') { opts = options.content.ajax = { url: opts }; }
		if('boolean' !== typeof opts.once && opts.once) { opts.once = !!opts.once; }
	}
};

// Extend original api defaults
$.extend(TRUE, QTIP.defaults, {
	content: {
		ajax: {
			once: TRUE
		}
	}
});PLUGINS.imagemap = function(area, corner)
{
	var shape = area.attr('shape').toLowerCase(),
		baseCoords = area.attr('coords').split(','),
		coords = [],
		image = $('img[usemap="#'+area.parent('map').attr('name')+'"]'),
		imageOffset = image.offset(),
		result = {
			width: 0, height: 0,
			offset: { top: 1e10, right: 0, bottom: 0, left: 1e10 }
		},
		i = 0, next = 0;

	// POLY area coordinate calculator
	//	Special thanks to Ed Cradock for helping out with this.
	//	Uses a binary search algorithm to find suitable coordinates.
	function polyCoordinates(result, coords)
	{
		var i = 0,
			compareX = 1, compareY = 1,
			realX = 0, realY = 0,
			newWidth = result.width,
			newHeight = result.height;

		// Use a binary search algorithm to locate most suitable coordinate (hopefully)
		while(newWidth > 0 && newHeight > 0 && compareX > 0 && compareY > 0)
		{
			newWidth = Math.floor(newWidth / 2);
			newHeight = Math.floor(newHeight / 2);

			if(corner.x === 'left'){ compareX = newWidth; }
			else if(corner.x === 'right'){ compareX = result.width - newWidth; }
			else{ compareX += Math.floor(newWidth / 2); }

			if(corner.y === 'top'){ compareY = newHeight; }
			else if(corner.y === 'bottom'){ compareY = result.height - newHeight; }
			else{ compareY += Math.floor(newHeight / 2); }

			i = coords.length; while(i--)
			{
				if(coords.length < 2){ break; }

				realX = coords[i][0] - result.offset.left;
				realY = coords[i][1] - result.offset.top;

				if((corner.x === 'left' && realX >= compareX) ||
				(corner.x === 'right' && realX <= compareX) ||
				(corner.x === 'center' && (realX < compareX || realX > (result.width - compareX))) ||
				(corner.y === 'top' && realY >= compareY) ||
				(corner.y === 'bottom' && realY <= compareY) ||
				(corner.y === 'center' && (realY < compareY || realY > (result.height - compareY)))) {
					coords.splice(i, 1);
				}
			}
		}

		return { left: coords[0][0], top: coords[0][1] };
	}

	// Make sure we account for padding and borders on the image
	imageOffset.left += Math.ceil((image.outerWidth() - image.width()) / 2);
	imageOffset.top += Math.ceil((image.outerHeight() - image.height()) / 2);

	// Parse coordinates into proper array
	if(shape === 'poly') {
		i = baseCoords.length; while(i--)
		{
			next = [ parseInt(baseCoords[--i], 10), parseInt(baseCoords[i+1], 10) ];

			if(next[0] > result.offset.right){ result.offset.right = next[0]; }
			if(next[0] < result.offset.left){ result.offset.left = next[0]; }
			if(next[1] > result.offset.bottom){ result.offset.bottom = next[1]; }
			if(next[1] < result.offset.top){ result.offset.top = next[1]; }

			coords.push(next);
		}
	}
	else {
		coords = $.map(baseCoords, function(coord){ return parseInt(coord, 10); });
	}

	// Calculate details
	switch(shape)
	{
		case 'rect':
			result = {
				width: Math.abs(coords[2] - coords[0]),
				height: Math.abs(coords[3] - coords[1]),
				offset: { left: coords[0], top: coords[1] }
			};
		break;

		case 'circle':
			result = {
				width: coords[2] + 2,
				height: coords[2] + 2,
				offset: { left: coords[0], top: coords[1] }
			};
		break;

		case 'poly':
			$.extend(result, {
				width: Math.abs(result.offset.right - result.offset.left),
				height: Math.abs(result.offset.bottom - result.offset.top)
			});

			if(corner.string() === 'centercenter') {
				result.offset = {
					left: result.offset.left + (result.width / 2),
					top: result.offset.top + (result.height / 2)
				};
			}
			else {
				result.offset = polyCoordinates(result, coords.slice());
			}

			result.width = result.height = 0;
		break;
	}

	// Add image position to offset coordinates
	result.offset.left += imageOffset.left;
	result.offset.top += imageOffset.top;

	return result;
};

// Tip coordinates calculator
function calculateTip(corner, width, height)
{	
	var width2 = Math.ceil(width / 2), height2 = Math.ceil(height / 2),

	// Define tip coordinates in terms of height and width values
	tips = {
		bottomright:	[[0,0],				[width,height],		[width,0]],
		bottomleft:		[[0,0],				[width,0],				[0,height]],
		topright:		[[0,height],		[width,0],				[width,height]],
		topleft:			[[0,0],				[0,height],				[width,height]],
		topcenter:		[[0,height],		[width2,0],				[width,height]],
		bottomcenter:	[[0,0],				[width,0],				[width2,height]],
		rightcenter:	[[0,0],				[width,height2],		[0,height]],
		leftcenter:		[[width,0],			[width,height],		[0,height2]]
	};

	// Set common side shapes
	tips.lefttop = tips.bottomright; tips.righttop = tips.bottomleft;
	tips.leftbottom = tips.topright; tips.rightbottom = tips.topleft;

	return tips[ corner.string() ];
}


function Tip(qTip, command)
{
	var self = this,
		opts = qTip.options.style.tip,
		elems = qTip.elements,
		tooltip = elems.tooltip,
		cache = { 
			top: 0, 
			left: 0, 
			corner: ''
		},
		size = {
			width: opts.width,
			height: opts.height
		},
		color = { },
		border = opts.border || 0,
		namespace = '.qtip-tip',
		hasCanvas = $('<canvas />')[0].getContext;

	self.corner = NULL;
	self.mimic = NULL;

	// Add new option checks for the plugin
	qTip.checks.tip = {
		'^position.my|style.tip.(corner|mimic|border)$': function() {
			// Make sure a tip can be drawn
			if(!self.init()) {
				self.destroy();
			}

			// Reposition the tooltip
			qTip.reposition();
		},
		'^style.tip.(height|width)$': function() {
			// Re-set dimensions and redraw the tip
			size = {
				width: opts.width,
				height: opts.height
			};
			self.create();
			self.update();

			// Reposition the tooltip
			qTip.reposition();
		},
		'^content.title.text|style.(classes|widget)$': function() {
			if(elems.tip) {
				self.update();
			}
		}
	};

	function reposition(event, api, pos, viewport) {
		if(!elems.tip) { return; }

		var newCorner = $.extend({}, self.corner),
			adjusted = pos.adjusted,
			offset;

		// Make sure our tip position isn't fixed e.g. doesn't adjust with adjust.screen
		if(self.corner.fixed !== TRUE) {
			// Adjust tip corners
			if(adjusted.left) {
				newCorner.x = newCorner.x === 'center' ? (adjusted.left > 0 ? 'left' : 'right') : (newCorner.x === 'left' ? 'right' : 'left');
			}
			if(adjusted.top) {
				newCorner.y = newCorner.y === 'center' ? (adjusted.top > 0 ? 'top' : 'bottom') : (newCorner.y === 'top' ? 'bottom' : 'top');
			}

			// Update and redraw the tip if needed
			if(newCorner.string() !== cache.corner && (cache.top !== adjusted.top || cache.left !== adjusted.left)) {
				offset = self.update(newCorner);
			}
		}

		// Adjust position to accomodate tip dimensions
		if(!offset) { offset = self.position(newCorner, 0); }
		if(offset.right !== undefined) { offset.left = offset.right; }
		if(offset.bottom !== undefined) { offset.top = offset.bottom; }
		offset.option = Math.max(0, opts.offset);

		pos.left -= offset.left.charAt ? offset.option : (offset.right ? -1 : 1) * offset.left;
		pos.top -= offset.top.charAt ? offset.option : (offset.bottom ? -1 : 1) * offset.top;

		// Cache details
		cache.left = adjusted.left; cache.top = adjusted.top;
		cache.corner = newCorner.string();
	}

	/* border width calculator */
	function borderWidth(corner, side, backup) {
		side = !side ? corner[corner.precedance] : side;

		var isTitleTop = elems.titlebar && corner.y === 'top',
			elem = isTitleTop ? elems.titlebar : elems.content,
			css = 'border-' + side + '-width',
			val = parseInt(elem.css(css), 10);

		return (backup ? val || parseInt(tooltip.css(css), 10) : val) || 0;
	}

	function borderRadius(corner) {
		var isTitleTop = elems.titlebar && corner.y === 'top',
			elem = isTitleTop ? elems.titlebar : elems.content,
			moz = $.browser.mozilla,
			prefix = moz ? '-moz-' : $.browser.webkit ? '-webkit-' : '',
			side = corner.y + (moz ? '' : '-') + corner.x,
			css = prefix + (moz ? 'border-radius-' + side : 'border-' + side + '-radius');

		return parseInt(elem.css(css), 10) || parseInt(tooltip.css(css), 10) || 0;
	}

	function calculateSize(corner) {
		var y = corner.precedance === 'y',
			width = size [ y ? 'width' : 'height' ],
			height = size [ y ? 'height' : 'width' ],
			isCenter = corner.string().indexOf('center') > -1,
			base = width * (isCenter ? 0.5 : 1),
			pow = Math.pow,
			round = Math.round,
			bigHyp, ratio, result,

		smallHyp = Math.sqrt( pow(base, 2) + pow(height, 2) ),
		
		hyp = [
			(border / base) * smallHyp, (border / height) * smallHyp
		];
		hyp[2] = Math.sqrt( pow(hyp[0], 2) - pow(border, 2) );
		hyp[3] = Math.sqrt( pow(hyp[1], 2) - pow(border, 2) );

		bigHyp = smallHyp + hyp[2] + hyp[3] + (isCenter ? 0 : hyp[0]);
		ratio = bigHyp / smallHyp;

		result = [ round(ratio * height), round(ratio * width) ];
		return { height: result[ y ? 0 : 1 ], width: result[ y ? 1 : 0 ] };
	}

	$.extend(self, {
		init: function()
		{
			var enabled = self.detectCorner() && (hasCanvas || $.browser.msie);

			// Determine tip corner and type
			if(enabled) {
				// Create a new tip and draw it
				self.create();
				self.update();

				// Bind update events
				tooltip.unbind(namespace).bind('tooltipmove'+namespace, reposition);
			}
			
			return enabled;
		},

		detectCorner: function()
		{
			var corner = opts.corner,
				posOptions = qTip.options.position,
				at = posOptions.at,
				my = posOptions.my.string ? posOptions.my.string() : posOptions.my;

			// Detect corner and mimic properties
			if(corner === FALSE || (my === FALSE && at === FALSE)) {
				return FALSE;
			}
			else {
				if(corner === TRUE) {
					self.corner = new PLUGINS.Corner(my);
				}
				else if(!corner.string) {
					self.corner = new PLUGINS.Corner(corner);
					self.corner.fixed = TRUE;
				}
			}

			return self.corner.string() !== 'centercenter';
		},

		detectColours: function() {
			var i,
				tip = elems.tip.css({ backgroundColor: '', border: '' }),
				corner = self.corner,
				precedance = corner[ corner.precedance ],

				borderSide = 'border-' + precedance + '-color',
				borderSideCamel = 'border' + precedance.charAt(0) + precedance.substr(1) + 'Color',

				invalid = /rgba?\(0, 0, 0(, 0)?\)|transparent/i,
				backgroundColor = 'background-color',
				transparent = 'transparent',

				bodyBorder = $(document.body).css('color'),
				contentColour = qTip.elements.content.css('color'),

				useTitle = elems.titlebar && (corner.y === 'top' || (corner.y === 'center' && tip.position().top + (size.height / 2) + opts.offset < elems.titlebar.outerHeight(1))),
				colorElem = useTitle ? elems.titlebar : elems.content,

			// Detect tip colours from CSS styles
			fill = tip.css(backgroundColor) || transparent,
			border = tip[0].style[ borderSideCamel ];

			// Make sure colours are valid
			if(!fill || invalid.test(fill)) {
				color.fill = colorElem.css(backgroundColor);
				if(invalid.test(color.fill)) {
					color.fill = tooltip.css(backgroundColor) || fill;
				}
			}
			if(!border || invalid.test(border)) {
				color.border = tooltip.css(borderSide);
				if(invalid.test(color.border) || color.border === bodyBorder) {
					color.border = colorElem.css(borderSide);
					if(color.border === contentColour) { color.border = border; }
				}
			}

			// Reset background and border colours
			$('*', tip).add(tip).css(backgroundColor, transparent).css('border', '0px dashed transparent');
		},

		create: function()
		{
			var width = size.width,
				height = size.height,
				vml;

			// Remove previous tip element if present
			if(elems.tip) { elems.tip.remove(); }

			// Create tip element and prepend to the tooltip
			elems.tip = $('<div />', { 'class': 'ui-tooltip-tip' }).css({ width: width, height: height }).prependTo(tooltip);

			// Create tip drawing element(s)
			if(hasCanvas) {
				// save() as soon as we create the canvas element so FF2 doesn't bork on our first restore()!
				$('<canvas />').appendTo(elems.tip)[0].getContext('2d').save();
			}
			else {
				vml = '<vml:shape coordorigin="0,0" style="display:block; position:absolute; behavior:url(#default#VML);"></vml:shape>';
				elems.tip.html( border ? vml += vml : vml );
			}
		},

		update: function(corner)
		{
			var tip = elems.tip,
				inner = tip.children(),
				width = size.width,
				height = size.height,
				regular = 'px solid ',
				transparent = 'px dashed transparent', // Dashed IE6 border-transparency hack. Awesome!
				mimic = opts.mimic,
				round = Math.round,
				precedance, context, coords, translate, newSize;

			// Re-determine tip if not already set
			if(!corner) { corner = self.corner; }

			// Use corner property if we detect an invalid mimic value
			if(mimic === FALSE) { mimic = corner; }

			// Otherwise inherit mimic properties from the corner object as necessary
			else {
				mimic = new PLUGINS.Corner(mimic);
				mimic.precedance = corner.precedance;

				if(mimic.x === 'inherit') { mimic.x = corner.x; }
				else if(mimic.y === 'inherit') { mimic.y = corner.y; }
				else if(mimic.x === mimic.y) {
					mimic[ corner.precedance ] = corner[ corner.precedance ];
				}
			}
			precedance = mimic.precedance;

			// Update our colours
			self.detectColours();

			// Detect border width, taking into account colours
			border = color.border === 'transparent' || color.border === '#123456' ? 0 :
				opts.border === TRUE ? borderWidth(corner, NULL, TRUE) : opts.border;

			// Calculate coordinates
			coords = calculateTip(mimic, width , height);

			// Determine tip size
			newSize = calculateSize(corner);
			tip.css(newSize);

			// Calculate tip translation
			if(corner.precedance === 'y') {
				translate = [
					round(mimic.x === 'left' ? border : mimic.x === 'right' ? newSize.width - width - border : (newSize.width - width) / 2),
					round(mimic.y === 'top' ?  newSize.height - height : 0)
				];
			}
			else {
				translate = [
					round(mimic.x === 'left' ? newSize.width - width : 0),
					round(mimic.y === 'top' ? border : mimic.y === 'bottom' ? newSize.height - height - border : (newSize.height - height) / 2)
				];
			}

			// Canvas drawing implementation
			if(hasCanvas) {
				// Set the canvas size using calculated size
				inner.attr(newSize);
				
				// Grab canvas context and clear/save it
				context = inner[0].getContext('2d');
				context.restore(); context.save();
				context.clearRect(0,0,3000,3000);
				
				// Translate origin
				context.translate(translate[0], translate[1]);
				
				// Draw the tip
				context.beginPath();
				context.moveTo(coords[0][0], coords[0][1]);
				context.lineTo(coords[1][0], coords[1][1]);
				context.lineTo(coords[2][0], coords[2][1]);
				context.closePath();
				context.fillStyle = color.fill;
				context.strokeStyle = color.border;
				context.lineWidth = border * 2;
				context.lineJoin = 'miter';
				context.miterLimit = 100;
				context.stroke();
				context.fill();
			}

			// VML (IE Proprietary implementation)
			else {
				// Setup coordinates string
				coords = 'm' + coords[0][0] + ',' + coords[0][1] + ' l' + coords[1][0] +
					',' + coords[1][1] + ' ' + coords[2][0] + ',' + coords[2][1] + ' xe';

				// Setup VML-specific offset for pixel-perfection
				translate[2] = border && /^(r|b)/i.test(corner.string()) ? 1 : 0;

				// Set initial CSS
				inner.css({
					antialias: ''+(mimic.string().indexOf('center') > -1),
					left: translate[0] - (translate[2] * Number(precedance === 'x')),
					top: translate[1] - (translate[2] * Number(precedance === 'y')),
					width: width + border,
					height: height + border
				})
				.each(function(i) {
					var $this = $(this);

					// Set shape specific attributes
					$this.attr({
						coordsize: (width+border) + ' ' + (height+border),
						path: coords,
						fillcolor: color.fill,
						filled: !!i,
						stroked: !!!i
					})
					.css({ display: border || i ? 'block' : 'none' });

					// Check if border is enabled and add stroke element
					if(!i && border > 0 && $this.html() === '') {
						$this.html(
							'<vml:stroke weight="'+(border*2)+'px" color="'+color.border+'" miterlimit="1000" joinstyle="miter" ' +
							' style="behavior:url(#default#VML); display:block;" />'
						);
					}
				});
			}

			return self.position(corner, 1);
		},

		// Tip positioning method
		position: function(corner, set)
		{
			var tip = elems.tip,
				position = {},
				offset = Math.max(0, opts.offset),
				precedance, dimensions, 
				adjust;

			// Return if tips are disabled or tip is not yet rendered
			if(opts.corner === FALSE || !tip) { return FALSE; }

			// Inherit corner if not provided
			corner = corner || self.corner;
			precedance = corner.precedance;

			// Determine which tip dimension to use for adjustment
			dimensions = calculateSize(corner);

			// Setup IE specific dimension adjustment
			adjust = $.browser.msie && border && /^(b|r)/i.test(corner.string()) ? 1 : 0;

			// Calculate tip position
			$.each(
				precedance === 'y' ? [ corner.x, corner.y ] : [ corner.y, corner.x ],
				function(i, side)
				{
					var b, br;

					if(side === 'center') {
						b = precedance === 'y' ? 'left' : 'top';
						position[ b ] = '50%';
						position['margin-' + b] = -Math.round(dimensions[ precedance === 'y' ? 'width' : 'height' ] / 2) + offset;
					}
					else {
						b = borderWidth(corner, side, TRUE);
						br = borderRadius(corner);

						position[ side ] = i || !border ?
							borderWidth(corner, side) + (!i ? br : 0) :
							offset + (br > b ? br : 0);
					}
				}
			);
			position[ corner[precedance] ] -= dimensions[ precedance === 'x' ? 'width' : 'height' ] + adjust;

			// Set and return new position
			if(set) { tip.css({ top: '', bottom: '', left: '', right: '', margin: '' }).css(position); }
			return position;
		},
		
		destroy: function()
		{
			// Remov tip and bound events
			if(elems.tip) { elems.tip.remove(); }
			tooltip.unbind(namespace);
		}
	});
	
	self.init();
}

PLUGINS.tip = function(api)
{
	var self = api.plugins.tip;
	
	return 'object' === typeof self ? self : (api.plugins.tip = new Tip(api));
};

// Initialize tip on render
PLUGINS.tip.initialize = 'render';

// Setup plugin sanitization options
PLUGINS.tip.sanitize = function(options)
{
	var style = options.style, opts;
	if(style && 'tip' in style) {
		opts = options.style.tip;
		if(typeof opts !== 'object'){ options.style.tip = { corner: opts }; }
		if(!(/string|boolean/i).test(typeof opts.corner)) { opts.corner = TRUE; }
		if(typeof opts.width !== 'number'){ delete opts.width; }
		if(typeof opts.height !== 'number'){ delete opts.height; }
		if(typeof opts.border !== 'number' && opts.border !== TRUE){ delete opts.border; }
		if(typeof opts.offset !== 'number'){ delete opts.offset; }
	}
};

// Extend original qTip defaults
$.extend(TRUE, QTIP.defaults, {
	style: {
		tip: {
			corner: TRUE,
			mimic: FALSE,
			width: 6,
			height: 6,
			border: TRUE,
			offset: 0
		}
	}
});PLUGINS.svg = function(svg, corner)
{
	var doc = $(document),
		elem = svg[0],
		result = {
			width: 0, height: 0,
			offset: { top: 1e10, left: 1e10 }
		},
		box, mtx, root, point, tPoint;

	if (elem.getBBox && elem.parentNode) {
		box = elem.getBBox();
		mtx = elem.getScreenCTM();
		root = elem.farthestViewportElement || elem;

		// Return if no method is found
		if(!root.createSVGPoint) { return result; }

		// Create our point var
		point = root.createSVGPoint();

		// Adjust top and left
		point.x = box.x;
		point.y = box.y;
		tPoint = point.matrixTransform(mtx);
		result.offset.left = tPoint.x;
		result.offset.top = tPoint.y;

		// Adjust width and height
		point.x += box.width;
		point.y += box.height;
		tPoint = point.matrixTransform(mtx);
		result.width = tPoint.x - result.offset.left;
		result.height = tPoint.y - result.offset.top;

		// Adjust by scroll offset
		result.offset.left += doc.scrollLeft();
		result.offset.top += doc.scrollTop();
	}

	return result;
};

function Modal(api)
{
	var self = this,
		options = api.options.show.modal,
		elems = api.elements,
		tooltip = elems.tooltip,
		
		selector = '#qtip-overlay',
		namespace = '.qtipmodal',
		events = 'tooltipshow'+namespace+' tooltiphide'+namespace;

	// Setup option set checks
	api.checks.modal = {
		'^show.modal.(on|blur)$': function() {
			// Initialise
			self.init();
			
			// Show the modal if not visible already and tooltip is visible
			elems.overlay.toggle( tooltip.is(':visible') );
		}
	};

	$.extend(self, {
		init: function()
		{
			if(options.on) {
				// Apply our modal events (unbind the mfirst so we don't duplicate)
				tooltip.unbind(namespace).bind(events, function(event, api, duration) {
					var type = event.type.replace('tooltip', '');

					if($.isFunction(options[type])) {
						options[type].call(elems.overlay, duration, api);
					}
					else {
						self[type](duration);
					}
				});

				// Create the overlay if needed
				self.create();

				// Hide tooltip on overlay click if enabled and toggle cursor style
				if(options.blur === TRUE) {
					elems.overlay.unbind(namespace+api.id).bind('click'+namespace+api.id, function(){ api.hide.call(api); });
				}
				elems.overlay.css('cursor', options.blur ? 'pointer' : '');
			}
		},

		create: function()
		{
			var elem = $(selector), overlay;

			// Return if overlay is already rendered
			if(elem.length) { elems.overlay = elem; return elem; }

			// Create document overlay
			overlay = elems.overlay = $('<div />', {
				id: selector.substr(1),
				css: {
					position: 'absolute',
					top: 0,
					left: 0,
					display: 'none'
				},
				mousedown: function() { return FALSE; }
			})
			.appendTo(document.body);

			// Update position on window resize or scroll
			$(window).bind('resize'+namespace, function() {
				overlay.css({
					height: Math.max( $(window).height(), $(document).height() ),
					width: Math.max( $(window).width(), $(document).width() )
				});
			})
			.trigger('resize');

			return overlay;
		},

		toggle: function(state)
		{
			var overlay = elems.overlay,
				effect = api.options.show.modal.effect,
				type = state ? 'show': 'hide',
				zindex;

			// Create our overlay if it isn't present already
			if(!overlay) { overlay = self.create(); }

			// Prevent modal from conflicting with show.solo
			if(overlay.is(':animated') && !state) { return; }

			// Setop all animations
			overlay.stop(TRUE, FALSE);

			// Set z-indx if we're showing it
			if(state) {
				zindex = parseInt( $.css(tooltip[0], 'z-index'), 10);
				overlay.css('z-index', (zindex || QTIP.zindex) - 1);
			}

			// Use custom function if provided
			if($.isFunction(effect)) {
				effect.call(overlay, state);
			}

			// If no effect type is supplied, use a simple toggle
			else if(effect === FALSE) {
				overlay[ type ]();
			}

			// Use basic fade function
			else {
				overlay.fadeTo(90, state ? 0.7 : 0, function() {
					if(!state) { $(this).hide(); }
				});
			}
		},

		show: function() { self.toggle(TRUE); },
		hide: function() { self.toggle(FALSE); },

		destroy: function()
		{
			var delBlanket = elems.overlay;

			if(delBlanket) {
				// Check if any other modal tooltips are present
				$(selector).each(function() {
					var api = $(this).data('qtip');

					// If another modal tooltip is present, leave overlay
					if(api && api.id !== api.id && api.options.show.modal) {
						return (delBlanket = FALSE);
					}
				});

				// Remove overlay if needed
				if(delBlanket) {
					elems.overlay.remove();
					$(window).unbind(namespace);
				}
				else {
					elems.overlay.unbind(namespace+api.id);
				}
			}

			// Remove bound events
			tooltip.unbind(events);
		}
	});

	self.init();
}

PLUGINS.modal = function(api)
{
	var self = api.plugins.modal;

	return 'object' === typeof self ? self : (api.plugins.modal = new Modal(api));
};

// Plugin needs to be initialized on render
PLUGINS.modal.initialize = 'render';

// Setup sanitiztion rules
PLUGINS.modal.sanitize = function(opts) {
	if(opts.show) { 
		if(typeof opts.show.modal !== 'object') { opts.show.modal = { on: !!opts.show.modal }; }
		else if(typeof opts.show.modal.on === 'undefined') { opts.show.modal.on = TRUE; }
	}
};

// Extend original api defaults
$.extend(TRUE, QTIP.defaults, {
	show: {
		modal: {
			on: FALSE,
			effect: TRUE,
			blur: TRUE
		}
	}
});/* 
 * BGIFrame adaption (http://plugins.jquery.com/project/bgiframe)
 * Special thanks to Brandon Aaron
 */
function BGIFrame(api)
{
	var self = this,
		elems = api.elements,
		tooltip = elems.tooltip,
		namespace = '.bgiframe-' + api.id,
		events = 'tooltipmove'+namespace+' tooltipshow'+namespace;

	$.extend(self, {
		init: function()
		{
			// Create the BGIFrame element
			elems.bgiframe = $('<iframe class="ui-tooltip-bgiframe" frameborder="0" tabindex="-1" src="javascript:\'\';" ' +
				' style="display:block; position:absolute; z-index:-1; filter:alpha(opacity=0);"></iframe>');

			// Append the new element to the tooltip
			elems.bgiframe.appendTo(tooltip);

			// Update BGIFrame on tooltip move
			tooltip.bind(events, self.adjust);
		},

		adjust: function()
		{
			var dimensions = api.get('dimensions'), // Determine current tooltip dimensions
				plugin = api.plugins.tip,
				tip = api.elements.tip,
				tipAdjust, offset;

			// Adjust border offset
			offset = parseInt(tooltip.css('border-left-width'), 10) || 0;
			offset = { left: -offset, top: -offset };

			// Adjust for tips plugin
			if(plugin && tip) {
				tipAdjust = (plugin.corner.precedance === 'x') ? ['width', 'left'] : ['height', 'top'];
				offset[ tipAdjust[1] ] -= tip[ tipAdjust[0] ]();
			}

			// Update bgiframe
			elems.bgiframe.css(offset).css(dimensions);
		},

		destroy: function()
		{
			// Remove iframe
			self.iframe.remove();

			// Remove bound events
			tooltip.unbind(events);
		}
	});

	self.init();
}

PLUGINS.bgiframe = function(api)
{
	var browser = $.browser,
		self = api.plugins.bgiframe;
	
	// Proceed only if the browser is IE6 and offending elements are present
	if(!PLUGINS.bgiframe.needBGI || !(browser.msie && browser.version.charAt(0) === '6')) {
		return FALSE;
	}

	return 'object' === typeof self ? self : (api.plugins.bgiframe = new BGIFrame(api));
};

// Plugin needs to be initialized on render
PLUGINS.bgiframe.initialize = 'render';

PLUGINS.bgiframe.needBGI = $('select, object').length > 0;

}(jQuery, window));

/* jquery/jquery.easyslider.js */

/*
 * 	Easy Slider 1.5 - jQuery plugin
 *	written by Alen Grakalic	
 *	http://cssglobe.com/post/4004/easy-slider-15-the-easiest-jquery-plugin-for-sliding
 *
 *	Copyright (c) 2009 Alen Grakalic (http://cssglobe.com)
 *	Dual licensed under the MIT (MIT-LICENSE.txt)
 *	and GPL (GPL-LICENSE.txt) licenses.
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
/*
 *	markup example for $("#slider").easySlider();
 *	
 * 	<div id="slider">
 *		<ul>
 *			<li><img src="images/01.jpg" alt="" /></li>
 *			<li><img src="images/02.jpg" alt="" /></li>
 *			<li><img src="images/03.jpg" alt="" /></li>
 *			<li><img src="images/04.jpg" alt="" /></li>
 *			<li><img src="images/05.jpg" alt="" /></li>
 *		</ul>
 *	</div>
 *
 */

(function($) {

	$.fn.easySlider = function(options){
	  
		// default configuration properties
		var defaults = {			
			prevId: 		'prevBtn',
			prevText: 		'Previous',
			nextId: 		'nextBtn',	
			nextText: 		'Next',
			controlsShow:	true,
			controlsBefore:	'',
			controlsAfter:	'',	
			controlsFade:	true,
			firstId: 		'firstBtn',
			firstText: 		'First',
			firstShow:		false,
			lastId: 		'lastBtn',	
			lastText: 		'Last',
			lastShow:		false,				
			vertical:		false,
			speed: 			800,
			auto:			false,
			pause:			2000,
			continuous:		false
		}; 
		
		var options = $.extend(defaults, options);  
				
		this.each(function() {  
			var obj = $(this); 				
			var s = $("li", obj).length;
			var w = $("li", obj).width(); 
			var h = $("li", obj).height(); 
			obj.width(w); 
			obj.height(h); 
			obj.css("overflow","hidden");
			var ts = s-1;
			var t = 0;
			$("ul", obj).css('width',s*w);			
			if(!options.vertical) $("li", obj).css('float','left');
			
			if(options.controlsShow){
				var html = options.controlsBefore;
				if(options.firstShow) html += '<span id="'+ options.firstId +'"><a href=\"javascript:void(0);\">'+ options.firstText +'</a></span>';
				html += ' <span id="'+ options.prevId +'"><a href=\"javascript:void(0);\">'+ options.prevText +'</a></span>';
				html += ' <span id="'+ options.nextId +'"><a href=\"javascript:void(0);\">'+ options.nextText +'</a></span>';
				if(options.lastShow) html += ' <span id="'+ options.lastId +'"><a href=\"javascript:void(0);\">'+ options.lastText +'</a></span>';
				html += options.controlsAfter;						
				$(obj).after(html);										
			};
	
			$("a","#"+options.nextId).click(function(){		
				animate("next",true);
			});
			$("a","#"+options.prevId).click(function(){		
				animate("prev",true);				
			});	
			$("a","#"+options.firstId).click(function(){		
				animate("first",true);
			});				
			$("a","#"+options.lastId).click(function(){		
				animate("last",true);				
			});		
			
			function animate(dir,clicked){
				var ot = t;				
				switch(dir){
					case "next":
						t = (ot>=ts) ? (options.continuous ? 0 : ts) : t+1;						
						break; 
					case "prev":
						t = (t<=0) ? (options.continuous ? ts : 0) : t-1;
						break; 
					case "first":
						t = 0;
						break; 
					case "last":
						t = ts;
						break; 
					default:
						break; 
				};	
				
				var diff = Math.abs(ot-t);
				var speed = diff*options.speed;						
				if(!options.vertical) {
					p = (t*w*-1);
					$("ul",obj).animate(
						{ marginLeft: p }, 
						speed
					);				
				} else {
					p = (t*h*-1);
					$("ul",obj).animate(
						{ marginTop: p }, 
						speed
					);					
				};
				
				if(!options.continuous && options.controlsFade){					
					if(t==ts){
						$("a","#"+options.nextId).hide();
						$("a","#"+options.lastId).hide();
					} else {
						$("a","#"+options.nextId).show();
						$("a","#"+options.lastId).show();					
					};
					if(t==0){
						$("a","#"+options.prevId).hide();
						$("a","#"+options.firstId).hide();
					} else {
						$("a","#"+options.prevId).show();
						$("a","#"+options.firstId).show();
					};					
				};				
				
				if(clicked) clearTimeout(timeout);
				if(options.auto && dir=="next" && !clicked){;
					timeout = setTimeout(function(){
						animate("next",false);
					},diff*options.speed+options.pause);
				};
				
			};
			// init
			var timeout;
			if(options.auto){;
				timeout = setTimeout(function(){
					animate("next",false);
				},options.pause);
			};		
		
			if(!options.continuous && options.controlsFade){					
				$("a","#"+options.prevId).hide();
				$("a","#"+options.firstId).hide();				
			};				
			
		});
	  
	};

})(jQuery);


/* jquery/jquery.prettyPhoto.js */

/* ------------------------------------------------------------------------
 * Class: prettyPhoto
 * Use: Lightbox clone for jQuery
 * Author: Stephane Caron (http://www.no-margin-for-errors.com)
 * Version: 3.0.2
 * ------------------------------------------------------------------------- */

(function($){$.prettyPhoto={version:'3.0.2'};$.fn.prettyPhoto=function(pp_settings){pp_settings=jQuery.extend({animation_speed:'fast',slideshow:false,autoplay_slideshow:false,opacity:0.80,show_title:true,allow_resize:true,default_width:500,default_height:344,counter_separator_label:'/',theme:'facebook',hideflash:false,wmode:'opaque',autoplay:true,modal:false,overlay_gallery:true,keyboard_shortcuts:true,changepicturecallback:function(){},callback:function(){},markup:'<div class="pp_pic_holder"> \
      <div class="ppt">&nbsp;</div> \
      <div class="pp_top"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
      <div class="pp_content_container"> \
       <div class="pp_left"> \
       <div class="pp_right"> \
        <div class="pp_content"> \
         <div class="pp_loaderIcon"></div> \
         <div class="pp_fade"> \
          <a href="#" class="pp_expand" title="Expand the image">Expand</a> \
          <div class="pp_hoverContainer"> \
           <a class="pp_next" href="#">next</a> \
           <a class="pp_previous" href="#">previous</a> \
          </div> \
          <div id="pp_full_res"></div> \
          <div class="pp_details clearfix"> \
           <p class="pp_description"></p> \
           <a class="pp_close" href="#">Close</a> \
           <div class="pp_nav"> \
            <a href="#" class="pp_arrow_previous">Previous</a> \
            <p class="currentTextHolder">0/0</p> \
            <a href="#" class="pp_arrow_next">Next</a> \
           </div> \
          </div> \
         </div> \
        </div> \
       </div> \
       </div> \
      </div> \
      <div class="pp_bottom"> \
       <div class="pp_left"></div> \
       <div class="pp_middle"></div> \
       <div class="pp_right"></div> \
      </div> \
     </div> \
     <div class="pp_overlay"></div>',gallery_markup:'<div class="pp_gallery"> \
        <a href="#" class="pp_arrow_previous">Previous</a> \
        <ul> \
         {gallery} \
        </ul> \
        <a href="#" class="pp_arrow_next">Next</a> \
       </div>',image_markup:'<img id="fullResImage" src="{path}" />',flash_markup:'<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" width="{width}" height="{height}"><param name="wmode" value="{wmode}" /><param name="allowfullscreen" value="true" /><param name="allowscriptaccess" value="always" /><param name="movie" value="{path}" /><embed src="{path}" type="application/x-shockwave-flash" allowfullscreen="true" allowscriptaccess="always" width="{width}" height="{height}" wmode="{wmode}"></embed></object>',quicktime_markup:'<object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" height="{height}" width="{width}"><param name="src" value="{path}"><param name="autoplay" value="{autoplay}"><param name="type" value="video/quicktime"><embed src="{path}" height="{height}" width="{width}" autoplay="{autoplay}" type="video/quicktime" pluginspage="http://www.apple.com/quicktime/download/"></embed></object>',iframe_markup:'<iframe src ="{path}" width="{width}" height="{height}" frameborder="no"></iframe>',inline_markup:'<div class="pp_inline clearfix">{content}</div>',custom_markup:''},pp_settings);var matchedObjects=this,percentBased=false,pp_dimensions,pp_open,pp_contentHeight,pp_contentWidth,pp_containerHeight,pp_containerWidth,windowHeight=$(window).height(),windowWidth=$(window).width(),pp_slideshow;doresize=true,scroll_pos=_get_scroll();$(window).unbind('resize.prettyphoto').bind('resize.prettyphoto',function(){_center_overlay();_resize_overlay();});if(pp_settings.keyboard_shortcuts){$(document).unbind('keydown.prettyphoto').bind('keydown.prettyphoto',function(e){if(typeof $pp_pic_holder!='undefined'){if($pp_pic_holder.is(':visible')){switch(e.keyCode){case 37:$.prettyPhoto.changePage('previous');e.preventDefault();break;case 39:$.prettyPhoto.changePage('next');e.preventDefault();break;case 27:if(!settings.modal)
$.prettyPhoto.close();e.preventDefault();break;};};};});}
$.prettyPhoto.initialize=function(){settings=pp_settings;if($.browser.msie&&parseInt($.browser.version)==6)settings.theme="light_square";theRel=$(this).attr('rel');galleryRegExp=/\[(?:.*)\]/;isSet=(galleryRegExp.exec(theRel))?true:false;pp_images=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return $(n).attr('href');}):$.makeArray($(this).attr('href'));pp_titles=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).find('img').attr('alt'))?$(n).find('img').attr('alt'):"";}):$.makeArray($(this).find('img').attr('alt'));pp_descriptions=(isSet)?jQuery.map(matchedObjects,function(n,i){if($(n).attr('rel').indexOf(theRel)!=-1)return($(n).attr('title'))?$(n).attr('title'):"";}):$.makeArray($(this).attr('title'));_buildOverlay(this);if(settings.allow_resize)
$(window).bind('scroll.prettyphoto',function(){_center_overlay();});set_position=jQuery.inArray($(this).attr('href'),pp_images);$.prettyPhoto.open();return false;}
$.prettyPhoto.open=function(event){if(typeof settings=="undefined"){settings=pp_settings;if($.browser.msie&&$.browser.version==6)settings.theme="light_square";_buildOverlay(event.target);pp_images=$.makeArray(arguments[0]);pp_titles=(arguments[1])?$.makeArray(arguments[1]):$.makeArray("");pp_descriptions=(arguments[2])?$.makeArray(arguments[2]):$.makeArray("");isSet=(pp_images.length>1)?true:false;set_position=0;}
if($.browser.msie&&$.browser.version==6)$('select').css('visibility','hidden');if(settings.hideflash)$('object,embed').css('visibility','hidden');_checkPosition($(pp_images).size());$('.pp_loaderIcon').show();if($ppt.is(':hidden'))$ppt.css('opacity',0).show();$pp_overlay.show().fadeTo(settings.animation_speed,settings.opacity);$pp_pic_holder.find('.currentTextHolder').text((set_position+1)+settings.counter_separator_label+$(pp_images).size());$pp_pic_holder.find('.pp_description').show().html(unescape(pp_descriptions[set_position]));(settings.show_title&&pp_titles[set_position]!=""&&typeof pp_titles[set_position]!="undefined")?$ppt.html(unescape(pp_titles[set_position])):$ppt.html('&nbsp;');movie_width=(parseFloat(grab_param('width',pp_images[set_position])))?grab_param('width',pp_images[set_position]):settings.default_width.toString();movie_height=(parseFloat(grab_param('height',pp_images[set_position])))?grab_param('height',pp_images[set_position]):settings.default_height.toString();if(movie_height.indexOf('%')!=-1){movie_height=parseFloat(($(window).height()*parseFloat(movie_height)/100)-150);percentBased=true;}
if(movie_width.indexOf('%')!=-1){movie_width=parseFloat(($(window).width()*parseFloat(movie_width)/100)-150);percentBased=true;}
$pp_pic_holder.fadeIn(function(){imgPreloader="";switch(_getFileType(pp_images[set_position])){case'image':imgPreloader=new Image();nextImage=new Image();if(isSet&&set_position<$(pp_images).size()-1)nextImage.src=pp_images[set_position+1];prevImage=new Image();if(isSet&&pp_images[set_position-1])prevImage.src=pp_images[set_position-1];$pp_pic_holder.find('#pp_full_res')[0].innerHTML=settings.image_markup.replace(/{path}/g,pp_images[set_position]);imgPreloader.onload=function(){pp_dimensions=_fitToViewport(imgPreloader.width,imgPreloader.height);_showContent();};imgPreloader.onerror=function(){alert('Image cannot be loaded. Make sure the path is correct and image exist.');$.prettyPhoto.close();};imgPreloader.src=pp_images[set_position];break;case'youtube':pp_dimensions=_fitToViewport(movie_width,movie_height);movie='http://www.youtube.com/v/'+grab_param('v',pp_images[set_position]);if(settings.autoplay)movie+="&autoplay=1";toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,movie);break;case'vimeo':pp_dimensions=_fitToViewport(movie_width,movie_height);movie_id=pp_images[set_position];var regExp=/http:\/\/(www\.)?vimeo.com\/(\d+)/;var match=movie_id.match(regExp);movie='http://player.vimeo.com/video/'+match[2]+'?title=0&amp;byline=0&amp;portrait=0';if(settings.autoplay)movie+="&autoplay=1;";vimeo_width=pp_dimensions['width']+'/embed/?moog_width='+pp_dimensions['width'];toInject=settings.iframe_markup.replace(/{width}/g,vimeo_width).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,movie);break;case'quicktime':pp_dimensions=_fitToViewport(movie_width,movie_height);pp_dimensions['height']+=15;pp_dimensions['contentHeight']+=15;pp_dimensions['containerHeight']+=15;toInject=settings.quicktime_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,pp_images[set_position]).replace(/{autoplay}/g,settings.autoplay);break;case'flash':pp_dimensions=_fitToViewport(movie_width,movie_height);flash_vars=pp_images[set_position];flash_vars=flash_vars.substring(pp_images[set_position].indexOf('flashvars')+10,pp_images[set_position].length);filename=pp_images[set_position];filename=filename.substring(0,filename.indexOf('?'));toInject=settings.flash_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{wmode}/g,settings.wmode).replace(/{path}/g,filename+'?'+flash_vars);break;case'iframe':pp_dimensions=_fitToViewport(movie_width,movie_height);frame_url=pp_images[set_position];frame_url=frame_url.substr(0,frame_url.indexOf('iframe')-1);toInject=settings.iframe_markup.replace(/{width}/g,pp_dimensions['width']).replace(/{height}/g,pp_dimensions['height']).replace(/{path}/g,frame_url);break;case'custom':pp_dimensions=_fitToViewport(movie_width,movie_height);toInject=settings.custom_markup;break;case'inline':myClone=$(pp_images[set_position]).clone().css({'width':settings.default_width}).wrapInner('<div id="pp_full_res"><div class="pp_inline clearfix"></div></div>').appendTo($('body')).show();doresize=false;pp_dimensions=_fitToViewport($(myClone).width(),$(myClone).height());doresize=true;$(myClone).remove();toInject=settings.inline_markup.replace(/{content}/g,$(pp_images[set_position]).html());break;};if(!imgPreloader){$pp_pic_holder.find('#pp_full_res')[0].innerHTML=toInject;_showContent();};});return false;};$.prettyPhoto.changePage=function(direction){currentGalleryPage=0;if(direction=='previous'){set_position--;if(set_position<0){set_position=0;return;};}else if(direction=='next'){set_position++;if(set_position>$(pp_images).size()-1){set_position=0;}}else{set_position=direction;};if(!doresize)doresize=true;$('.pp_contract').removeClass('pp_contract').addClass('pp_expand');_hideContent(function(){$.prettyPhoto.open();});};$.prettyPhoto.changeGalleryPage=function(direction){if(direction=='next'){currentGalleryPage++;if(currentGalleryPage>totalPage){currentGalleryPage=0;};}else if(direction=='previous'){currentGalleryPage--;if(currentGalleryPage<0){currentGalleryPage=totalPage;};}else{currentGalleryPage=direction;};itemsToSlide=(currentGalleryPage==totalPage)?pp_images.length-((totalPage)*itemsPerPage):itemsPerPage;$pp_pic_holder.find('.pp_gallery li').each(function(i){$(this).animate({'left':(i*itemWidth)-((itemsToSlide*itemWidth)*currentGalleryPage)});});};$.prettyPhoto.startSlideshow=function(){if(typeof pp_slideshow=='undefined'){$pp_pic_holder.find('.pp_play').unbind('click').removeClass('pp_play').addClass('pp_pause').click(function(){$.prettyPhoto.stopSlideshow();return false;});pp_slideshow=setInterval($.prettyPhoto.startSlideshow,settings.slideshow);}else{$.prettyPhoto.changePage('next');};}
$.prettyPhoto.stopSlideshow=function(){$pp_pic_holder.find('.pp_pause').unbind('click').removeClass('pp_pause').addClass('pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});clearInterval(pp_slideshow);pp_slideshow=undefined;}
$.prettyPhoto.close=function(){$.prettyPhoto.stopSlideshow();$pp_pic_holder.stop().find('object,embed').css('visibility','hidden');$('div.pp_pic_holder,div.ppt,.pp_fade').fadeOut(settings.animation_speed,function(){$(this).remove();});$pp_overlay.fadeOut(settings.animation_speed,function(){if($.browser.msie&&$.browser.version==6)$('select').css('visibility','visible');if(settings.hideflash)$('object,embed').css('visibility','visible');$(this).remove();$(window).unbind('scroll');settings.callback();doresize=true;pp_open=false;delete settings;});};function _showContent(){$('.pp_loaderIcon').hide();$ppt.fadeTo(settings.animation_speed,1);projectedTop=scroll_pos['scrollTop']+((windowHeight/2)-(pp_dimensions['containerHeight']/2));if(projectedTop<0)projectedTop=0;$pp_pic_holder.find('.pp_content').animate({height:pp_dimensions['contentHeight'],width:pp_dimensions['contentWidth']},settings.animation_speed);$pp_pic_holder.animate({'top':projectedTop,'left':(windowWidth/2)-(pp_dimensions['containerWidth']/2),width:pp_dimensions['containerWidth']},settings.animation_speed,function(){$pp_pic_holder.find('.pp_hoverContainer,#fullResImage').height(pp_dimensions['height']).width(pp_dimensions['width']);$pp_pic_holder.find('.pp_fade').fadeIn(settings.animation_speed);if(isSet&&_getFileType(pp_images[set_position])=="image"){$pp_pic_holder.find('.pp_hoverContainer').show();}else{$pp_pic_holder.find('.pp_hoverContainer').hide();}
if(pp_dimensions['resized']){$('a.pp_expand,a.pp_contract').show();}else{$('a.pp_expand,a.pp_contract').hide();}
if(settings.autoplay_slideshow&&!pp_slideshow&&!pp_open)$.prettyPhoto.startSlideshow();settings.changepicturecallback();pp_open=true;});_insert_gallery();};function _hideContent(callback){$pp_pic_holder.find('#pp_full_res object,#pp_full_res embed').css('visibility','hidden');$pp_pic_holder.find('.pp_fade').fadeOut(settings.animation_speed,function(){$('.pp_loaderIcon').show();callback();});};function _checkPosition(setCount){(setCount>1)?$('.pp_nav').show():$('.pp_nav').hide();};function _fitToViewport(width,height){resized=false;_getDimensions(width,height);imageWidth=width,imageHeight=height;if(((pp_containerWidth>windowWidth)||(pp_containerHeight>windowHeight))&&doresize&&settings.allow_resize&&!percentBased){resized=true,fitting=false;while(!fitting){if((pp_containerWidth>windowWidth)){imageWidth=(windowWidth-200);imageHeight=(height/width)*imageWidth;}else if((pp_containerHeight>windowHeight)){imageHeight=(windowHeight-200);imageWidth=(width/height)*imageHeight;}else{fitting=true;};pp_containerHeight=imageHeight,pp_containerWidth=imageWidth;};_getDimensions(imageWidth,imageHeight);};return{width:Math.floor(imageWidth),height:Math.floor(imageHeight),containerHeight:Math.floor(pp_containerHeight),containerWidth:Math.floor(pp_containerWidth)+40,contentHeight:Math.floor(pp_contentHeight),contentWidth:Math.floor(pp_contentWidth),resized:resized};};function _getDimensions(width,height){width=parseFloat(width);height=parseFloat(height);$pp_details=$pp_pic_holder.find('.pp_details');$pp_details.width(width);detailsHeight=parseFloat($pp_details.css('marginTop'))+parseFloat($pp_details.css('marginBottom'));$pp_details=$pp_details.clone().appendTo($('body')).css({'position':'absolute','top':-10000});detailsHeight+=$pp_details.height();detailsHeight=(detailsHeight<=34)?36:detailsHeight;if($.browser.msie&&$.browser.version==7)detailsHeight+=8;$pp_details.remove();$pp_title=$pp_pic_holder.find('.ppt');$pp_title.width(width);titleHeight=parseFloat($pp_title.css('marginTop'))+parseFloat($pp_title.css('marginBottom'));$pp_title=$pp_title.clone().appendTo($('body')).css({'position':'absolute','top':-10000});titleHeight+=$pp_title.height();$pp_title.remove();pp_contentHeight=height+detailsHeight;pp_contentWidth=width;pp_containerHeight=pp_contentHeight+titleHeight+$pp_pic_holder.find('.pp_top').height()+$pp_pic_holder.find('.pp_bottom').height();pp_containerWidth=width;}
function _getFileType(itemSrc){if(itemSrc.match(/youtube\.com\/watch/i)){return'youtube';}else if(itemSrc.match(/vimeo\.com/i)){return'vimeo';}else if(itemSrc.match(/\b.mov\b/i)){return'quicktime';}else if(itemSrc.match(/\b.swf\b/i)){return'flash';}else if(itemSrc.match(/\biframe=true\b/i)){return'iframe';}else if(itemSrc.match(/\bcustom=true\b/i)){return'custom';}else if(itemSrc.substr(0,1)=='#'){return'inline';}else{return'image';};};function _center_overlay(){if(doresize&&typeof $pp_pic_holder!='undefined'){scroll_pos=_get_scroll();contentHeight=$pp_pic_holder.height(),contentwidth=$pp_pic_holder.width();projectedTop=(windowHeight/2)+scroll_pos['scrollTop']-(contentHeight/2);if(projectedTop<0)projectedTop=0;$pp_pic_holder.css({'top':projectedTop,'left':(windowWidth/2)+scroll_pos['scrollLeft']-(contentwidth/2)});};};function _get_scroll(){if(self.pageYOffset){return{scrollTop:self.pageYOffset,scrollLeft:self.pageXOffset};}else if(document.documentElement&&document.documentElement.scrollTop){return{scrollTop:document.documentElement.scrollTop,scrollLeft:document.documentElement.scrollLeft};}else if(document.body){return{scrollTop:document.body.scrollTop,scrollLeft:document.body.scrollLeft};};};function _resize_overlay(){windowHeight=$(window).height(),windowWidth=$(window).width();if(typeof $pp_overlay!="undefined")$pp_overlay.height($(document).height()).width(windowWidth);};function _insert_gallery(){if(isSet&&settings.overlay_gallery&&_getFileType(pp_images[set_position])=="image"){itemWidth=52+5;navWidth=(settings.theme=="facebook")?58:38;itemsPerPage=Math.floor((pp_dimensions['containerWidth']-100-navWidth)/itemWidth);itemsPerPage=(itemsPerPage<pp_images.length)?itemsPerPage:pp_images.length;totalPage=Math.ceil(pp_images.length/itemsPerPage)-1;if(totalPage==0){navWidth=0;$pp_pic_holder.find('.pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous').hide();}else{$pp_pic_holder.find('.pp_gallery .pp_arrow_next,.pp_gallery .pp_arrow_previous').show();};galleryWidth=itemsPerPage*itemWidth+navWidth;$pp_pic_holder.find('.pp_gallery').width(galleryWidth).css('margin-left',-(galleryWidth/2));$pp_pic_holder.find('.pp_gallery ul').width(itemsPerPage*itemWidth).find('li.selected').removeClass('selected');goToPage=(Math.ceil((set_position+1)/itemsPerPage)<totalPage)?Math.ceil((set_position+1)/itemsPerPage):totalPage;$.prettyPhoto.changeGalleryPage(goToPage);$pp_pic_holder.find('.pp_gallery ul li:eq('+set_position+')').addClass('selected');}else{$pp_pic_holder.find('.pp_content').unbind('mouseenter mouseleave');$pp_pic_holder.find('.pp_gallery').hide();}}
function _buildOverlay(caller){$('body').append(settings.markup);$pp_pic_holder=$('.pp_pic_holder'),$ppt=$('.ppt'),$pp_overlay=$('div.pp_overlay');if(isSet&&settings.overlay_gallery){currentGalleryPage=0;toInject="";for(var i=0;i<pp_images.length;i++){if(!pp_images[i].match(/\b(jpg|jpeg|png|gif)\b/gi)){classname='default';}else{classname='';}
toInject+="<li class='"+classname+"'><a href='#'><img src='"+pp_images[i]+"' width='50' alt='' /></a></li>";};toInject=settings.gallery_markup.replace(/{gallery}/g,toInject);$pp_pic_holder.find('#pp_full_res').after(toInject);$pp_pic_holder.find('.pp_gallery .pp_arrow_next').click(function(){$.prettyPhoto.changeGalleryPage('next');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_gallery .pp_arrow_previous').click(function(){$.prettyPhoto.changeGalleryPage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_content').hover(function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeIn();},function(){$pp_pic_holder.find('.pp_gallery:not(.disabled)').fadeOut();});itemWidth=52+5;$pp_pic_holder.find('.pp_gallery ul li').each(function(i){$(this).css({'position':'absolute','left':i*itemWidth});$(this).find('a').unbind('click').click(function(){$.prettyPhoto.changePage(i);$.prettyPhoto.stopSlideshow();return false;});});};if(settings.slideshow){$pp_pic_holder.find('.pp_nav').prepend('<a href="#" class="pp_play">Play</a>')
$pp_pic_holder.find('.pp_nav .pp_play').click(function(){$.prettyPhoto.startSlideshow();return false;});}
$pp_pic_holder.attr('class','pp_pic_holder '+settings.theme);$pp_overlay.css({'opacity':0,'height':$(document).height(),'width':$(window).width()}).bind('click',function(){if(!settings.modal)$.prettyPhoto.close();});$('a.pp_close').bind('click',function(){$.prettyPhoto.close();return false;});$('a.pp_expand').bind('click',function(e){if($(this).hasClass('pp_expand')){$(this).removeClass('pp_expand').addClass('pp_contract');doresize=false;}else{$(this).removeClass('pp_contract').addClass('pp_expand');doresize=true;};_hideContent(function(){$.prettyPhoto.open();});return false;});$pp_pic_holder.find('.pp_previous, .pp_nav .pp_arrow_previous').bind('click',function(){$.prettyPhoto.changePage('previous');$.prettyPhoto.stopSlideshow();return false;});$pp_pic_holder.find('.pp_next, .pp_nav .pp_arrow_next').bind('click',function(){$.prettyPhoto.changePage('next');$.prettyPhoto.stopSlideshow();return false;});_center_overlay();};return this.unbind('click.prettyphoto').bind('click.prettyphoto',$.prettyPhoto.initialize);};function grab_param(name,url){name=name.replace(/[\[]/,"\\\[").replace(/[\]]/,"\\\]");var regexS="[\\?&]"+name+"=([^&#]*)";var regex=new RegExp(regexS);var results=regex.exec(url);return(results==null)?"":results[1];}})(jQuery);


/* jquery/jquery.listOrderChangerPanel.js */

/*
 * 	listOrderChangerPanel - jQuery plugin (AVL)
 *
 *	Built for jQuery library
 *	http://jquery.com
 *
 */
 
/*
 *	markup example for $("#listOrderChangerPanel").listOrderChangerPanel();
 *	
 * 	<div id="listOrderChangerPanel">
 * 		<span id="priorityDisplay"></span>
 * 		<a href="javascript:void(0);" id="increasePriority">▲</a><a href="javascript:void(0);" id="decreasePriority">▼</a>
 * 	</div>
 *
 */

(function($) {

	$.fn.listOrderChangerPanel = function(options){
		// default configuration properties
		var defaults = {
			formName:			'',
			selectName:			'',
			priorityDisplay:	'priorityDisplay',
			changeStatusField:	'',
			up:					'increasePriority',
			down:				'decreasePriority',
			first:				1
		}; 
		
		var options = $.extend(defaults, options);  
				
		this.each(function(){  
			var obj = $(this);
			$("#"+options.up+","+"#"+options.down, obj)
			.mouseup(function(){
				if(parseInt(options.first) == "NaN"){alert("Error: listOrderChangerPanel: argument 'first' must be of type integer");return false;}
				var f = options.formName == "" ? $("form") : $("form[name='"+options.formName+"']");
				var s = options.selectName == "" ? $("select:eq(0)", f) : $("select[name='"+options.selectName+"']", f);
				var si = $(s).prop("selectedIndex");
				if(typeof(f) != "object"){alert("Error: listOrderChangerPanel: Formular nicht gefunden.");return false;}
				if(typeof(s) != "object"){alert("Error: listOrderChangerPanel: Select-Element nicht gefunden.");return false;}
				var optionsLen = $("option", s).length;
				if($(this).attr("id") == options.up)
				{
					if(si >= options.first)
					{
						$(":selected", s).insertBefore($(":selected", s).prev());
						si--;
					}
				}
				else
				{
					if(si+1 >= options.first)
					{
						$(":selected", s).insertAfter($(":selected", s).next());
						if(si < optionsLen-1) si++;
					}
				}
				$(s).attr("selectedIndex", si);
				if(options.priorityDisplay != "")
				{
					var pd = $("#"+options.priorityDisplay);
					if(typeof(pd) == "object" && si+1 >= options.first)
						$(pd).stop(true,true).fadeIn("slow").html(si+1-options.first+1).fadeOut("slow");
				}
				if(options.changeStatusField != "")
				{
					var changeStatusField = $("#"+options.changeStatusField);
					if(typeof(changeStatusField) == "object") $(changeStatusField).val(1);
					else {alert("Error: listOrderChangerPanel: Select-Element nicht gefunden.");return false;}
				}
			});
		});
	  
	};

})(jQuery);


/* jquery/jquery.preloader.js */

/* jQuery.preloader - v0.95 - K Reeve aka BinaryKitten
*
* v0.95
* 	# Note - keeping below v1 as really not sure that I consider it public usable.
* 	# But it saying that it does the job it was intended to do.
* 	Added Completion of loading callback.
* 	Main Reworking With Thanks to Remy Sharp of jQuery for Designers
*
*
* v0.9
* 	Fixed .toString being .toSteing
*
* v0.8
*		Fixed sheet.href being null error (was causing issues in FF3RC1)
*
* v0.7
*		Remade the preLoadImages from jQuery to DOM
*
* v0.6
* 		Fixed IE6 Compatability!
*		Moved from jQuery to DOM
*
* v0.5
* 		Shifted the additionalimages loader in the preLoadAllImages so it wasn't called multiple times
* 		Created secondary .preLoadImages to handle additionalimages and so it can be called on itself
* 
* examples:
* 

$.preLoadImages(
     [
          'http://www.google.co.uk/intl/en_uk/images/logo.gif',
          'http://l.yimg.com/eur.yimg.com/i/uk/hp/yahoo1.png',
          'http://tk2.stc.s-msn.com/br/hp/11/en-us/css/i/msn_b2.gif'
     ],function(){
          alert('All Passed Images Loaded');
     }
);

##

$.preLoadCSSImages(function(){
     alert('All CSS Images Loaded');
});

##

$.preLoadAllImages(
     [
          'http://www.google.co.uk/intl/en_uk/images/logo.gif',
          'http://l.yimg.com/eur.yimg.com/i/uk/hp/yahoo1.png',
          'http://tk2.stc.s-msn.com/br/hp/11/en-us/css/i/msn_b2.gif'
     ],function(){
          alert('All Passed Images and All CSS Images Loaded');
     }
);

##

$.preLoadImages('/images/loader.gif',function() {
  $('<img />').attr({
  	src:'/images/loader.gif',
  	id:'loader'
  }).appendTo('#position');
  $.preLoadCSSImages(function() {
     $('#loader').remove();
  })
});


* 
*/

(function ($) {
	$.preLoadImages = function(imageList,callback) {
		var pic = [], i, total, loaded = 0;
		if (typeof imageList != 'undefined') {
			if ($.isArray(imageList)) {
				total = imageList.length; // used later
					for (i=0; i < total; i++) {
						pic[i] = new Image();
						pic[i].onload = function() {
							loaded++; // should never hit a race condition due to JS's non-threaded nature
							if (loaded == total) {
								if ($.isFunction(callback)) {
									callback();
								}
							}
						};
						pic[i].src = imageList[i];
					}
			}
			else {
				pic[0] = new Image();
				pic[0].onload = function() {
					if ($.isFunction(callback)) {
						callback();
					}
				}
				pic[0].src = imageList;
			}
		}
		pic = undefined;
	};

	$.preLoadCSSImages = function(callback) {
		var pic = [], i, imageList = [], loaded = 0, total, regex = new RegExp("url\((.*)\)",'i'),spl;
		var cssSheets = document.styleSheets, path,myRules,Rule,match,txt,img,sheetIdx,ruleIdx;
		for (sheetIdx=0;sheetIdx < cssSheets.length;sheetIdx++){
			var sheet = cssSheets[sheetIdx];
			if (typeof sheet.href == 'string' && sheet.href.length > 0) {
				spl = sheet.href.split('/');spl.pop();path = spl.join('/')+'/';
			}
			else {
				path = './';
			}
			myRules = sheet.cssRules ? sheet.cssRules : sheet.rules;
			for (ruleIdx=0;ruleIdx < myRules.length;ruleIdx++) {
				Rule = myRules[ruleIdx];
				txt = Rule.cssText ? Rule.cssText : Rule.style.cssText;
				match = regex.exec(txt);
				if (match != null) {
					img = match[1].substring(1,match[1].indexOf(')',1));
					if (img.substring(0,4) == 'http') {
						imageList[imageList.length] = img;
					}
					else if ( match[1].substring(1,2) == '/') {
						var p2 = path.split('/');p2.pop();p2.pop();p2x = p2.join("/");
						imageList[imageList.length] = p2x+img;
					}
					else {
						imageList[imageList.length] = path+img;
					}
				}
			};
		};

		total = imageList.length; // used later
		for (i=0; i < total; i++) {
			pic[i] = new Image();
			pic[i].onload = function() {
				loaded++; // should never hit a race condition due to JS's non-threaded nature
				if (loaded == total) {
					if ($.isFunction(callback)) {
						callback();
					}
				}
			};
			pic[i].src = imageList[i];
		}

	};
	$.preLoadAllImages = function(imageList,callback) {
		if (typeof imageList != 'undefined') {
			if ($.isFunction(imageList)) {
				callback = imageList;
			}
			else if (!$.isArray(imageList)) {
				imageList = [imageList];
			}
		}
		$.preLoadCSSImages(function(){
			if (imageList.length > 0) {
				$.preLoadImages(imageList,function(){
					callback();
				});
			}
			else {
				callback();
			}
		});
	}
})(jQuery);


/* jquery/jquery.customButtons.js */


/**
 * customButton - jQuery plugin (AVL)
 * 
 * Built for jQuery library
 * http://jquery.com
 * 
 */

// REQUIRED CSS:
//
//#content .buttonCentered
//{
//	display:table;
//	margin: auto;
//}
//
///*bei verwendung der ie6/ie7 version nachfolgendes float-clearing erforderlich - in button-js-funktion bereits implementiert.*/
//
///*IE6 only*/
//* html .buttonCentered
//{
//	float:left;
//	left:50%;
//	position: relative;
//}
//
///*IE7 only*/
//*:first-child+html .buttonCentered span.button
//{
//	float:left;
//	left: -50%;
//	position:relative;
//}
//
//#content span.button2
//{
//	display: inline;
//}
//
//#content span.button2 img
//{
//	border: none;
//	display:block;
//	float:left;
//}
//
//#content span.button2 a.buttonText,
//#content span.button2 input
//{
//	display:block;
//	float:left;
//	padding:0 3px 0 3px;
//	background-image: url(../img/b_bg_0088CC_a.gif);
//	background-color: #0088CC;
//	color:#FFF;	
//	font-family:Tahoma,Arial,sans-serif;
//	font-size:10px;
//	font-weight:bold;
//	text-align: center;
//	text-decoration:none;
//}
//
//#content span.button2Link a.buttonText,
//#content span.button2Link input
//{
//	background-image: url(../img/b_bg_0088CC_a.gif);
//	background-color: #0088CC;
//}
//
//#content span.button2Action a.buttonText,
//#content span.button2Action input
//{
//	background-image: url(../img/b_bg_0CAF00_a.gif);
//	background-color: #0CAF00 ;
//}
//
//#content span.button2ActionBg0088CC a.buttonText,
//#content span.button2ActionBg0088CC input
//{
//	background-image: url(../img/b_bg_0CAF00_bg_0088CC_a.gif);
//	background-color: #0088CC;
//}
//
//#content span.button2Caution a.buttonText,
//#content span.button2Caution input
//{
//	background-image: url(../img/b_bg_D91E36_a.gif);
//	background-color: #D91E36;
//}
//
//#content span.button2Inactive a.buttonText,
//#content span.button2Inactive input
//{
//	background-image: url(../img/b_bg_CCCCCD_a.gif);
//	background-color: #CCCCCD;
//}
//
//#content span.button2 input
//{
//	height:17px;
//	border:none;
//	margin:0;
//	padding:1px 4px 1px 4px;
//	/*background-color:transparent;*/
//}
//
//#content span.button2 input:hover
//{
//	cursor: pointer;
//}
//
///*IE6 only*/
//* html #content span.button2 input
//{
//	padding:1px 0px 1px 0px;
//	margin:0 -2px 0 -1px;
//}
//
///*IE7 only*/
//*:first-child+html #content span.button2 input
//{
//	padding:1px 0px 1px 0px;
//	margin:0 -2px 0 -1px;
//}
//
///*Mozilla only*/
//@-moz-document url-prefix()
//{
//    #content span.button2 input
//    {
//    	height:auto;
//    	padding:1px;
//    }
//}
//
//#content span.button2 a.buttonText img
//{
//	float:none;
//	display:inline;
//	vertical-align:-5px;
//	visibility: hidden;
//}
//
//#content span.button2 br
//{
//	clear:both;
//	visibility: hidden;
//	line-height:0;
//	font-size:0;
//	height:0;
//}

(function($) {

	$.fn.customButtons = function(){
		
		var regExpImgPos = /((^|\/)b_)(bg|rgt|lft)/;
		var regExpImgPosReplaceLft = "$1lft";
		var regExpImgPosReplaceRgt = "$1rgt";
		var regExpCssUrl = /^url\(("?([^"]*)"?|'?([^"]*)'?)\)$/;
		var regExpCssUrlReplace = "$2";
		
		var buttonObj = $("a.button, form input.button");
		
		$(buttonObj).each(function(){

			/*for ie6+7*/
			var buttonContainer = $(this).parent();
			if($(buttonContainer).hasClass('buttonCentered'))
				$(buttonContainer).after('<br class="clear" />');
			
			var skype = $('img.skype',this).detach();

			var $isA = this.nodeName.toUpperCase() == 'A';
			
			$(this).wrap('<span class="'+$(this).attr('class')+'" />');
			if($isA)
				$(this).attr('class','buttonText');
			
			var imgUrl = $(this).css('background-image').replace(regExpCssUrl, regExpCssUrlReplace);
			
			if($isA)
				$(this)
					.prepend('<img src="'+imgUrl+'" alt="" />')
					.append('<img src="'+imgUrl+'" alt="" />');
			$(this)
				.before(($isA ? '<a href="'+$(this).attr('href')+'">' : '')+'<img src="'+imgUrl.replace(regExpImgPos,regExpImgPosReplaceLft)+'" alt="" />'+($isA ? '</a>' : ''))
				.after(($isA ? '<a href="'+$(this).attr('href')+'">' : '')+'<img src="'+imgUrl.replace(regExpImgPos,regExpImgPosReplaceRgt)+'" alt="" />'+($isA ? '</a>' : '')+'<br />')
				.after($(skype).length > 0 ? skype : '');

			if(!$isA)
				$(this).removeAttr('class');
			
			var regExpImg = /(a|b)(\.[a-z]{3,4}("|')?\)?)$/i;
			var regExpImgReplaceA = "a$2";
			var regExpImgReplaceB = "b$2";
			
			$(this.parentNode)
			.mouseover(function(){
				$('img',this)
				.each(function(){
					$(this).attr('src', $(this).attr('src').replace(regExpImg, regExpImgReplaceB));
				});
				$('a.buttonText, input',this)
				.each(function(){
					$(this).css('background-image',$(this).css('background-image').replace(regExpImg, regExpImgReplaceB));
				});
			})
			.mouseout(function(){
				$('img',this)
				.each(function(){
					$(this).attr('src', $(this).attr('src').replace(regExpImg, regExpImgReplaceA));
				});
				$('a.buttonText, input',this)
				.each(function(){
					$(this).css('background-image',$(this).css('background-image').replace(regExpImg, regExpImgReplaceA));
				});
			});
			
		});
	};
	
})(jQuery);


/* jquery/jquery.overlayBox.js */


/**
 * customButton - jQuery plugin (AVL)
 * 
 * Built for jQuery library
 * http://jquery.com
 * 
 */

//REQUIRED CSS:
//
//.overlayBox
//{
//	position:relative;
//	width:250px;
//	height:200px;
//	padding:8px;
//}
//
//.overlayBox .overlayBoxContent
//{
//	position:relative;
//	overflow:hidden;
//	width:248px;
//	height:198px;
//	border:1px solid #B3B3B3;
//	background-color:#FFFFFF;
//}
//
//.overlayBox .overlayBoxShadowTop
//{
//	position:absolute;
//	top:0;
//	left:0;
//	width:236px;
//	height:8px;
//	margin:0 15px 0 15px;
//	background: url(../img/social_overlay_shadow_top.png) 0 0 repeat-x;
//}
//
//.overlayBox .overlayBoxShadowRight
//{
//	position:absolute;
//	top:0;
//	right:-7px;
//	width:15px;
//	height:186px;
//	margin:15px 0 15px 0;
//	background: url(../img/social_overlay_shadow_rgt.png) 0 0 repeat-y;
//}
//
//.overlayBox .overlayBoxShadowBottom
//{
//	position:absolute;
//	bottom:0;
//	left:0;
//	width:236px;
//	height:8px;
//	margin:0 15px 0 15px;
//	background: url(../img/social_overlay_shadow_bottom.png) 0 0 repeat-x;
//}
//
//.overlayBox .overlayBoxShadowLeft
//{
//	position:absolute;
//	top:0;
//	left:0;
//	width:15px;
//	height:186px;
//	margin:15px 0 15px 0;
//	background: url(../img/social_overlay_shadow_lft.png) 0 0 repeat-y;
//}
//
//.overlayBox .overlayBoxShadowTopLeft
//{
//	position:absolute;
//	top:0;
//	left:0;
//	width:15px;
//	height:15px;
//	background: url(../img/social_overlay_shadow_corner_top_lft.png) 0 0 no-repeat;
//}
//
//.overlayBox .overlayBoxShadowTopRight
//{
//	position:absolute;
//	top:0;
//	right:0;
//	width:15px;
//	height:15px;
//	background: url(../img/social_overlay_shadow_corner_top_rgt.png) 0 0 no-repeat;
//}
//
//.overlayBox .overlayBoxShadowBottomRight
//{
//	position:absolute;
//	bottom:0;
//	right:0;
//	width:15px;
//	height:15px;
//	background: url(../img/social_overlay_shadow_corner_bottom_rgt.png) 0 0 no-repeat;
//}
//
//.overlayBox .overlayBoxShadowBottomLeft
//{
//	position:absolute;
//	bottom:0;
//	left:0;
//	width:15px;
//	height:15px;
//	background: url(../img/social_overlay_shadow_corner_bottom_lft.png) 0 0 no-repeat;
//}
//
//.overlayBox .overlayBoxArrowUpBgFFFFFFBorderB3B3B3
//{
//	position:absolute;
//	top:0px;
//	right:15px;
//	width:16px;
//	height:9px;
//	background: url(../img/social_overlay_arrow_up_bg_FFFFFF_border_B3B3B3.png) 0 0 repeat-x;
//}

(function($) {

	$.fn.overlayBox = function(options){
		
		// default configuration properties
		var defaults = {
			'width'		: 250,
			'height'	: 200,
			'arrowUp'	: 'social_overlay_arrow_up_bg_FFFFFF_border_B3B3B3.png',
			'content'	: null,
			'target'	: null
		}; 
		
		var options = $.extend(defaults, options);
		var borderWidth = 1;

		var w = options.width;
		var h = options.height;
		var bw = borderWidth;

		var box = "";
		box+= '<div class="overlayBox" style="width:'+w+'px;height:'+h+'px;">'+"\n";
		box+= '	<div class="overlayBoxContent" style="width:'+(w-bw*2)+'px;height:'+(h-bw*2)+'px">'+"\n";
		if(typeof options.content == 'string')
			box+= '	'+options.content;
		box+= '	</div>'+"\n";
		box+= '	<div class="overlayBoxShadowTop" style="width:'+(w-14)+'px"></div>'+"\n";
		box+= '	<div class="overlayBoxShadowRight" style="height:'+(h-14)+'px"></div>'+"\n";
		box+= '	<div class="overlayBoxShadowBottom" style="width:'+(w-14)+'px"></div>'+"\n";
		box+= '	<div class="overlayBoxShadowLeft" style="height:'+(h-14)+'px"></div>'+"\n";
		box+= '	<div class="overlayBoxShadowTopLeft" style=""></div>'+"\n";
		box+= '	<div class="overlayBoxShadowTopRight" style=""></div>'+"\n";
		box+= '	<div class="overlayBoxShadowBottomRight" style=""></div>'+"\n";
		box+= '	<div class="overlayBoxShadowBottomLeft" style=""></div>'+"\n";
		box+= '	<div class="overlayBoxArrowUpBgFFFFFFBorderB3B3B3" style="background-image:url(../img/'+options.arrowUp+');"></div>'+"\n";
		box+= '</div>';
		box = $(box);

		if(typeof options.content == 'object')
			$('.overlayBoxContent',box).append(options.content);
		
		if(typeof options.target == 'object')
			$(options.target).append(box);
		else
			return $(box);
	};

})(jQuery);


/* jquery/jquery.truncator.js */

// HTML Truncator for jQuery
// by Henrik Nyh <http://henrik.nyh.se> 2008-02-28.
// Free to modify and redistribute with credit.

(function($) {

  var trailing_whitespace = true;

  $.fn.truncate = function(options) {

    var opts = $.extend({}, $.fn.truncate.defaults, options);
    
    $(this).each(function() {

      var content_length = $.trim(squeeze($(this).text())).length;
      if (content_length <= opts.max_length)
        return;  // bail early if not overlong

      var actual_max_length = opts.max_length - opts.more.length - 4;  // 4 for " ..." and "    "
      var truncated_node = recursivelyTruncate(this, actual_max_length);
      var full_node = $(this).hide();

      truncated_node.insertAfter(full_node);
      
      findNodeForMore(truncated_node).append('... <a href="#show more content" class="arrowLink">'+opts.more+'</a>');
      findNodeForLess(full_node).append('    <a href="#show less content" class="arrowLink">'+opts.less+'</a>');
      
      truncated_node.find('a:last').click(function() {
        truncated_node.hide(); full_node.show(); return false;
      });
      full_node.find('a:last').click(function() {
        truncated_node.show(); full_node.hide(); return false;
      });

    });
  };

  // Note that the " (…more)" bit counts towards the max length – so a max
  // length of 10 would truncate "1234567890" to "12 (…more)".
  $.fn.truncate.defaults = {
    max_length: 100,
    more: '…more',
    less: 'less'
  };

  function recursivelyTruncate(node, max_length) {
    return (node.nodeType == 3) ? truncateText(node, max_length) : truncateNode(node, max_length);
  }

  function truncateNode(node, max_length) {
    var node = $(node);
    var new_node = node.clone().empty();
    var truncatedChild;
    node.contents().each(function() {
      var remaining_length = max_length - new_node.text().length;
      if (remaining_length == 0) return;  // breaks the loop
      truncatedChild = recursivelyTruncate(this, remaining_length);
      if (truncatedChild) new_node.append(truncatedChild);
    });
    return new_node;
  }

  function truncateText(node, max_length) {
    var text = squeeze(node.data);
    if (trailing_whitespace)  // remove initial whitespace if last text
      text = text.replace(/^ /, '');  // node had trailing whitespace.
    trailing_whitespace = !!text.match(/ $/);
    var text = text.slice(0, max_length);
    // Ensure HTML entities are encoded
    // http://debuggable.com/posts/encode-html-entities-with-jquery:480f4dd6-13cc-4ce9-8071-4710cbdd56cb
    text = $('<div/>').text(text).html();
    return text;
  }

  // Collapses a sequence of whitespace into a single space.
  function squeeze(string) {
    return string.replace(/\s+/g, ' ');
  }
  
  // Finds the last, innermost block-level element
  function findNodeForMore(node) {
    var $node = $(node);
    var last_child = $node.children(":last");
    if (!last_child) return node;
    var display = last_child.css('display');
    if (!display || display=='inline') return $node;
    return findNodeForMore(last_child);
  };

  // Finds the last child if it's a p; otherwise the parent
  function findNodeForLess(node) {
    var $node = $(node);
    var last_child = $node.children(":last");
    if (last_child && last_child.is('p')) return last_child;
    return node;
  };

})(jQuery);


/* jquery.custom.forms.js */

/**
 * form related things
 */
 
/**
 * Input Text / textarea mouseover
 */

$(document).ready(function(){
	//switch inputText
	$("input.inputText")
	.focus(function(){
		$(this).addClass("inputTextFocus");
		$(this).removeClass("inputText");
	})
	.blur(function(){
		$(this).addClass("inputText");
		$(this).removeClass("inputTextFocus");
	});
	//switch inputTextarea
	$("textarea.inputTextarea")
	.focus(function(){
		$(this).addClass("inputTextareaFocus");
		$(this).removeClass("inputTextarea");
	})
	.blur(function(){
		$(this).addClass("inputTextarea");
		$(this).removeClass("inputTextareaFocus");
	});
});

/* jquery.custom.hover.js */

/**
 * tooltips
 */
 
 /**
  * change background-color on mouse-over for li elements of class fileList
  * required:
  * + jquery.js
  * + jquery.qtip.js
  */
  
$(document).ready(function(){
	$("ul.fileList li")
	.live('mouseover', function(){
		$(this).css("background-color","#E7F2F8")
			   .css("cursor","pointer");
	})
	.live('mouseout', function(){
		$(this).css("background-color","")
			   .css("cursor","default");
	});
});



/* jquery.custom.tooltips.js */

/**
 * tooltips
 */
 
 /**
  * tooltips (error boxes) for label-tags, if they have a class named 'error'
  * required:
  * + jquery.js
  * + jquery.qtip.js
  */

(function($) {
	//function, to be able to reload tooltips live with acceptable performance.
	$.fn.qtipErrorTooltip = function(){
		$("div[id$=errorTooltip]").remove();
		$("label[class*='error'][title]").each(function(){
			var right = $(this).is("label[class*='errorRight'][title]");
			$(this).qtip({
					id: "errorTooltip",
					style: {
						tip: {
							corner: right ? "leftBottom" : "rightBottom",
							width: 10,
							height: 10
						}
					},
					position: {
						adjust: {
							x: right ? 10 : -10,
							y: 0
						},
						at: right ? "left top" : "right top",
						my: right ? "left bottom" : "right bottom",
						target: right ? "mouse" : false
					},
					show: {
						delay: 0
					},
					content: {
						title: {
							text: "Fehler"
						}
					}
				})
				.mouseover(function(){
				$(this).css('cursor', 'help');
			});
		});
	};
})(jQuery);

$(document).ready(function(){
	$.fn.qtipErrorTooltip();
});

(function($) {
	//function, to be able to reload tooltips live with acceptable performance.
	$.fn.qtipFileList = function(){
		$("div[id$=fileListTooltip]").remove();
		$("ul.fileList li[title], a.tooltip[title]").each(function(){
			$(this).qtip({
				id : 'fileListTooltip',
				style: {
					tip: {
						corner: "bottomLeft",
						width: 10,
						height: 10
					}
				},
				position: {
					target: "mouse",
					adjust: {
						x: 15,
						y: 5
					},
					at: "bottom left",
					my: "bottom left"
				},
				show: {
					delay: 0
				},
				content: {
					title: $(this).attr('title').split('\n',2)[0],
					text: $(this).attr('title').split('\n',2)[1]
				}
			})
			.attr("title","");
		});
	};
})(jQuery);

$(document).ready(function(){
	$.fn.qtipFileList();
});

$(document).ready(function(){
	$("img.tooltip[title]").each(function(){
		$(this).qtip({
			id: "imgTooltip",
			style: {
				tip: {
					corner: $(this).hasClass('tooltipLeft') ? 'bottomRight' : 'bottomLeft',
					width: 10,
					height: 10
				}
			},
			position: {
				target: "mouse",
				adjust: $(this).hasClass('tooltipLeft') ? {x: -5, y: -5} : {x: 5, y: 5},
				at: $(this).hasClass('tooltipLeft') ? 'bottom right' : 'bottom left',
				my: $(this).hasClass('tooltipLeft') ? 'bottom right' : 'bottom left'
			},
			show: {
				delay: 0
			},
			content: {
				title: $(this).attr('title').split('\n',2)[0],
				text: $(this).attr('title').split('\n',2)[1]
			}
		})
		.attr("title","");
	});
});


/* jquery.custom.buttons.js */


$(document).ready(function(){
	$.fn.customButtons();
});

/* jquery.custom.slider.js */

/**
 * @require jquery/jquery.easyslider.js
 */

/*
 *  prevId: 		'prevBtn',
	prevText: 		'Previous',
	nextId: 		'nextBtn',	
	nextText: 		'Next',
	controlsShow:	true,
	controlsBefore:	'',
	controlsAfter:	'',	
	controlsFade:	true,
	firstId: 		'firstBtn',
	firstText: 		'First',
	firstShow:		false,
	lastId: 		'lastBtn',	
	lastText: 		'Last',
	lastShow:		false,				
	vertical:		false,
	speed: 			800,
	auto:			false,
	pause:			2000,
	continuous:		false
 * */

$(document).ready(function(){
	$("#slider").easySlider({
		controlsFade:	false,
		prevId: 		'prevBtn',
		prevText: 		'',
		nextId: 		'nextBtn',	
		nextText: 		'',
		vertical:		true,
		speed: 			800
	});
});

$(document).ready(function(){
	$("#bottomSlider").easySlider({
		controlsFade:	false,
		prevId: 		'bottomPrevBtn',
		prevText: 		'',
		nextId: 		'bottomNextBtn',	
		nextText: 		'',
		vertical:		true,
		speed: 			800
	});
});

/* ajax.js */

function Ajax()
{
	
	this.url = "";
	this.params = "";
	this.method = "GET";
	this.onSuccess = null;
	this.onError = function(msg)
	{
		alert(msg);
	}
}

Ajax.prototype.doRequest = function()
{
	if(!this.url)
	{
		this.onError("Es wurde kein URL angegeben. Der Request wird abgebrochen.");
		return false;
	};
	if (!this.method)
	{
		this.method = "GET";
	} 
	else 
	{
		this.method = this.method.toUpperCase();
	}
	
	//XMLHttpRequest-Objekt erstellen
	var xmlHttpRequest=getXMLHttpRequest();
	if(!xmlHttpRequest)
	{
		this.onError("Es konnte kein XMLHttpRequest-Objekt erstellt werden.");
		return false;
	}
	
	//Zugriff auf Klasse fuer readyStateHandler ermoeglichen
	var _this = this;
	
	//Fallunterscheidung nach Uebertragungsmethode
	switch (this.method) 
	{
		case "GET":	xmlHttpRequest.open(this.method, this.url+"?"+this.params, true);
				xmlHttpRequest.onreadystatechange = readyStateHandler;
				xmlHttpRequest.send(null);
		break;
		case "POST": 	xmlHttpRequest.open(this.method, this.url, true);
				xmlHttpRequest.onreadystatechange = readyStateHandler;
				xmlHttpRequest.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
		xmlHttpRequest.send(this.params);
		break;
	}

	//Private Methode zur Verarbeitung der erhaltenen Daten
	function readyStateHandler()
	{
		if (xmlHttpRequest.readyState < 4)
		{
			return false;
		}
		if (xmlHttpRequest.status == 200 || xmlHttpRequest.status == 304)
		{
			if (_this.onSuccess)
			{
				_this.onSuccess(xmlHttpRequest.responseText, xmlHttpRequest.responseXML);
			}
		} 
		else
		{
			if (_this.onError)
			{
				_this.onError("["+xmlHttpRequest.status+" "+xmlHttpRequest.statusText+"] Es trat ein Fehler bei der Datenuebertragung auf.");
			}
		}
	}
}

//Gibt browserunabhaengig ein XMLHttpRequest-Objekt zurueck
function getXMLHttpRequest()
{
	if (window.XMLHttpRequest)
	{
		//XMLHttpRequest fuer Firefox, Opera, Safari, ...
		return new XMLHttpRequest();
	} 
	else if(window.ActiveXObject)
	{
		try
		{
			//XMLHTTP (neu) fuer Internet Explorer
			return new ActiveXObject("Msxml2.XMLHTTP");
		} 
		catch(e)
		{
			try
			{	//XMLHTTP (alt) fuer Internet Explorer
				return new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				return null;
			}
		}
	}
	return null;
}

/**
 * For executing js scripts in an ajax response
 */ 
function launchJavascript(responseText) {
	var ScriptFragment = '(?:<script.*?>)((\n|.)*?)(?:</script>)';
	var match    = new RegExp(ScriptFragment, 'img');
	var scripts  = responseText.match(match);
	if(scripts)
	{
		var js = '';
		for(var s = 0; s < scripts.length; s++)
		{
			var match = new RegExp(ScriptFragment, 'im');
			js += scripts[s].match(match)[1];
		}
	//uncomment for debug purposes
	//window.alert(js);
	eval(js);
	}
}

/* blur_links.js */

/*function BlurLinks()
{
	// Text- u. Grafik-Links
	links=document.getElementsByTagName('a');
	for(i=0;i<links.length;i++)
	{
		links[i].onfocus=new Function("this.blur();");
	}
	// ImageMaps
	links=document.getElementsByTagName('area');
	for(i=0;i<links.length;i++)
	{
		links[i].onfocus=new Function("this.blur();");
	}

	// Klick-Buttons
	links=document.getElementsByName('Verweis');
	for(i=0;i<links.length;i++)
	{
		links[i].onfocus=new Function("this.blur();");
	}
}*/
$(document).ready(function(){
	$("a,area").focus(function(e){
		$(this).blur();
		});
});
//onload=BlurLinks;

/* calculator.js */

/***calculator functions***/

/***MAIN***************************************************************************************************************************/

var isNN = (navigator.appName.indexOf("Netscape")!=-1);
function autoTab(input,len, e) {
	var keyCode = (isNN) ? e.which : e.keyCode; 
	var filter = (isNN) ? [0,8,9] : [0,8,9,16,17,18,37,38,39,40,46];
	if(input.value.length >= len && !containsElement(filter,keyCode)) {
		input.value = input.value.slice(0, len);
		input.form[(getIndex(input)+1) % input.form.length].focus();
	}
	function containsElement(arr, ele) {
		var found = false, index = 0;
		while(!found && index < arr.length)
			if(arr[index] == ele)
			found = true;
			else
			index++;
		return found;
	}
	function getIndex(input) {
		var index = -1, i = 0, found = false;
		while (i < input.form.length && index == -1)
			if (input.form[i] == input)index = i;
			else i++;
		return index;
	}
return true;
}

/***DHTML***************************************************************************************************************************/


var DHTML = 0, DOM = 0, MS = 0, NS = 0, OP = 0;

function DHTML_init() {

 if (window.opera) {
     OP = 1;
 }
 if(document.getElementById) {
   DHTML = 1;
   DOM = 1;
 }
 if(document.all && !OP) {
   DHTML = 1;
   MS = 1;
 }
if (window.netscape && window.screen && !DOM && !OP){
   DHTML = 1;
   NS = 1;
 }
}

function getElem(p1,p2,p3) {
 var Elem;
 if(DOM) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.getElementById(p2) == "object")
     Elem = document.getElementById(p2);
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document.getElementsByName(p2) == "object")
     Elem = document.getElementsByName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.getElementsByTagName(p2) == "object" ||
        (OP && typeof document.getElementsByTagName(p2) == "function"))
     Elem = document.getElementsByTagName(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(MS) {
   if(p1.toLowerCase()=="id") {
     if (typeof document.all[p2] == "object")
     Elem = document.all[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="tagname") {
     if (typeof document.all.tags(p2) == "object")
     Elem = document.all.tags(p2)[p3];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="name") {
     if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
 else if(NS) {
   if(p1.toLowerCase()=="id" || p1.toLowerCase()=="name") {
   if (typeof document[p2] == "object")
     Elem = document[p2];
     else Elem = void(0);
     return(Elem);
   }
   else if(p1.toLowerCase()=="index") {
    if (typeof document.layers[p2] == "object")
     Elem = document.layers[p2];
    else Elem = void(0);
     return(Elem);
   }
   else return void(0);
 }
}

function getCont(p1,p2,p3) {
   var Cont;
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild) {
     if(getElem(p1,p2,p3).firstChild.nodeType == 3)
       Cont = getElem(p1,p2,p3).firstChild.nodeValue;
     else
       Cont = "";
     return(Cont);
   }
   else if(MS && getElem(p1,p2,p3)) {
     Cont = getElem(p1,p2,p3).innerText;
     return(Cont);
   }
   else return void(0);
}

function getAttr(p1,p2,p3,p4) {
   var Attr;
   if((DOM || MS) && getElem(p1,p2,p3)) {
     Attr = getElem(p1,p2,p3).getAttribute(p4);
     return(Attr);
   }
   else if (NS && getElem(p1,p2)) {
       if (typeof getElem(p1,p2)[p3] == "object")
        Attr=getElem(p1,p2)[p3][p4]
       else
        Attr=getElem(p1,p2)[p4]
         return Attr;
       }
   else return void(0);
}

function setCont(p1,p2,p3,p4) {
   if(DOM && getElem(p1,p2,p3) && getElem(p1,p2,p3).firstChild)
     getElem(p1,p2,p3).firstChild.nodeValue = p4;
   else if(MS && getElem(p1,p2,p3))
     getElem(p1,p2,p3).innerText = p4;
   else if(NS && getElem(p1,p2,p3)) {
     getElem(p1,p2,p3).document.open();
     getElem(p1,p2,p3).document.write(p4);
     getElem(p1,p2,p3).document.close();
   }
}

DHTML_init();




/***für alle rechner***************************************************************************************************************************/

ns4 = (document.layers)? true:false;
ie4 = (document.all)? true:false;

function selectStart()
{
	return false;
}


/***52100 Einmalanlage bei angenommener Wertentwicklung [Einmalanlage]***************************************************************************************************************************/


function rechne_einmalanlage(myform) {
	var Aufschlag = myform.Aufschlag.options[myform.Aufschlag.selectedIndex].value
	var Betrag = parseFloat (myform.Anlagebetrag.value)
	var Einmalanlage = parseFloat (myform.Anlagebetrag.value /(1+(Aufschlag/100)))
	var Start = parseInt(myform.JahrAnlageBeginn.value);
	var Ende = parseInt(myform.JahrAnlageEnde.value);
	var JahreInMonaten = ((Ende-Start)-1)*12;
	var Jahre = (Ende-Start)+1;
	var Depotkosten = Jahre * 17.25;
	
	var MStart = parseInt(13-myform.MonatAnlageBeginn.value);
	var MEnde = parseInt(myform.MonatAnlageEnde.value);
	
	var Monate = JahreInMonaten+MStart+MEnde;

	var Wertentwicklung = (parseFloat(myform.Wertentwicklung.value)-parseFloat(myform.Inflation.options[myform.Inflation.selectedIndex].value))/100;

	var Ergebnis = (Einmalanlage) * Math.pow ((1 + Wertentwicklung),(Monate/12));	
	var Ergebnis = Math.round(Ergebnis);
	
	myform.Ergebnis.value = formatStr(Ergebnis) + ',-';
}

function getFormVals_einmalanlage(form,count) { if (isFormValid_einmalanlage(form,count)){ return true } 
else{ return false } } 

function isFormValid_einmalanlage(myform,count)
{
	for (var i=0;i< count;i++)
	{
		if((myform[i].name != 'fonds')&&(myform[i].name != 'action')&&(myform[i].name != 'minmonat')&&(myform[i].name != 'minjahr')&&(myform[i].name != 'einzminmonat')&&(myform[i].name != 'einzminjahr')&&(myform[i].name != 'maxmonat')&&(myform[i].name != 'maxjahr'))
		{ 
			if((myform[i].value.charAt(0)==0)||(myform[i].value ==''))
			{ 
				if (myform[i].name == 'Anlagebetrag') alert('Bitte geben Sie einen Anlagebetrag ein!');
				if (myform[i].name == 'monatlAusz') alert('Bitte geben Sie einen Auszahlungsbetrag ein!');
				if (myform[i].name == 'Wertentwicklung') alert('Bitte geben Sie eine angenommene Wertentwicklung an!');
				if (myform[i].name == 'JahrAnlageEnde') alert('Bitte geben Sie ein Jahr für das Anlageende ein!');
				if (myform[i].name == 'JahrAnlageBeginn') alert('Bitte geben Sie ein Jahr für den Anlagebeginn ein!'); 
				if (myform[i].name == 'MonatAnlageBeginn') alert('Bitte geben Sie einen Monat für den Anlagebeginn ein!');
				if (myform[i].name == 'MonatAnlageEnde') alert('Bitte geben Sie einen Monat für das Anlageende ein!');
				myform[i].focus();
				myform[i].select();
				return false;
			}
		}
	}
	if (myform.JahrAnlageEnde!=null)
	{
		var JahrAnlageEnde = parseInt(myform.JahrAnlageEnde.value);
		var JahrAnlageBeginn = parseInt(myform.JahrAnlageBeginn.value);
		var MonatAnlageBeginn = parseInt(myform.MonatAnlageBeginn.value);
		var MonatAnlageEnde = parseInt(myform.MonatAnlageEnde.value);
	} 
	else if(myform.maxjahr!=null)
	{
		var JahrAnlageEnde = parseInt(myform.maxjahr.options[myform.maxjahr.selectedIndex].text);
		var JahrAnlageBeginn = parseInt(myform.minjahr.options[myform.minjahr.selectedIndex].text);
		var MonatAnlageBeginn = parseInt(myform.minmonat.options[myform.minmonat.selectedIndex].text);
		var MonatAnlageEnde = parseInt(myform.maxmonat.options[myform.maxmonat.selectedIndex].text);
	}
	else
	{ 
		return true;
	}
	if(JahrAnlageEnde < JahrAnlageBeginn)
	{
		alert('Bitte wählen Sie mindestens einen Anlagezeitraum von einem Jahr');
		return false;
	} 
	if(JahrAnlageEnde-JahrAnlageBeginn >= 2)
	{
		return true;
	}
	else
	{
		if(JahrAnlageEnde == JahrAnlageBeginn && MonatAnlageEnde - MonatAnlageBeginn < 11)
		{
			alert('Bitte wählen Sie mindestens einen Anlagezeitraum von einem Jahr1');
			return false;
		}
		else if((JahrAnlageEnde - JahrAnlageBeginn == 1) && (MonatAnlageEnde - MonatAnlageBeginn > -2))
		{
			return true;
		}
		else if(MonatAnlageEnde - MonatAnlageBeginn <= -2)
		{
			alert('Bitte wählen Sie mindestens einen Anlagezeitraum von einem Jahr');
			return true;
		} 
		else
		{
			return true;
		}
	}
} 


var ergebnisswitch= 2;

function calc_einmalanlage(form_name) {
    if (document.layers) {
        if (getFormVals_einmalanlage(document.Rechnerform.document.forms[form_name],6)) {
            rechne_einmalanlage(document.Rechnerform.document.forms[form_name])
        }
    } else {
        if (getFormVals_einmalanlage(document.forms[form_name],6)) {
            rechne_einmalanlage(document.forms[form_name])
        }
    }
}

function resetForm(form_name) {
    if (document.layers) {
        document.Rechnerform.document.forms[form_name].reset()
    } else {
        document.forms[form_name].reset()
    }
}
	
/***52300 Auszahlplan mit Kapitalverzehr bei angenommener Wertentwicklung [Auszahlplan mit Kapitalverzehr]***************************************************************************************************************************/

function formatStr_auszahlplan(Ergebnis){
var Erg = Ergebnis.toString();
	var	fErgebnis = "";
	var x = Erg.length;
		
	for(var i=0;i<x;i++){
		var Stelle = (x-(i+1));
			if((Stelle % 3 == 0)&&(Stelle!=0)){
				if(Erg.charAt(0)== '-' && i == 0)
				{
				fErgebnis = '-' + fErgebnis;
				}
				else
				{
				fErgebnis += Erg.charAt(i) + '.'
				}
				}
			else {
				fErgebnis += Erg.charAt(i);
			}
	}
	return fErgebnis;
}

function rechne_auszahlplan_mit_kapitalverzehr(myform) {
	var Anlagebetrag = parseFloat(myform.Anlagebetrag.value);
	
	var Start = parseInt(myform.JahrAnlageBeginn.value);
	var Ende = parseInt(myform.JahrAnlageEnde.value);
	var JahreInMonaten = ((Ende-Start)-1)*12;
	var Jahre = (Ende-Start)+1;
	var MStart = parseInt(13-myform.MonatAnlageBeginn.value);
	var MEnde = parseInt(myform.MonatAnlageEnde.value);
	var Monate = parseInt(JahreInMonaten+MStart+MEnde);
	var Summe = Monate;

	var Wertentwicklung = (parseFloat(myform.Wertentwicklung.value)/100);

	if(Wertentwicklung == 0) {
		var Ergebnis = Anlagebetrag/Monate;
		Ergebnis = Math.round(Ergebnis);
		myform.mtlAusZ.value = formatStr_auszahlplan(Ergebnis) + ',-';
	}
	else
	{

	var Ergebnis =   (Wertentwicklung * Math.pow ((1+Wertentwicklung),(Monate/12)) *
			  		Anlagebetrag) /
			      	((Math.pow ((1+Wertentwicklung),(Monate/12))-1) * 
			       	(12 + 5.5 * Wertentwicklung));

	var Ergebnis = Math.round(Ergebnis);
	
	myform.mtlAusZ.value = formatStr_auszahlplan(Ergebnis) + ',-';
	}
}

function calc_auszahlplan_mit_kapitalverzehr(form_name) {
    if (document.layers) {
        if (getFormVals(document.Rechnerform.document.forms[form_name],6)) {
            rechne_auszahlplan_mit_kapitalverzehr(document.Rechnerform.document.forms[form_name])
        }
    } else {
        if (getFormVals(document.forms[form_name],6)) {
            rechne_auszahlplan_mit_kapitalverzehr(document.forms[form_name])
        }
    }
}

/***52300 Auszahlplan mit Kapitalerhalt bei angenommener Wertentwicklung [Auszahlplan mit Kapitalerhalt]***************************************************************************************************************************/

function rechne_auszahlplan_mit_kapitalerhalt(myform) {

	var Anlagebetrag = parseFloat(myform.Anlagebetrag.value);
	var Wertentwicklung = (parseFloat(myform.Wertentwicklung.value)/100);

	if(Wertentwicklung == 0) {
		myform.mtlAusZ.value = "0,-";
	}
	else
	{
	var Ergebnis =  (Anlagebetrag * Wertentwicklung)/12;
	var Ergebnis = Math.round(Ergebnis);
	
	myform.mtlAusZ.value = formatStr_auszahlplan(Ergebnis) + ',-';
	}
}
		
function calc_auszahlplan_mit_kapitalerhalt(form_name) {
    if (document.layers) { 
        if (getFormVals(document.Rechnerform.document.forms[form_name],2)) {
            rechne_auszahlplan_mit_kapitalerhalt(document.Rechnerform.document.forms[form_name])
        }
    } else {
        if (getFormVals(document.forms[form_name],2)) {
            rechne_auszahlplan_mit_kapitalerhalt(document.forms[form_name])
        }
    }
}


/***52200 Sparplan bei angenommener Wertentwicklung [Sparplan]***************************************************************************************************************************/

function rechne_sparplan(myform) {
	var Aufschlag = myform.Aufschlag.options[myform.Aufschlag.selectedIndex].value
	
	var mtlEinzOhneAuf = parseFloat(myform.Anlagebetrag.value);
	var mtlEinz =  parseFloat (myform.Anlagebetrag.value /(1+(Aufschlag/100)));
	var Start = parseInt(myform.JahrAnlageBeginn.value);
	var Ende = parseInt(myform.JahrAnlageEnde.value);
	var JahreInMonaten = ((Ende-Start)-1)*12;
	
	var Jahre = (Ende-Start)+1;
	var Depotkosten = (Jahre * 17.25)/12;
	
	var MStart = parseInt(13-myform.MonatAnlageBeginn.value);
	var MEnde = parseInt(myform.MonatAnlageEnde.value);

	var Monate = JahreInMonaten+MStart+MEnde;

	var Summe = Monate*mtlEinzOhneAuf;
	var Wertentwicklung = (parseFloat(myform.Wertentwicklung.value)-parseFloat(myform.Inflation.options[myform.Inflation.selectedIndex].value))/100;
	
	if(Wertentwicklung == 0) {
		Wertentwicklung = 0.00000001
	}
	
	var Ergebnis = (mtlEinz) *
					 (12 + 6.5 * Wertentwicklung) *
					 (
					 	(1-Math.pow (
					 		(1/(1+Wertentwicklung)),((Monate/12)+1))
						) 
						
						/
					 	
						(1-(1/(1+Wertentwicklung))) -1
					) *
					Math.pow ((1+Wertentwicklung),Monate/12);
					
	var Ergebnis = Math.round(Ergebnis);
	myform.Ergebnis.value = formatStr(Ergebnis) + ',-';
	myform.Summe.value = formatStr(Summe) + ',-';
}

function calc_sparplan(form_name) {
    if (document.layers) {
        if (getFormVals(document.Rechnerform.document.forms[form_name],6)) {
            rechne_sparplan(document.Rechnerform.document.forms[form_name])
        }
    } else {
        if (getFormVals(document.forms[form_name],6)) {
            rechne_sparplan(document.forms[form_name])
        }
    }
}

/***VALIDATION***************************************************************************************************************************/


function formatStr(Ergebnis){
var Erg = Ergebnis.toString();
	var	fErgebnis = "";
	var x = Erg.length;
		
	for(var i=0;i<x;i++){
		var Stelle = (x-(i+1));
			if((Stelle % 3 == 0)&&(Stelle!=0)){
				fErgebnis += Erg.charAt(i) + '.'
				}
			else {
				fErgebnis += Erg.charAt(i);
			}
	}
	return fErgebnis;
}

function checkKey(evt,field) {

   var theKey;
   if(!evt) evt = window.event;
   theKey = evt.keyCode || evt.which;
   if (theKey == 8) //backspace
	   return true;
   else if(theKey == 46) //delete
   {
	   field.value = field.value.substr(0,field.value.length == 0 ? 0 : field.value.length-1);
	   return true;
   }
   else
   {   //ersetze selektierten text durch leere zeichenkette.
	   var selectedText = "";
	   if(field.selectionStart != 'undefined' && field.selectionEnd != 'undefined' && field.selectionStart < field.selectionEnd)
		   field.value = field.value.substring(0, field.selectionStart) + field.value.substring(field.selectionEnd);
	   else if(document.selection)
	   {
		   field.focus();
		   range = document.selection.createRange();
		   if(range.parentElement() != field)
			    return false;
		   var orig = field.value.replace(/rn/g, "n"); 
		   range.text = "";
	   }
   }
   if (( theKey < 48  || theKey > 57 ) || ( field.value.length == 0 && theKey == 48))
	   return false;
   else if(isValid(theKey,field))
	   return true;
   else
	   return false;
}


function checkBetrag(myform,field,rechnertyp) {
var wert=parseInt(field.value);
var meldung='';
var mindestwert=0;
var waehrung = 2;
if (rechnertyp=='einmal'){

	if (waehrung==1){
		if (wert < 5000){
			meldung='Der Anlagebetrag muss mindestens 5.000 EUR betragen!';
			mindestwert=5000;
		}
	}
	else{ 
		if (wert < 2500){
			meldung='Der Anlagebetrag muss mindestens 2.500 EUR betragen!';
			mindestwert=2500;
		}
	}
}
if (rechnertyp=='spar'){
	if (waehrung==1){
		if (wert < 100){
			meldung='Die monatliche Einzahlung muss mindestens 100 EUR betragen!';
			mindestwert=100;
		}
	}
	else{ 
		if (wert < 50){
			meldung='Die monatliche Einzahlung muss mindestens 50 EUR betragen!';
			mindestwert=50;
		}
	}
}
if (rechnertyp=='auszbetrag'){
	if (waehrung==1){
		if (wert < 20000){
			meldung='Der Anlagebetrag muss mindestens 20.000 EUR betragen!';
			mindestwert=20000;
		}
	}
	else{ 
		if (wert < 10000){
			meldung='Der Anlagebetrag muss mindestens 10.000 EUR betragen!';
			mindestwert=10000;
		}
	}
}
if (rechnertyp=='Auszahlung'){
	if (waehrung==1){
		if (wert < 100){
			meldung='Der Auszahlungsbetrag muss mindestens 100 EUR betragen!';
			mindestwert=100;
		}
	}
	else{ 
		if (wert < 50){
			meldung='Der Auszahlungsbetrag muss mindestens 50 EUR betragen!';
			mindestwert=50;
		}
	}
}


if (meldung > ''){
	alert(meldung);
	field.value=mindestwert;
}
}

function checkWertentw(theKey,field){
var wert=parseInt(field.value)
	if (wert > 25){
		alert('Der Maximalwert für die Wertentwicklung beträgt 25%')
		field.value=25;
	}
}


function isValid(theKey,field) {
	if (field.name == "Anlagebetrag" || field.name == "Wertentwicklung" || field.name == "monatlAusz"){
		return true;
	}
	if (( field.name == 'MonatAnlageBeginn' )&&(isMonthValid(theKey,field))) {
			return true;
		}

	else if (( field.name == 'MonatAnlageEnde' )&&(isMonthValid(theKey,field))) {
			return true;
		}
	
	else if (( field.name == 'JahrAnlageBeginn' )&&(isYearValid(theKey,field))) {
			return true;
		}
	else if (( field.name == 'JahrAnlageEnde' )&&(isYearValid(theKey,field))) {
			return true;
		}
	

	else{
			return false;
	}

 
}
 
function isMonthValid(theKey,field) {
	if ( (field.value >= 1 && theKey > 50)
			||(field.value >= 2 )) {
		return false;
   
			}
	else {
      return true;
	}
}


function isYearValid(theKey,field) {
	if  ( (field.value == 1 && theKey < 57 ) 
			|| (field.value.length == 0 && theKey > 50)
			|| (field.value == 2 && theKey > 48 )
			|| (field.value == 19 && theKey < 55 )
			|| (field.value == 20 && theKey > 53 )) {
		return false;
   
			}
	else {
      return true;
	}
}

function getFormVals(form,count) {
	if (isFormValid(form,count)){
		return true;
	}
	else{
		return false;
	}	
	
}


function isFormValid(myform,count) {
	for (var i=0;i< count;i++){
		if ((myform[i].name != 'fonds')&&(myform[i].name != 'action')&&(myform[i].name != 'minmonat')&&(myform[i].name != 'minjahr')&&(myform[i].name != 'einzminmonat')&&(myform[i].name != 'einzminjahr')&&(myform[i].name != 'maxmonat')&&(myform[i].name != 'maxjahr')){
			if((myform[i].value.charAt(0)==0)||(myform[i].value =='')){
				if (myform[i].name == 'Anlagebetrag')
					alert('Bitte geben Sie einen Anlagebetrag ein!');
				if (myform[i].name == 'monatlAusz')
					alert('Bitte geben Sie einen Auszahlungsbetrag ein!');
				if (myform[i].name == 'Wertentwicklung')
					alert('Bitte geben Sie eine angenommene Wertentwicklung an!');
				if (myform[i].name == 'JahrAnlageEnde')
					alert('Bitte geben Sie ein Jahr für das Anlageende ein!');
				if (myform[i].name == 'JahrAnlageBeginn')
					alert('Bitte geben Sie ein Jahr für den Anlagebeginn ein!');
				if (myform[i].name == 'MonatAnlageBeginn')
					alert('Bitte geben Sie einen Monat für den Anlagebeginn ein!');
				if (myform[i].name == 'MonatAnlageEnde')
					alert('Bitte geben Sie einen Monat für das Anlageende ein!');
			myform[i].focus()
			myform[i].select()
			return false
			}
		}
	}

	if (myform.JahrAnlageEnde!=null){
		var JahrAnlageEnde = parseInt(myform.JahrAnlageEnde.value)
		var JahrAnlageBeginn =  parseInt(myform.JahrAnlageBeginn.value)
		var MonatAnlageBeginn = parseInt(myform.MonatAnlageBeginn.value)
		var MonatAnlageEnde = parseInt(myform.MonatAnlageEnde.value)
	}
	else if (myform.maxjahr!=null){
		var JahrAnlageEnde = parseInt(myform.maxjahr.options[myform.maxjahr.selectedIndex].text);
		var JahrAnlageBeginn =  parseInt(myform.minjahr.options[myform.minjahr.selectedIndex].text);
		var MonatAnlageBeginn = parseInt(myform.minmonat.options[myform.minmonat.selectedIndex].text);
		var MonatAnlageEnde = parseInt(myform.maxmonat.options[myform.maxmonat.selectedIndex].text);
		}
		else
		{
			return true;
		}


		if (JahrAnlageEnde < JahrAnlageBeginn){
			alert('Bitte wählen Sie mindestens einen Anlagezeitraum von einem Jahr');
			return false;
	   }
		if(JahrAnlageEnde-JahrAnlageBeginn >= 2){

			return true
		}
		else 
//		if(JahrAnlageEnde == JahrAnlageBeginn && MonatAnlageEnde - MonatAnlageBeginn < 11){
//			alert('Bitte wählen Sie mindestens einen Anlagezeitraum von einem Jahr1');
//			return false;
//			}
//			else 
				if ((JahrAnlageEnde - JahrAnlageBeginn == 1) && (MonatAnlageEnde - MonatAnlageBeginn > -2))
				return true;
				else if (MonatAnlageEnde - MonatAnlageBeginn <= -2){
//					alert('Bitte wählen Sie mindestens einen Anlagezeitraum von einem Jahr');
					return true;
				}
		 else
		 {
		 return true;
		 }
}



/* confirm.js */

function confirm_action(label)
{
	answer = true;
	result = confirm(label);
	if(!result)
	{
		answer = false;		
	}
	return answer;
}

/* dhtml.js */

/*DHTML scripts copyright L.Bagamery (lsblsb@gmx.de))*/


/****
 * switchClassName()
 * purpose: switch the className of an object with given id, optionally you can hand over a array with ids that should all get another (old) classname at the same time
 * @access public
 * @param string switchId
 * @param string newClassName
 * @param [optional] string oldClassName
 * @param [optional] (string-array|object-array) switchIds
 * @return object
 *
 */
 
function switchClassName(switchId, newClassName, /*optional*/ oldClassName, switchIds)
{
	var obj = null;
	if(typeof(switchId) == "object")
		obj = switchId;
	else
		obj = document.getElementById(switchId);
	obj.className = newClassName;
	if(oldClassName && switchIds)
	{
		for(i=0; i<switchIds.length; i++)
		{
			if(typeof switchIds[i] == "object")
			{
				currObj = switchIds[i];
			}
			else
			{
				currObj = document.getElementById(switchIds[i]);
			}
			if(currObj && currObj != obj) 
			{
				currObj.className = oldClassName;
			}
		}
	}
}

function switchDisplay(switchId,/*optional*/ switchIds,/*optional*/ forcedDisplay)
{
	var obj = document.getElementById(switchId);
	if(!forcedDisplay && forcedDisplay != "")
	{
		var oldDisplay = obj.style.display;
		var newDisplay = '';
		if(oldDisplay == '') newDisplay = 'none';
	}
	else
	{
		forcedDisplay == '' ? oldDisplay = 'none' : oldDisplay = '';
		newDisplay = forcedDisplay;
	}
	obj.style.display = newDisplay;
	
	if(switchIds && switchIds[0])
	{
		for(i=0; i<switchIds.length; i++)
		{
			currObj = document.getElementById(switchIds[i]);
			if(currObj && currObj != obj) 
			{
				currObj.style.display = oldDisplay;
			}
		}
	}
}

function getMainSwitchButtons(mainSwitchButtonIdPrefix)
{
	var imgs = document.images;
	var imgsLen = imgs.length;
	var mainSwitchButtons = new Array();
	for(i=0; i<imgsLen; i++)
	{
		if(imgs[i].id && imgs[i].id.indexOf(mainSwitchButtonIdPrefix) != -1)
		{
			mainSwitchButtons[mainSwitchButtons.length] = imgs[i];
		}
	}
	return mainSwitchButtons;
}

/**
 * @param string mainSwitchButtonIdPrefix
 * @param string switchButtonImgId
 * @param string extendViewId
 * @param [ string plusSign ]
 * @param [ string minusSign ]
 * @param [ array textChanges: array[array[<elementId>,<textVarianteA>,<textVarianteB>], array...] ]
 *
 */

function switchView(mainSwitchButtonIdPrefix, switchButtonImgId, extendViewId, plusSign, minusSign, textChanges)
{
	if(!plusSign) plusSign = "plus";
	if(!minusSign) minusSign = "minus";
	var switchButtonImg = document.images[switchButtonImgId];
	//var mainSwitchButtonImg = document.images[mainSwitchButtonId];
	var mainSwitchButtons = getMainSwitchButtons(mainSwitchButtonIdPrefix);
	var mainSwitchButtonsLen = mainSwitchButtons.length;
	var objStyle = document.getElementById(extendViewId).style;
	var formerDisplay = objStyle.display;
	var newSign = minusSign;
	var oldSign = plusSign;
	var newDisplay = "";
	var msg = "schliessen";
	if(formerDisplay != "none")
	{
		newDisplay = "none";
		newSign = plusSign;
		oldSign = minusSign;
		msg = "öffnen";
	}
	//switch texts
	if(textChanges)
		if(typeof(textChanges) == "object")
			for(var i=0;i<textChanges.length;i++)
			{
				textChange = textChanges[i];
				if(typeof(textChange) == "object" && textChange.length == 3 && textChange[0])
				{	var objId = textChange[0];
					if(document.getElementById(objId) && document.getElementById(objId).firstChild && document.getElementById(objId).firstChild.nodeValue == textChange[1])
						changeTextById(textChange[0], textChange[2]);
					else
						changeTextById(textChange[0], textChange[1]);
				}
			}
	//switch_buttons
	switchButtonImg.src = switchButtonImg.src.replace(new RegExp(oldSign),newSign);
	switchButtonImg.title = msg;
	switchButtonImg.alt = msg;
	objStyle.display = newDisplay;
	//main_switch_buttons
	for(i=0;i<mainSwitchButtonsLen;i++)
	{
		mainSwitchButtons[i].src = mainSwitchButtons[i].src.replace(new RegExp(oldSign),plusSign);
		mainSwitchButtons[i].title = "alle öffnen";
		mainSwitchButtons[i].alt = "alle öffnen";
	}
}

/**
 * @param string formName
 * @param string mainSwitchButtonIdPrefix
 * @param string switchButtonImgIdPrefix
 * @param string extendViewIdPrefix
 * @param [ string displayedIsinsCsvField ]
 * @param [ string plusSign ]
 * @param [ string minusSign ]
 * @param [ array textChanges: array[array[<elementId>,<textVarianteA>,<textVarianteB>], array...] ]
 *
 */

function switchAll(formName, mainSwitchButtonIdPrefix, switchButtonImgIdPrefix, extendViewIdPrefix, displayedIsinsCsvField, plusSign, minusSign, textChanges)
{
	if(!plusSign) plusSign = "plus";
	if(!minusSign) minusSign = "minus";
	if(!displayedIsinsCsvField) displayedIsinsCsvField = "displayed_isins";

	var isins = document.forms[formName].elements[displayedIsinsCsvField].value.split(",");

	//var mainSwitchButton = document.images[mainSwitchButtonId];
	var mainSwitchButtons = getMainSwitchButtons(mainSwitchButtonIdPrefix);
	var mainSwitchButtonsLen = mainSwitchButtons.length;
	var oldSign = plusSign;
	var newSign = minusSign;
	var newDisplay = "";
	var msg = "schliessen";
	if(mainSwitchButtons[0].src.indexOf(plusSign) == -1)
	{
		oldSign = minusSign;
		newSign = plusSign;
		newDisplay = "none";
		msg = "öffnen";
	}
	//switch texts
	if(textChanges)
		if(typeof(textChanges) == "object")
			for(var i=0;i<textChanges.length;i++)
			{
				textChange = textChanges[i];
				if(typeof(textChange) == "object" && textChange.length == 3 && textChange[0])
				{	var objId = textChange[0];
					if(document.getElementById(objId) && document.getElementById(objId).firstChild && document.getElementById(objId).firstChild.nodeValue == textChange[1])
						changeTextById(textChange[0], textChange[2]);
					else
						changeTextById(textChange[0], textChange[1]);
				}
			}
	var isins_len = isins.length;
	//switch_buttons and image-src's
	for(i=0;i<isins_len;i++)
	{
		if(isins[i])
		{
			var currSwitchButtonImg = document.images[switchButtonImgIdPrefix+isins[i]];
			var currExtendViewId = extendViewIdPrefix+isins[i];
			currSwitchButtonImg.src = currSwitchButtonImg.src.replace(new RegExp(oldSign),newSign);
			currSwitchButtonImg.title = msg;
			currSwitchButtonImg.alt = msg;
			document.getElementById(currExtendViewId).style.display = newDisplay;
		}
	}
	//main_switch_buttons
	for(i=0;i<mainSwitchButtonsLen;i++)
	{
		mainSwitchButtons[i].src = mainSwitchButtons[i].src.replace(new RegExp(oldSign),newSign);
		mainSwitchButtons[i].title = "alle "+msg;
		mainSwitchButtons[i].alt = "alle "+msg;
	}
}

function changeTextById(id, str)
{
	document.getElementById(id).firstChild.nodeValue = str;
}

function changeImgById(id, src)
{
	document.getElementById(id).src = src;
}

function changeStyleById(id, styleNames, styleValues)
{
	var element = document.getElementById(id);
	if(typeof(styleNames) != "object")
		styleNames = new Array(styleNames);
	if(typeof(styleValues) != "object")
		styleValues = new Array(styleValues);
	for(var i=0;i<styleNames.length;i++)
	{
		var command = "element.style."+styleNames[i]+" = '"+styleValues[i]+"';"
		eval(command);
	}
}


/* tree.js */

/************************************************************************************************************
* -----------------------------------------------jsTreeClasses-----------------------------------------------
*								!! COPYRIGHT lars bagamery 2004 [lsblsb@gmx.de] !!	
*************************************************************************************************************/

/* * *
 * CLASS Tree
 * @param [optional] string pSerializedTree
 * @param string strObjName
 */
	
	function Tree(pSerializedTree, strObjName)
	{
		this.name = strObjName; //String Name des zu erstellenden objekts
		this.rootNode = null;
		this.currentNode = this.rootNode;
		this.pointer = 0;
		this.nodes = new Array();
		this.serializedTree = "";
		
		/**
		 * return elements by class-name
		 */
		this.getElementsByClass = function(searchClass, node, tag)
		{
	        var classElements = new Array();
	        if (node == null) node = document;
	        if (tag == null) tag = '*';
	        var els = node.getElementsByTagName(tag);
	        var elsLen = els.length;
	        var pattern = new RegExp("(^|\\s)"+searchClass+"(\\s|$)");
	        for (var i=0, j=0; i<elsLen; i++)
                if(pattern.test(els[i].className))
                {
					classElements[j] = els[i];
					j++;
                }
	        return classElements;
		}
		
		/* * *
		 * getName()
		 * returns the Name of this Object (should be the name of the instance variable!)
		 * @return String
		 */
		
		this.getName = function()
		{
			return this.name;
		}
		
		/* * *
		 * getNodes()
		 * return all nodes of this tree in an array
		 * @return Array
		 */
		
		this.getNodes = function()
		{
			return this.nodes;
		}
		
		this.hasNodes = function()
		{
			return this.nodes.length != 0;
		}
		
		/* * *
		 * setRootNode()
		 * set the root node
		 * @param Node pNodeObj
		 * @return void
		 */
		
		this.setRootNode = function(pNodeObj)
		{
			this.rootNode = pNodeObj;
			this.currentNode = this.rootNode;
			this.nodes[this.nodes.length] = pNodeObj;
		}
		
		/* * *
		 * getRootNode()
		 * get the root node
		 * @return Node pNodeObj | NULL
		 */
		
		this.getRootNode = function()
		{
			return this.rootNode;
		}
		
		/* * *
		 * addNode()
		 * adds a node to the tree
		 * @access public
		 * @param Node pNodeObj
		 * @param Nod pParentNodeObj
		 * @return Boolean
		 */
		 
		this.addNode = function(pNodeObj, pParentNodeObj)
		{
			if(pParentNodeObj && this.rootNode != null)
			{
				var pParentNodeObjChildren = pParentNodeObj.getChildren();
				var pParentNodeObjChildrenLen = pParentNodeObjChildren.length;
				if(pParentNodeObjChildrenLen > 0)
				{
					var pNodeObjLeftNeighbour = pParentNodeObjChildren[pParentNodeObjChildrenLen-1];
					pNodeObjLeftNeighbour.setRightNeighbour(pNodeObj);
					pNodeObj.setLeftNeighbour(pNodeObjLeftNeighbour);
				}
				pNodeObj.setParent(pParentNodeObj);
				pParentNodeObj.setChild(pNodeObj);
				this.nodes[this.nodes.length] = pNodeObj;
				return true;
			}
			else
			{
				return false;
			}
		}
		
		/* * *
		 * getNodeById()
		 * returns a node identified by its id.
		 * @access public
		 * @param String|Int pId
		 * @return Node
		 */
		
		this.getNodeById = function(pId)
		{
			var nodeObj = false;
			var nodesLen = this.nodes.length;
			for(i=0; i<nodesLen; i++)
				if(this.nodes[i].getId() == pId)
					nodeObj = this.nodes[i];
			return nodeObj;
		}
		
		/**
		 * check if current node has previous node
		 * @return bool
		 */
		
		this.hasPrevious = function()
		{ 	
			var result = this.getPrevious(false);
			return result ? true : false;
		}
		
		/**
		 * return previous node
		 * @param optional movePointer = true
		 * @return Node
		 */
		
		this.getPrevious = function(movePointer)
		{	//@todo
			var result = null;
			
			if(typeof movePointer != "boolean") movePointer = true;
			
			var currNode = this.currentNode;
			var i=0;
			
			while(currNode.getChild(currNode.getChildren().length-1) && !(i == 0 && this.getNext(false) && this.getNext(false).getLeftNeighbour() == null))
			{
				result = currNode = currNode.getChild(currNode.getChildren().length-1);
				i++;
			}
			
			if(!result)
			{
				result = currNode.getLeftNeighbour();
				if(result && i==0)
				{
					currNode = result;
					while(currNode.getChild(currNode.getChildren().length-1))
						result = currNode = currNode.getChild(currNode.getChildren().length-1);
				}
			}
			
			if(!result)
				result = currNode.getParent();
			
			if(result && movePointer)
			{
				this.pointer--;
				this.currentNode = result;
			}
			return result;
		}
		
		/**
		 * return current node 
		 * @return Node
		 */
		
		this.getCurrent = function()
		{
			return this.currentNode;
		}
		
		/**
		 * check if current node has next node
		 * @return bool
		 */
		
		this.hasNext = function()
		{
			var result = this.getNext(false);
			return result ? true : false;
		}
		
		/**
		 * return next node
		 * @param optional movePointer = true
		 * @return Node
		 */
		
		this.getNext = function(movePointer)
		{
			var result = null;
			
			if(typeof movePointer != "boolean") movePointer = true;
			
			var currNode = this.currentNode;
			if(currNode.getChild(0) && !(currNode == this.rootNode && this.pointer > 0))
				result = currNode.getChild(0);
			else if(currNode.getRightNeighbour())
				result = currNode.getRightNeighbour();
			else
				while(currNode.getParent())
					if(currNode.getParent().getRightNeighbour())
					{
						result = currNode.getParent().getRightNeighbour();
						break;
					}
					else
						result = currNode = currNode.getParent();
			if(result && movePointer)
			{
				this.currentNode = result;
				this.pointer++;
			}
			return result;
		}
		
		/**
		 * reset internal pointer to root-node
		 */
		 
		this.reset = function()
		{
			this.currentNode = this.rootNode;
			this.pointer = 0;
		}
		
		/* * *
		 * convertSerializedTree()
		 * converts a serializedTree String into a Tree-Object
		 * Tree should be empty when using this function
		 * returns the tree object itself
		 * @access public
		 * @param String serializedTree
		 * @return Tree
		 */
		
		this.convertSerializedTree = function(serializedTree, pointer, lastVals, lastObjs, depth, treeObj)
		{
			if(!pointer)
			{
				var pointer = 0;
				var depth = 0;
				var lastVals = new Array();
				var lastObjs = new Array();
				var treeObj = this;
			}
			
			if(pointer != serializedTree.length)
			{
				//lese naechsten value aus
				var actLengthLen = parseInt(serializedTree.charAt(pointer));
				pointer ++;
				var actValLen = parseInt(serializedTree.substr(pointer, actLengthLen));
				pointer += actLengthLen;
				var actVal = serializedTree.substr(pointer, actValLen);
				pointer += actValLen;
				
				lastValsArrLen = lastVals.length;
				lastObjsArrLen = lastObjs.length;
				
				if(inArray(actVal, lastVals))
				{
					lastVals.length = lastValsArrLen-1;
					lastObjs.length = lastObjsArrLen-1;
					depth--;
				}
				else
				{	
					lastVals[lastValsArrLen] = actVal;
					
					//objects
					if(lastObjsArrLen == 0)
					{
						var parentNode = null;
					}
					else
					{
						parentNode = lastObjs[lastObjsArrLen-1];
					}
					//create new node
					actNode = new Node(actVal);
					//set depth property
					actNode.setProperty("depth",depth);
					//add node to tree
					if(lastObjsArrLen == 0)
					{	//create root node
						treeObj.setRootNode(actNode);
					}
					else
					{
						treeObj.addNode(actNode, parentNode);
					}
					//add node to lastObjs-array
					lastObjs[lastObjsArrLen] = actNode;
					depth++;
				}
				return this.convertSerializedTree(serializedTree, pointer, lastVals, lastObjs, depth, treeObj);
			}
			return treeObj;
		}
		
		/* * *
		 * getSubtree()
		 * returns a subtree of this tree as Default output. pStartNode will be the root of the returned tree
		 * @access public
		 * @param Node pStartNode
		 * @param [optional] Int pMaxDepth
		 * @return String
		 */
		
		this.getSubtree = function(pStartNode, pMaxDepth, pActNode, pChildNum, pDepth)
		{
			if(!pStartNode)
			{
				pStartNode = this.rootNode;
			}
			if(!pMaxDepth)
			{
				pMaxDepth = -1;
			}
			if(!pActNode)
			{
				subTreeDefaultOutput = "";
				pActNode = pStartNode;
				pDepth = 0;
			}
			var rightNeighbour = pActNode.getRightNeighbour();
			//save return value in variable
			for(i=0; i<pDepth; i++)
			{
				subTreeDefaultOutput += "> ";
			}
			subTreeDefaultOutput += pActNode.getId()+"<br>";
			//end save
			var children = pActNode.getChildren();
			var firstChild = children[0];
			if((children.length > 0) && ((pDepth < pMaxDepth) || (pMaxDepth == -1)))
			{
				pDepth++;
				pActNode = firstChild;
				this.getSubtree(pStartNode, pMaxDepth, pActNode, pChildNum, pDepth);
				pDepth--;
			}
			if(rightNeighbour != null)
			{
				pActNode = rightNeighbour;
				this.getSubtree(pStartNode, pMaxDepth, pActNode, pChildNum, pDepth);
			}
			return subTreeDefaultOutput;
		}
		
		//wenn serializedTree bei Objekterstellung uebergeben wurde, dann lese es in den Objektbaum ein
		if(pSerializedTree)
		{
			this.serializedTree = pSerializedTree;
			this.convertSerializedTree(this.serializedTree);
		}
	}
	
/* * *
 * CLASS Tree
 * @param [optional] string pSerializedTree
 * @param String|Int pId
 */

	function Node(pId)
	{
		this.parent = null;
		this.children = new Array();
		this.rightNeighbour = null;
		this.leftNeighbour = null;
		this.id = "";
		this.properties = new Array();
		
		if(pId)
		{
			this.id = pId;
		}
		
		this.addProperty = function(pKey, pValue)
		{
			this.properties[pKey] = pValue;
		}
		
		this.setProperty = function(pKey, pValue)
		{
			return this.properties[pKey] = pValue;
		}
		
		this.getProperty = function(pKey)
		{
			return this.properties[pKey];
		}
		
		this.getProperties = function()
		{
			return this.properties;
		}
		
		this.removeProperty = function(pKey)
		{
			var deleted = false;
			var properties_temp = new Array();

			for (var key in this.properties)
			{
				if(key != pKey)
				{
					properties_temp[key] = this.properties[key];
				}
				else
				{
					deleted = true;
				}
			}
			this.properties = properties_temp;
			return deleted;
		}
		
		this.setParent = function(pNodeObj)
		{
			this.parent = pNodeObj;
		}
		
		this.getParent = function()
		{
			return this.parent;
		}
		
		this.setChild = function(pNodeObj)
		{
			var childrenLen = this.children.length;
			this.children[childrenLen] = pNodeObj;
		}
		
		this.getChild = function(pChildPos)
		{
			return this.children[pChildPos];
		}
		
		this.getChildren = function()
		{
			return this.children;
		}
		
		this.hasChildren = function()
		{
			return this.children.length > 0;
		}
		
		this.setRightNeighbour = function(pNodeObj)
		{
			this.rightNeighbour = pNodeObj;
		}
		
		this.getRightNeighbour = function()
		{
			return this.rightNeighbour;
		}
		
		this.setLeftNeighbour = function(pNodeObj)
		{
			this.leftNeighbour = pNodeObj;
		}
		
		this.getLeftNeighbour = function()
		{
			return this.leftNeighbour;
		}
		
		this.setId = function(pStrId)
		{
			this.id = pStrId;
		}
		
		this.getId = function()
		{
			return this.id;
		}
		
		this.isRootNode = function()
		{
			return this.parent ? false : true;
		}
	}
	
///////////functions to handle serialized tree strings/////////////////////////////////

//array-funktion: sucht ein element in einem eindim. array
	function inArray(needle, arrHaystack)
	{
		var result = false;
		var arrHaystackLen = arrHaystack.length;
		for(var i=0; i<arrHaystackLen; i++)
		{
			if(arrHaystack[i] == needle)
			{
				result = needle;
			}
		}
		return result;
	}
	
//wandle serializedTree String in Tree-Objekt um/////////////////////////////////

	function serializedTreeToObject(serializedTree, pointer, lastVals, lastObjs, depth, treeObj)
	{
		//hole i-ten intwert aus String
		if(!pointer)
		{
			var pointer = 0;
			var depth = 0;
			var lastVals = new Array();
			var lastObjs = new Array();
			var treeObj = new Tree();
		}
		
		if(pointer != serializedTree.length)
		{
			//lese naechsten value aus
			var actLengthLen = parseInt(serializedTree.charAt(pointer));
			pointer += actLengthLen;
			var actValLen = parseInt(serializedTree.substr(pointer, actLengthLen));
			pointer += actLengthLen;
			var actVal = serializedTree.substr(pointer, actValLen);
			pointer += actValLen;
			
			lastValsArrLen = lastVals.length;
			lastObjsArrLen = lastObjs.length;
			
			if(inArray(actVal, lastVals))
			{
				lastVals.length = lastValsArrLen-1;
				lastObjs.length = lastObjsArrLen-1;
				depth--;
			}
			else
			{
				lastVals[lastValsArrLen] = actVal;
				
				//objects
				if(lastObjsArrLen == 0)
				{
					var parentNode = null;
				}
				else
				{
					parentNode = lastObjs[lastObjsArrLen-1];
				}
				//create new node
				actNode = new Node(actVal);
				//add node to tree
				if(lastObjsArrLen == 0)
				{	//create root node
					treeObj.setRootNode(actNode);
				}
				else
				{
					treeObj.addNode(actNode, parentNode);
				}
				//add node to lastObjs-array
				lastObjs[lastObjsArrLen] = actNode;
				depth++;
			}
			
			return serializedTreeToObject(serializedTree, pointer, lastVals, lastObjs, depth, treeObj)
		}
		return treeObj;
	}

/////////////////////////////////////////////////////////////////////////////////////////////////////////



/* filetree.js */

/******************************************************************************************************************************************
* ---------------------------------------------------------jsTreeClasses [filetree.js]-----------------------------------------------------
*				    			!! COPYRIGHT lars bagamery 2004 [lsblsb@gmx.de] !!    
*******************************************************************************************************************************************/

/***benoetigt tree-class!***/

//erweitere Tree-Klasse um Klassenvariablen////////////////////////////////////////////////////////////////////////////////////////////////

	Tree.prototype.idPrefix = "ftid_";
	Tree.prototype.idPrefixSwitch = "switch_";
	Tree.prototype.idPrefixFolder = "folder_";
	Tree.prototype.idPrefixImages = "";
	Tree.prototype.imagesDir = "img/";
	Tree.prototype.sensitiveSymbols = true;
	Tree.prototype.reverseDisplayUserFunc = null; //funktion, die nach aufruf von reverseDisplay() aufgerufen wird.
	Tree.prototype.reverseDisplayUserFuncArgs = new Array(); //zugehoerige parameter-werte
	Tree.prototype.targetNode = null;

//erweitere Tree-Klasse um getFileTree-Funktion////////////////////////////////////////////////////////////////////////////////////////////

	Tree.prototype.getFileTree = function(pStartNode, pArrKeypairs, pMaxDepth, pActNode, pChildNum, pDepth)
	{
		if(!pStartNode || pStartNode == "")
		{
			pStartNode = this.rootNode;
		}
		if(!pMaxDepth)
		{
			pMaxDepth = -1;
		}
		if(!pActNode)
		{
			var pActNode = pStartNode;
			var pDepth = 0;
			//output-->
			output = "";
			//<--output
		}
		var parentNode = pActNode.getParent();
		var rightNeighbour = pActNode.getRightNeighbour();
		var leftNeighbour = pActNode.getLeftNeighbour();
		var children = pActNode.getChildren();
		var childrenLen = children.length;
		//lege Eigenschaften active u. opened an fuer aktuelle node
		pActNode.addProperty("active", false);
		pActNode.addProperty("opened", false);
		//wenn pStartNode nicht root war, dann setzte fuer  erste Node parentNode u. leftNeighbour auf null
		if(pActNode == pStartNode)
		{
			parentNode = null;
			leftNeighbour = null;
		}
		
		var actId = pActNode.getId();
			
		//set menu_empty or v_line - list
		var pStartNodeNeighbours = new Array();
		var actRightNeighbour = pStartNode;
		while(actRightNeighbour != null)
		{	
			pStartNodeNeighbours[pStartNodeNeighbours.length] = actRightNeighbour;
			actRightNeighbour = actRightNeighbour.getRightNeighbour();
		}
		var fillerImgList = new Array();
		var actParentNode = pActNode;
		while(actParentNode.getParent() != null && !(inArray(actParentNode, pStartNodeNeighbours)))
		{
			actParentNode = actParentNode.getParent();
			if(actParentNode.getRightNeighbour() == null)
				fillerImgList[fillerImgList.length] = this.imagesDir + this.idPrefixImages + "menu_empty.gif";
			else
				fillerImgList[fillerImgList.length] = this.imagesDir + this.idPrefixImages + "menu_v_line.gif";
		}
		fillerImgList.reverse();
		
		var actStyle = "style=\"display:none;\"";
		if(pActNode == pStartNode || (inArray(pActNode, pStartNodeNeighbours)))
		{
			actStyle = "";
		}
		//output-->
		output += "<div id=\"" +actId+ "\" " +actStyle+ ">\n";
		
		for(i=0; i<=pDepth; i++)
		{
			if(pActNode != this.rootNode || childrenLen != 0)
			{
				if(i == (pDepth))
				{
					var num1 = 0;
					var num3 = 0;
					(leftNeighbour != null || parentNode != null) ? num1 = 1 : num1 = 0;
					(rightNeighbour != null) ? num3 = 1 : num3 = 0;
		
					output += "<a href=\"javascript:" +this.getName()+ ".reverseDisplay('" +actId+ "');\"><img src=\"";
					if(childrenLen != 0)
					{
						output += this.imagesDir + this.idPrefixImages + "menu_plus_" +num1+ "1" +num3+ ".gif";
					}
					else
					{
						if(pActNode == this.rootNode)
							output += this.imagesDir + this.idPrefixImages + "menu_empty.gif";
						else
							output += this.imagesDir + this.idPrefixImages + "menu_nosub_" +num1+ "1" +num3+ ".gif";
					}
					output += "\" id=\"" +this.idPrefixSwitch + actId+ "\" style=\"border:0;margin:0;vertical-align:top;\" /></a>";
				}
				else
				{
					output += "<img src=\"";
					output += fillerImgList[i];
					output += "\" style=\"border:0;margin:0;vertical-align:top;\" />";
				}
			}
		}
		
		var itemNum3 = 0;
		//(childrenLen > 0) ? itemNum3 = 1 : itemNum3 = 0;
	
		if(this.sensitiveSymbols == true)
			output += "<a href=\"javascript:" +this.getName()+ ".activateItem('" +actId+ "');\">";
		output += "<img src=\"";
		output += this.imagesDir + this.idPrefixImages+ "menu_item_";
		if(pActNode == this.rootNode && childrenLen == 0) output += "root_";
		output += "00" +itemNum3+".gif\"";
		output += " id=\"" +this.idPrefixFolder+ "" +actId+ "\" style=\"border:0;margin:0;vertical-align:top;\" />";
		if(this.sensitiveSymbols == true)
			output += "</a>";
		output += "<span id=\"" +this.idPrefix + actId+ "\">";
		
		if(!pArrKeypairs[actId])
			output += "<span style=\"font-size:11px;font-family:arial;color:#FF0000;\">["+actId+"]</span>";
		else
			output += "<span style=\"vertical-align:middle;margin-left:3px;\">"+pArrKeypairs[actId]+"</span>";

		output += "</span>";
		output += "</div>\n";
		//<--output
		
		
		var firstChild = children[0];
		if((childrenLen > 0) && ((pDepth < pMaxDepth) || (pMaxDepth == -1)))
		{
			pDepth++;
			pActNode = firstChild;
			this.getFileTree(pStartNode, pArrKeypairs, pMaxDepth, pActNode, pChildNum, pDepth);
			pDepth--;
		}
		if(rightNeighbour != null)
		{
			pActNode = rightNeighbour;
			
			this.getFileTree(pStartNode, pArrKeypairs, pMaxDepth, pActNode, pChildNum, pDepth);
		}
		return output;
	}
	
	/**
	 * @desc haenge baum in dokument ein
	 * @param Object targetNode
	 * @param Array nodeHtml (structure: \[<id>:<html>,[<id>:<html>, ...]\])
	 * @param Bool omitRootNode = false
	 * @param Array openedULPositions (list of positions in sub-dom-tree of ul's that should be displayed
	 */
	Tree.prototype.hookTree = function(targetNode, /*optional*/nodeHtml, omitRootNode, openedULPositions)
	{
		if(typeof targetNode == "object")
			this.targetNode = targetNode;
		else
			return false;
		
		this.reset();
		var node = this.getCurrent();
		
		var li = null;
		var html = null;
		var uls = [];
		
		var treeInteractivity = function()
		{
			var obj = this;
			// if the element is not na <a>, return
			if (obj.tagName != 'A'
				|| obj.className == 'leaf') return;
			// change class
			obj.className = obj.className == 'plus' ? 'minus' : 'plus';
			// get associated <li>
			var liObj = obj.parentNode;
			var ulObjs = liObj.getElementsByTagName('ul');
			// if there is no internal <ul>, return
			if(!ulObjs.length) return;
			// hide/show internal <ul>
			ulObjs[0].style.display = ulObjs[0].style.display == 'none' ? 'block' : 'none';
			//reset display values of <li>'s for IE-display-bug.
			if (document.all && !navigator.userAgent.match(/Opera/))
			{
				var firstUL = obj;
				while(firstUL.parentNode.tagName == 'LI' || firstUL.parentNode.tagName == 'UL')
					firstUL = firstUL.parentNode;
				var firstULChildren = firstUL.getElementsByTagName('ul');
				for(var i=0;i<firstULChildren.length;i++)
				{	
					var prevDisplay = firstULChildren[i].style ? firstULChildren[i].style.display : 'block';
					firstULChildren[i].style.display = (prevDisplay == 'none') ? 'block' : 'none'; 
					firstULChildren[i].style.display = prevDisplay;
				}
			}
		};
		
		var i_ul = 0;
		while(this.hasNext())
		{
			var status = "plus";
			var depth = node.getProperty("depth");
			
			if(!omitRootNode || !node.isRootNode())
			{
				if(!node.getLeftNeighbour())
				{
					uls[depth] = document.createElement("ul");
					if(!node.isRootNode() && !omitRootNode || (omitRootNode && !node.getParent().isRootNode()))
						uls[depth].style.display = 'none';
					for(var i in openedULPositions)
						if(openedULPositions[i] == i_ul)
							uls[depth].style.display = 'block';
						else if(openedULPositions[i] == i_ul+1)
							status = 'minus';
					if(node.isRootNode() || omitRootNode && node.getParent().isRootNode())
					{
						uls[depth].className = "tree";
						targetNode.appendChild(uls[depth]);
					}
					else
						li.appendChild(uls[depth]);
					i_ul++;
				}
				
				li = document.createElement("li");
				if(!node.getRightNeighbour())
					li.className = "last";
				if(!node.hasChildren())
					status = 'leaf';
				html = '<a class="'+status+'"></a>';
				html+= nodeHtml[node.getId()] ? nodeHtml[node.getId()] : node.getId();
				li.innerHTML = html;
				li.firstChild.onclick = treeInteractivity;
				uls[depth].appendChild(li);
			}
			node = this.getNext();
		}
	}
	
	/**
	 * @desc liefere baum in form eines fortlaufenden textes
	 * @param String nodeHtml = Array
	 * @param Bool omitRootNode = false
	 * @param String depthString = "&nbsp;"
	 * @param String wordWrapString = "<br />\r\n"
	 * @return String
	 */
	Tree.prototype.getTextTree = function(nodeHtml, omitRootNode, depthString, wordWrapString)
	{
		var result = "";
		
		if(depthString == undefined)
			depthString = "&nbsp;";
		if(wordWrapString == undefined)
			wordWrapString = "<br />\r\n";
		if(nodeHtml == undefined)
			nodeHtml = new Array();

		this.reset();
		var node = this.getCurrent();
	
		while(this.hasNext())
		{
			var depth = node.getProperty("depth");
			var fullDepthString = new Array(depth+1).join(depthString); 
			if(!omitRootNode || !node.isRootNode())	
				result+= fullDepthString + (nodeHtml[node.getId()] ? nodeHtml[node.getId()] : node.getId()) + wordWrapString;
			node = this.getNext();
		}
		return result;
	}
	
	Tree.prototype.getULPositionsByCssStyleDisplay = function(cssStyleDisplay)
	{
		var result = [];
			
		if(typeof this.targetNode == "object")
		{
			var targets = this.targetNode.getElementsByTagName('ul');
			if(typeof cssStyleDisplay == "object")
			{
				for(var i=0;i<targets.length;i++)
					for(currCssStyleDisplay in cssStyleDisplay)
						if(targets[i].style.display == currCssStyleDisplay)
							result[result.length] = i;
			}
			else
			{
				for(var i=0;i<targets.length;i++)
					if(targets[i].style.display == cssStyleDisplay)
						result[result.length] = i;
			}
		}
		return result;
	}
	
	Tree.prototype.getClosedULPositions = function()
	{
		return this.getULPositionsByCssStyleDisplay('none');
	}
	
	Tree.prototype.getOpenedULPositions = function()
	{
		return this.getULPositionsByCssStyleDisplay(new Array('block','inline',''));
	}
	
	Tree.prototype.openTree = function()
	{
		var result = [];
		if(typeof this.targetNode == "object")
		{
			var aTargets = this.getElementsByClass('(plus|minus)', this.targetNode, 'a');
			var ulTargets = this.targetNode.getElementsByTagName('ul');
			for(var i=0;i<aTargets.length;i++)
				aTargets[i].className = 'minus';
			for(var i=1;i<ulTargets.length;i++)
				ulTargets[i].style.display = 'block';
		}
		return result;
	}
	
	Tree.prototype.closeTree = function()
	{
		var result = [];
		if(typeof this.targetNode == "object")
		{
			var aTargets = this.getElementsByClass('(plus|minus)', this.targetNode, 'a');
			var ulTargets = this.targetNode.getElementsByTagName('ul');
			for(var i=0;i<aTargets.length;i++)
				aTargets[i].className = 'plus';
			for(var i=1;i<ulTargets.length;i++)
				ulTargets[i].style.display = 'none';
		}
		return result;
	}
	
	/**
	 * @desc prüfe, ob irgendeine node geöffnet ist
	 */
	Tree.prototype.nodesOpened = function()
	{
		var result = false;
		if(typeof this.targetNode == "object")
		{
			var ulTargets = this.targetNode.getElementsByTagName('ul');
			for(var i=1;i<ulTargets.length;i++)
				if(ulTargets[i].style.display != 'none' && ulTargets[i].style.display != 'hidden')
				{
					result = true;
					break;
				}
		}
		return result;
	}
	
//erweitere Tree-Klasse um getsubtreeObjects-Funktion (alle unterobjekte einer Node zurueckgeben)///////////////////////////////////////////

	Tree.prototype.getSubtreeObjects = function(pStartNode, pMaxDepth, pActNode, pChildNum, pDepth)
	{
		if(!pStartNode)
		{
			pStartNode = this.rootNode;
		}
		if(!pMaxDepth)
		{
			pMaxDepth = -1;
		}
		if(!pActNode)
		{
			subtreeObjects = new Array();
			pActNodeChildren = pStartNode.getChildren();
			pActNode = null;
			if(pActNodeChildren[0])
			{
				pActNode = pActNodeChildren[0];
			}
			pDepth = 0;
		}
		if(pActNode != null)
		{
		var rightNeighbour = pActNode.getRightNeighbour();
			
			//save return value in variable
			subtreeObjects[subtreeObjects.length] = pActNode;
			//end save
			
			var children = pActNode.getChildren();
			var firstChild = children[0];
			if((children.length > 0) && ((pDepth < pMaxDepth) || (pMaxDepth == -1)))
			{
				pDepth++;
				pActNode = firstChild;
				this.getSubtreeObjects(pStartNode, pMaxDepth, pActNode, pChildNum, pDepth);
				pDepth--;
			}
			if(rightNeighbour != null)
			{
				pActNode = rightNeighbour;
				this.getSubtreeObjects(pStartNode, pMaxDepth, pActNode, pChildNum, pDepth);
			}
		}
		return subtreeObjects;
	}
	
//erweitere Tree-Klasse um reverseDisplay-Funktion (subtree oeffnen/schliessen)/////////////////////////////////////////////////////////////

	Tree.prototype.reverseDisplay = function(pId, /*optional*/neverClose)
	{
		var actNode = this.getNodeById(pId);
		if(!actNode) return;
		var actNodeChildren = actNode.getChildren();
		var actNodeSubtreeObjects = this.getSubtreeObjects(actNode);
		//1. alle childs von pId u. deren childs ausblenden oder einblenden
		var actNodeFirstChildDisplay = "";
		
		if(actNodeChildren[0] != null)
		{
			var actNodeFirstChildDisplay = document.getElementById(actNodeChildren[0].getId()).style.display;
		}
		
		if(neverClose == true && actNodeFirstChildDisplay == "")
		{
			//nothing
		}
		else
		{
			if(actNodeChildren.length > 0)
			{
				///////////////////////////////////////////////
				//set act button to '-'
				var objPath = document.getElementById(this.idPrefixSwitch + pId);
				var oldSrc = objPath.src;
				var oldImg = oldSrc.substr(oldSrc.lastIndexOf("/")+1);
				var oldPath = oldSrc.substring(0,oldSrc.lastIndexOf("/")+1);
				var newImg = "";
				
				if(oldImg.indexOf("plus") != -1)
				{
					var s = oldImg.split("plus");
					newImg = s[0] +"minus"+ s[1];
					actNode.setProperty("opened", true);
				}
				else if(oldImg.indexOf("minus") != -1)
				{
					var s = oldImg.split("minus");
					newImg = s[0] +"plus"+ s[1];
					actNode.setProperty("opened", false);
				}
				else
				{
					newImg = oldImg;
				}
				objPath.src = oldPath + newImg;
				
				///////////////////////////////////////////////
				//set act menu_item image to '001' or '000'
				objPath = document.getElementById(this.idPrefixFolder + pId);
				oldSrc = objPath.src;
				oldImg = oldSrc.substr(oldSrc.lastIndexOf("/")+1);
				oldPath = oldSrc.substring(0,oldSrc.lastIndexOf("/")+1);
				newImg = "";
				if(oldImg.indexOf("001") != -1)
				{
					var s = oldImg.split("001");
					newImg = s[0] +"000"+ s[1];
				}
				else if(oldImg.indexOf("000") != -1)
				{
					var s = oldImg.split("000");
					newImg = s[0] +"001"+ s[1];
				}
				else
				{
					newImg = oldImg;
				}
	
				objPath.src = oldPath + newImg;
	
				///////////////////////////////////////////////
		
				if(actNodeFirstChildDisplay  == "none")
				{
					///////////////////////////////////////////////
					//show all sub-buttons of next level
					for(var i=0; i<actNodeChildren.length; i++)
						document.getElementById(actNodeChildren[i].getId()).style.display = "";
				}
				else
				{
					for(var i=0; i<actNodeSubtreeObjects.length; i++)
					{
						///////////////////////////////////////////////
						//hide all sub-buttons
						var actId = actNodeSubtreeObjects[i].getId();
						document.getElementById(actId).style.display = "none";
						actNodeSubtreeObjects[i].setProperty("opened", false);
						///////////////////////////////////////////////
						//set all sub-buttons to '+'
						objPath = document.getElementById(this.idPrefixSwitch + actId);
						oldSrc = objPath.src;
						oldImg = oldSrc.substr(oldSrc.lastIndexOf("/")+1);
						oldPath = oldSrc.substring(0,oldSrc.lastIndexOf("/")+1);
						newImg = "";
						if(oldImg.indexOf("minus") != -1)
						{
							var s = oldImg.split("minus");
							newImg = s[0] +"plus"+ s[1];
						}
						else
						{
							newImg = oldImg;
						}
						objPath.src = oldPath + newImg;
						
						///////////////////////////////////////////////
						//set all sub-menu_item images to '000'
						objPath = document.getElementById(this.idPrefixFolder + actId);
						oldSrc = objPath.src;
						oldImg = oldSrc.substr(oldSrc.lastIndexOf("/")+1);
						oldPath = oldSrc.substring(0,oldSrc.lastIndexOf("/")+1);
						newImg = "";
						if(oldImg.indexOf("001") != -1)
						{
							var s = oldImg.split("001");
							newImg = s[0] +"000"+ s[1];
						}
						else
						{
							newImg = oldImg;
						}
						objPath.src = oldPath + newImg;
					}
				}
			}
		}
		
		//call user-func
		if (typeof this.reverseDisplayUserFunc == "function")
			if(this.reverseDisplayUserFuncArgs.length > 0)
				this.reverseDisplayUserFunc(this.reverseDisplayUserFuncArgs);
			else
				this.reverseDisplayUserFunc();
	}

	/**
	 * @param Function func
	 * @param optional Array args
	 */
	
	Tree.prototype.setReverseDisplayUserFunc = function(func, args)
	{
		if (typeof func == "function")
		{
			this.reverseDisplayUserFunc = func;
			this.reverseDisplayUserFuncArgs = args;
		}
	}
	
	/**
	 * @desc erweitere Tree-Klasse um activateItem-Funktion (einen folder aktivieren (img tausch))
	 *
	 * @param string pId
	 * @param optional Function func : Funktion, die nach Ablauf dieser Funktion aufgerufen werden soll
	 * [@param optional param, ...] beliebige Parameter f�r func 
	 */	
	Tree.prototype.activateItem = function(pId)
	{
		var actNode = this.getNodeById(pId);
		var treeNodes = this.getNodes();
			
		//switch act menu_item image to active and deactivate all others
		//and activate current
		var objPath = document.getElementById(this.idPrefixFolder + pId);
		
		var oldSrc = objPath.src;
		var oldImg = oldSrc.substr(oldSrc.lastIndexOf("/")+1);
		var oldPath = oldSrc.substring(0,oldSrc.lastIndexOf("/")+1);
		var newImg = "";
		
		if(oldImg.indexOf("active") == -1)
		{
			oldImgFilename = oldImg.substring(0, oldImg.lastIndexOf("."));
			oldImgExt = oldImg.substr(oldImg.lastIndexOf("."));
			newImg = oldImgFilename + "_active" + oldImgExt;
			objPath.src = oldPath + newImg;
			actNode.setProperty("active", true);
		}
		//deactivate all others
		var treeNodes = this.getNodes();
		for(i=0; i<treeNodes.length; i++)
		{
			if(treeNodes[i] != actNode)
			{
				objPath = document.getElementById(this.idPrefixFolder + treeNodes[i].getId());
				oldSrc = objPath.src;
				oldImg = oldSrc.substr(oldSrc.lastIndexOf("/")+1);
				oldPath = oldSrc.substring(0,oldSrc.lastIndexOf("/")+1);
				newImg = "";
				if(oldImg.indexOf("active") != -1)
				{
					var s = oldImg.split("_active");
					newImg = s[0] + s[1];
					objPath.src = oldPath + newImg;
					treeNodes[i].setProperty("active", false);
				}
			}
		}
	}
	
	/**
	 * @desc oeffne alle subtrees oder alle subtrees derjenigen node-ids die uebergeben wurden
	 * @param optional Array ids
	 */
	 
	Tree.prototype.open = function(/*optional*/ids)
	{	//array wurde uebergeben?
		if(!(typeof ids == "object" && ids instanceof Array))
		{
			ids = new Array();
			for(var i in this.nodes)
				if(this.nodes[i].getChildren().length > 0)
					ids[ids.length] = this.nodes[i].getId();
		}
		for(var i in ids)
			this.reverseDisplay(ids[i], true);
	}
	 
	/**
	 * @desc schliesse alle subtrees alle subtrees derjenigen node-ids die uebergeben wurden
	 * @param optional Array ids
	 */
	  
	Tree.prototype.close = function(/*optional*/ids)
	{	//array wurde uebergeben?
		if(!(typeof ids == "object" && ids instanceof Array))
			ids = new Array(this.getRootNode().getId());
		for(var i in ids)
			this.reverseDisplay(ids[i]);
	}
	
	/**
	 * @desc gebe geoeffnete nodes zurueck
	 */
	
	Tree.prototype.getOpenedNodes = function()
	{
		var result = new Array();
		for(var i in this.nodes)
			if(this.nodes[i].getProperty("opened"))
				result[result.length] = this.nodes[i];
		return result;
	}

	/**
	 * @desc gebe aktive node (als objekt) zurueck
	 */
	Tree.prototype.getActiveNode = function()
	{
		var nodes = this.getNodes();
		var activeObject = false;
		for(i=0; i<nodes.length; i++)
			if(nodes[i] && nodes[i].getProperty("active") == true)
				activeObject = nodes[i];
		return activeObject;
	}

	/**
	 * @desc gebe aktive node-id zurueck
	 */
	Tree.prototype.getActiveNodeId = function()
	{
		var activeObject = this.getActiveNode();
		var nodeId = null;
		if(activeObject)
			return activeObject.getId();
	}


/* forms.js */

/***Formular abschicken an angegebene adresse ***/
function submitForm(formName, /*optional*/ formAction, formMethod, targetWin)
{
	var formDefaultMethod = "post";
	if(!formMethod)
	{
		formMethod = formDefaultMethod;
	}
	else
	{
		if(formMethod != "get" || formMethod != "post")
		{
			formMethod = formDefaultMethod;
		}
	}
	var f = document.forms[formName];
	if(targetWin) f = targetWin.document.forms[formName]; 

	if(formAction)
		f.action = formAction;
	if(f.method)
	{
		try{
		f.method = formMethod;
		}
		catch(e)
		{}
	}
	/*if(document.getElementsByTagName('body') && document.getElementsByTagName('body')[0].style)
		document.getElementsByTagName('body')[0].style.cursor = 'wait';*/
	f.submit();
}

/***Formular loeschen***/
function resetForm(formName, /*optional*/targetWin)
{
	var f = document.forms[formName];
	if(targetWin) f = targetWin.document.forms[formName]; 
	f.reset();
	return false;
}

/***Funktionen fuer multiPageForm (mpf)***/
function multiPageForm(formName, /*optional*/ formAction, formMethod, targetWin)
{
	this.formName = formName;
	this.formAction = formAction;
	this.formMethod = formMethod;
	this.targetWin = targetWin;
	this.pageIdFieldName = "page_id";
	this.nextPageIdFieldName = "next_page_id";
	this.formObj = document.forms[formName];
	this.formElements = this.formObj.elements;

	this.submitForm = function()
	{
		var formMethod = "post";
		if(this.formMethod && (this.formMethod == "get" || this.formMethod == "post")) 
			formMethod = this.formMethod;
		var f = this.formObj;
		if(this.targetWin && this.targetWin != "") f = this.targetWin.document.forms[this.formName]; 
	
		if(this.formAction)
			f.action = this.formAction;
		if(f.method)
		{
			try{
			f.method = formMethod;
			}
			catch(e){}
		}
		f.submit();
	}

	this.goTo = function(pageId, nextPageId, /*optional*/ fieldValues)
	{
		if(!pageId) pageId = "";
		if(!nextPageId) nextPageId = "";
		/*if(nextPageId == "" && pageId != "")
		{
			nextPageId = pageId;
			pageId = "";
		}*/
		this.formElements[this.pageIdFieldName].value = pageId;
		this.formElements[this.nextPageIdFieldName].value = nextPageId;
		if(fieldValues && fieldValues.match(/(.*?\=.*?\&?)+/))
		{
			var fields = new Array();
			var parts = fieldValues.split("&");
			for(i=0;i<parts.length;i++)
			{
				var valKeyPair = parts[i].split("=");
				fields[valKeyPair[0]] = valKeyPair[1];
			}
			for(var key in fields)
			{
				this.formElements[key].value = fields[key];
			}
		}
		this.submitForm();
	}
}

/***Formular abschicken an angegebene adresse u. unbegr. Anzahl von Field-Values setzten***/
function setFieldValuesAndSubmitForm(formName, fieldNames, fieldValues, /*optional*/ formAction, formMethod, targetWin)
{
	var f = document.forms[formName];
	if(fieldNames && fieldValues)
	{
		if(typeof(fieldNames) != "string" && typeof(fieldValues) != "string")
		{
			for(var i=0;i<fieldNames.length;i++)
			{
				if(fieldValues[i]) f.elements[fieldNames[i]].value = fieldValues[i];
			}
		}
		else
		{
			f.elements[fieldNames].value = fieldValues;
		}
	}
	submitForm(formName, formAction, formMethod, targetWin);
}

/***Klasse u. Inhalt von Formularfeldern ändern (in Verbindung mit onFocus/onBlur)***/
function setCondition(formName, formElement, elementClassName, origValue)
{
	var path = document.forms[formName].elements[formElement];
	var val = path.value;
	var isEmpty = true;
	if(val != origValue)
	{
		for(i=0;i<val.length;i++)
		{
			if(val.charAt(i) != " ")
			{
				isEmpty = false;
			}
		}
		if(isEmpty)
		{
			path.value = origValue;
		}
	}
	else
	{
		path.value = "";
	}
	path.className = elementClassName;
}

/***Funktion, um die Referenz auf einen submit-button mit dem type=image zu bekommen***/

function getImageSubmitButton(/*String*/ formName)
{
	var f = document.forms[formName];
	var c = f.childNodes;
	var imageInputElement = null;
	search:
	for(var i1 in c)
	{
		if(c[i1].nodeName == "INPUT")
		{
			var a = c[i1].attributes;
			for(var i2 in a)
			{
				try{var n = a[i2].name;}
				catch(e){n = "type";}
				try
				{
					var av = a[i2].nodeValue;
					if(n == "type" && av == "image")
					{
						//image input element gefunden
						imageInputElement = c[i1];
						break search;
					}
				}
				catch(e){break search;}
			}
		}
	}
	return imageInputElement;
}

/**
 * loesche schon vorgegebene Felder eines Formulars
 * @name: resetInitalizedFields
 * @param String formName: name of the target-form
 * @param Array arrFieldNames: all field-names of the form
 * @param Boolean excludeFields: wether arrFieldNames should be an exclude oder include list (default: included in reset)
 */

function resetInitalizedFields(formName, arrFieldNames, excludeFields)
{
	var f = document.forms[formName];
	var els = f.elements;
	if(!arrFieldNames) arrFieldNames = new Array();
	if(typeof(arrFieldNames) != "object") arrFieldNames = new Array(arrFieldNames);
	var arrFieldNamesLen = arrFieldNames.length;
	if(!excludeFields) excludeFields = false;
	
	for(var i=0;i<els.length;i++)
	{
		trunc = excludeFields;
		var el = els[i];
		for(ii=0;ii<arrFieldNamesLen;ii++)
			if(el.name == arrFieldNames[ii])
				trunc = !excludeFields;
		if(trunc || arrFieldNamesLen == 0)
		{
			if(el.type && (el.type == "radio" || el.type == "checkbox"))
			{	 //to do...
				var checkboxGroup = el;
				if(checkboxGroup.value)
					checkboxGroup = new Array(checkboxGroup);
				for(iii=0;iii<checkboxGroup.length;iii++)
					checkboxGroup[iii].checked = false;
			}
			else
			{
				el.value = "";
			}
		}
	}
}

/***Ueberpruefung ob Eingabestring eine gueltige Datumsangabe ist [aktuell: datum darf nur in der vergangenheit liegen!]***/
function checkDate(str_date)
{
	var preg_date_format = /^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/;
	if(!str_date.match(preg_date_format))
	{
		//fehler im aufbau des date-strings
		return false;
	}
	else
	{
		//Ueberpruefe validen string weiter
		var date = new Date();
		var day_now = date.getDate();
		var month_now = (date.getMonth()+1);
		var year_now = date.getFullYear();
		
		var day = str_date.substr(0,2);
		var month = str_date.substr(3,2);
		var year = str_date.substr(6,4);
		day.charAt(0) == "0" ? day =  parseInt(day.charAt(1)) : parseInt(day);
		month.charAt(0) == "0" ? month = parseInt(month.charAt(1)) : parseInt(month);
		if((day > 31 || day < 1) || (month > 12 || month < 1) || (year < 1970))
		{
			return false;
		}
		else
		{
			var ts_now = Date.UTC(year_now,(month_now-1),day_now,00,00,00);
			var ts = Date.UTC(year,(month-1),day,00,00,00);
			if(ts > ts_now)
			{
				return false;
			}
			else
			{
				return true;
			}
		}
	}
}

/***Ueberpruefung ob Eingabestring eine gueltige Zeitangabe ist [erlaubt: HH:MM oder HH:MM:SS]**/

function checkTime(strTime)
{
	var pregTimeFormat = /^([0-9]{2}\:[0-9]{2}){1}(\:[0-9]{2})?$/;
	if(!strTime.match(pregTimeFormat))
	{
		//fehler im aufbau des date-strings
		return false;
	}
	else
	{
		var strTimeLen = strTime.length;
		var timeFormat = "short";
		if(strTimeLen == 8)
		{ 
			timeFormat = "long";
		}
		var h = "";
		var m = "";
		var s = "";
		strTime.charAt(0) == "0" ? h = parseInt(strTime.substr(1,1)) : h = parseInt(strTime.substr(0,2));
		strTime.charAt(3) == "0" ? m = parseInt(strTime.substr(4,1)) : m = parseInt(strTime.substr(3,2));
		if(timeFormat == "long")
		{
			s = strTime.substr(6,2);
			strTime.charAt(6) == "0" ? s = parseInt(strTime.substr(7,1)) : h = parseInt(strTime.substr(6,2));
		}
		if((h >= 0 && h <= 23) && (m >= 0 && m <= 59))
		{
			if((timeFormat == "long") && !(s >= 0 && s <= 59))
			{
				return false;
			}
			return true;
		}
	}
}


//check if a time period is valid
function checkPeriod(str_period_start, str_period_end)
{
	var preg_date_format = /^[0-9]{2}\.[0-9]{2}\.[0-9]{4}$/;
	if(!str_period_start.match(preg_date_format) || !str_period_end.match(preg_date_format))
	{
		//fehler im aufbau des date-strings
		return false;
	}
	else
	{
		var day_start = str_period_start.substr(0,2);
		var month_start = str_period_start.substr(3,2);
		var year_start = str_period_start.substr(6,4);
		day_start.charAt(0) == "0" ? day_start =  parseInt(day_start.charAt(1)) : parseInt(day_start);
		month_start.charAt(0) == "0" ? month_start = parseInt(month_start.charAt(1)) : parseInt(month_start);
		
		var day_end = str_period_end.substr(0,2);
		var month_end = str_period_end.substr(3,2);
		var year_end = str_period_end.substr(6,4);
		day_end.charAt(0) == "0" ? day_end =  parseInt(day_end.charAt(1)) : parseInt(day_end);
		month_end.charAt(0) == "0" ? month_end = parseInt(month_end.charAt(1)) : parseInt(month_end);
		
		var ts_start = Date.UTC(year_start,(month_start-1),day_start,00,00,00);
		var ts_end = Date.UTC(year_end,(month_end-1),day_end,00,00,00);
		
		if(ts_start > ts_end)
		{
			return false;
		}
		else
		{
			return true;
		}
	}
}

function isEmail(email)
{
	var regexp = new RegExp(/^([a-z0-9_.-])+@(([a-z0-9-])+.)+([a-z0-9]{2,4})+$/i);
	if(regexp.test(email)) return true;
	else return false;
}

//validate formular time intervall
function validateTimeInterval(form, ePeriodStart, ePeriodEnd)
{
	if(!ePeriodStart) ePeriodStart = "period_start";
	if(!ePeriodEnd) ePeriodEnd = "period_end";
	
	var f = form;
	var period_start = f.elements[ePeriodStart].value;
	var period_end = f.elements[ePeriodEnd].value;
	
	if(period_start == "TT.MM.JJJJ")
	{
		period_start = "01.01.1970";
	}
	if(period_end == "TT.MM.JJJJ")
	{
		period_end = get_time("date");
	}
	
	var period_ok = false;
	var period_start_ok = checkDate(period_start); 
	var period_end_ok = checkDate(period_end);
	
	if(period_start_ok == true && period_end_ok == true)
	{
		if(checkPeriod(period_start, period_end))
		{
			period_ok = true;
		}
	}
	
	if(!period_start_ok || !period_end_ok || !period_ok)
	{
		var msg = "Bitte Überprüfen Sie Ihre Angaben in den Datums-Feldern!\n\n";
		msg += "Ihre Angabe: "+period_start+" - "+period_end+"\n\n";
		msg += "Sie haben entweder ein Datum in ungueltigem Format eingeben\n";
		msg += "oder der angegebene Zeitraum ist ungueltig oder überschreitet das gueltige Zeitfenster\n";
		msg += "(Zeitfenster: 01.01.1970 - heute)";
		alert(msg);
		f.elements[ePeriodStart].focus();
		return false;
	}
}

//manage custom button

function activateCustomButton(idButtonLeft, idButtonMiddle, idButtonRight)
{
	var bLeft = document.getElementById(idButtonLeft);
	var bMiddle = document.getElementById(idButtonMiddle);
	var bRight = document.getElementById(idButtonRight);
	bLeft.src = "img/button_left_over.gif";
	bMiddle.className = "customButtonOver";
	bRight.src = "img/button_right_over.gif";
}

function deactivateCustomButton(idButtonLeft, idButtonMiddle, idButtonRight)
{
	var bLeft = document.getElementById(idButtonLeft);
	var bMiddle = document.getElementById(idButtonMiddle);
	var bRight = document.getElementById(idButtonRight);
	bLeft.src = "img/button_left.gif";
	bMiddle.className = "customButton";
	bRight.src = "img/button_right.gif";
}

//check fields

function switchFieldsCondition(formName, fieldArray, condition)
{
	if(!condition) condition = true;
	var f = document.forms[formName];
	if(fieldArray && typeof(fieldArray) == "string") fieldArray = new Array(fieldArray);
	if(fieldArray)
	{
		for(i=0;i<fieldArray.length;i++)
		{
			var currFieldObj = f.elements[fieldArray[i]];
			currFieldObj.checked = condition;
		}
	}
}

//get select object

function getSelectObject(formName, selectName)
{
	var selectObj = null;
	var f = document.forms[formName];
	if(f) selectObj = f.elements[selectName];
	return selectObj;
}

//get selected index

function getSelectedIndex(selectObj)
{
	var selectObjIndex = -1;
	if(selectObj) selectObjIndex = selectObj.selectedIndex;
	return selectObjIndex;
}

//get selected value of a select-list

function getSelectValue(formName, selectName)
{
	var selectObjValue = null;
	var selectObj = getSelectObject(formName, selectName)
	var selectObjIndex = getSelectedIndex(selectObj);
	if(selectObjIndex != -1) selectObjValue = selectObj[selectObjIndex].value;
	return selectObjValue;
}

//get selected text of a select-list

function getSelectText(formName, selectName)
{
	var selectObjText = null;
	var selectObj = getSelectObject(formName, selectName)
	var selectObjIndex = getSelectedIndex(selectObj);
	if(selectObjIndex != -1) selectObjText = selectObj[selectObjIndex].text;
	return selectObjText;
}

//move an selected option of a select list to another select list

function move_option(formName, selectNameFrom, selectNameTo)
{
	var f = document.forms[formName];
	var selectFrom = f.elements[selectNameFrom];
	var selectTo = f.elements[selectNameTo];
	var fromIndex = selectFrom.selectedIndex;
	if(fromIndex != -1)
	{
		var option = new Option(selectFrom[fromIndex].text, selectFrom[fromIndex].value);
		var title = (selectFrom[fromIndex].title) ? selectFrom[fromIndex].title : "";
		option.setAttribute("title", title);
		selectFrom[fromIndex] = null;
		selectTo[selectTo.length] = option;
	}
}

//add an option to a select list

function addSelectOption(formName, selectName, optionText, optionValue, newPosition, selectedValue)
{
	if(!newPosition) newPosition = 0;
	var f = document.forms[formName];
	var selectObj= f.elements[selectName];
	var objIndex = selectObj.selectedIndex;
	if(objIndex != -1)
	{
		var option = new Option(optionText, optionValue);
		var selectObjLen = selectObj.length;
		var i=0;
		var tmpOption = false;
		while(i<=selectObjLen && !tmpOption)
		{
			if(i==newPosition)
			{
				tmpOption = selectObj[i];
				selectObj[i] = option;
			}
			i++;
		}
		if(tmpOption)
		{
			var tmp = new Object();
			for(i; i<=selectObjLen; i++)
			{
				tmp = selectObj[i];
				selectObj[i] = tmpOption;
				tmpOption = tmp;
			}
		}
	}
	
	if(selectedValue)
	for(var i=0; i<selectObj.length; i++)
	{
		if(selectObj[i].value == selectedValue) selectObj[i].selected = true;
	}
}

//get number of options
function getOptionsNum(formName, selectName)
{
	var result = false;
	var f = document.forms[formName];
	var selObj = f.elements[selectName];
	result = selObj.options.length;
	return result;
}

// add an option to a select list
function addSelectOption(formName, selectName, optionName, optionValue)
{
	var f = document.forms[formName];
	var selObj = f.elements[selectName];
	var selOptions = selObj.options;
	var selOptionsLen = selOptions.length;
	
	if(!optionValue) optionValue = "";
	var optionObj = new Option(optionName, optionValue);
	selOptions[selOptionsLen] = optionObj;
}

//remove an option of a select list

function removeSelectOption(formName, selectName, optionIdentifier, identifierType, selected)
{
	if(!identifierType) identifierType = "value";
	if(selected != false)
		selected = true;
		
	var f = document.forms[formName];
	var selectObj= f.elements[selectName];
	var objIndex = true;
	if(selected) objIndex = selectObj.selectedIndex;
	if(objIndex != -1)
		for(var i=0; i<selectObj.length; i++)
		{
			if(selectObj[i][identifierType] == optionIdentifier)
				selectObj[i] = null;
		}
}

//get all selected options from a multiple select.

/*function getSelectedOptions(formName, selectName, deselect)
{
	if(deselect != false) deselect = false;
	var selectedOptions = new Array();
	var formObj = document.forms[formName];
	var selObj = formObj.elements[selectName];
	while (selObj.selectedIndex != -1)
	{
		selectedOptions[selectedOptions.length] = selObj.options[selObj.selectedIndex];
		selObj.options[selObj.selectedIndex].selected = false; 
	}
	//reselect options
	if(!deselect)
	{
		selectedOptionsLen = selectedOptions.length;
		for(var i=0;i<selectedOptionsLen;i++)
			selectedOptions[i].selected = true;
	}
	return selectedOptions;
}*/

function getSelectedOptions(formName, selectName)
{
    var selectedOptions = new Array();
    var formObj = document.forms[formName];
	var selObj = formObj.elements[selectName];
	var optionsLen = selObj.options.length
    for (var i=0; i<optionsLen; i++) 
	      if (selObj.options[i].selected) selectedOptions[selectedOptions.length] = selObj.options[i];
    return selectedOptions;
}

//check if an option exists
function selectOptionExists(formName, selectName, optionIdentifier, identifierType)
{
	exists = false;
	if(!identifierType) identifierType = "value";
	var f = document.forms[formName];
	var selObj = f.elements[selectName];
	var selOptions = selObj.options;
	var selOptionsLen = selOptions.length;
	for(var i=0;i<selOptionsLen;i++)
		if(selOptions[i][identifierType] == optionIdentifier)
			exists = true;
	return exists;
}

//select options of different select-lists (usefull if values should be sent with request)
function selectExistingOptions(formName, selectNames)
{
	var f = document.forms[formName];
	if(!selectNames[0]) selectNames = new Array(selectNames);
	var selectNamesLen = selectNames.length;
	for(var i1=0;i1<selectNamesLen;i1++)
	{
		var selObj = f.elements[selectNames[i1]];
		for(var i2=0;i2<selObj.options.length;i2++)
			selObj.options[i2].selected = "selected";
	}
}

/***moveSelectOptions()***
* @purpose: move selected Options of a Select to another Select.
* default behaviour is, that all selected options are moved.
* you can also specify optionKeys (values or texts - specified by optionKeyType) 
* that should be moved, selected are ignored in this case.
* @access: public
* @param: string formName
* @param: string fromSelectName
* @param: string toSelectName
* [@param: array optionKeys]
* [@param: string optionKeyType ('value'|'text'); default: 'value']
* [@param: string fromEmptyNoteValue (Hinweis in Form einer Option (value-wert), wenn keine Option mehr vorhanden)]
* [@param: string fromEmptyNoteText (Hinweis in Form einer Option (text-wert), wenn keine Option mehr vorhanden)]
* [@param: string toEmptyNoteValue (Hinweis in Form einer Option (value-wert), wenn in to-Select-Feld keine Option mehr vorhanden)]
* [@param: string toEmptyNoteText (Hinweis in Form einer Option (text-wert), wenn in to-Select-Feld keine Option mehr vorhanden)]
*/

function moveSelectOptions(formName, fromSelectName, toSelectName, /*optional*/optionKeys, optionKeyType, fromEmptyNoteValue, fromEmptyNoteText, toEmptyNoteValue, toEmptyNoteText)
{
	var confirmLimitStep = 3000;
	if(!optionKeyType) optionKeyType = "value";
	var formObj = document.forms[formName];
	var fromSelObj = formObj.elements[fromSelectName];
	var toSelObj = formObj.elements[toSelectName];
	var toSelObjOptions = toSelObj.options;
	var	selOptions = new Array();
	var fromSelObjOptions = fromSelObj.options;
	var fromSelObjOptionsLen = fromSelObjOptions.length;
	//if optionKeys not given, search for selected options
	if(!optionKeys) selOptions = getSelectedOptions(formName, fromSelectName);
	else
	{
		var optionKeysLen = optionKeys.length;
		for(var i1=0; i1<fromSelObjOptionsLen; i1++)
			for(var i2=0; i2<optionKeysLen; i2++)
				if(fromSelObjOptions[i1][optionKeyType] == optionKeys[i2])
					selOptions[selOptions.length] = fromSelObjOptions[i1][optionKeyType];
	}
	//copy each selected option to its new location
	var selOption;
	var nextMaxValue = confirmLimitStep;
	for(var i1=0; i1<selOptions.length; i1++)
	{
		selOption = new Option(selOptions[i1].text, selOptions[i1].value);
		if(!fromEmptyNoteText || (fromEmptyNoteText && (fromEmptyNoteText != selOption.text)))
		{
			//delete option from fromSelect
			selOptions[i1] = null;
			for(var i2=0; i2<fromSelObjOptions.length; i2++)
				if(fromSelObjOptions[i2][optionKeyType] == selOption[optionKeyType])
				{
					//delete option from select
					fromSelObjOptions[i2] = null;
					break;
				}
			//if option was last option in from-Select and fromEmptyNoteText is given, then add option with fromEmptyNoteText
			if(fromEmptyNoteText && fromEmptyNoteValue && fromSelObjOptions.length == 0)
				fromSelObjOptions[fromSelObjOptions.length] = new Option(fromEmptyNoteText, fromEmptyNoteValue);
			//if only one toSel-option and toSel-option equals toEmptyNoteText, then delete this option
			if(toEmptyNoteText && toEmptyNoteValue && toSelObjOptions.length == 1 && toSelObjOptions[0].text == toEmptyNoteText && toSelObjOptions[0].value == toEmptyNoteValue)
				toSelObj[0] = null;
			//add option to toSelect
			toSelObjOptions[toSelObjOptions.length] = selOption;
		}
		if(nextMaxValue != -1 && i1 >= nextMaxValue)
			if(!confirm(nextMaxValue+" Empfänger wurden bereits verschoben.\nSoll der Vorgang fortgesetzt werden?")) 
				break;
			else 
				nextMaxValue = nextMaxValue + confirmLimitStep;
	}
}

/***moveSelectOptionsToMultipleSelects()***
* @purpose: move selected Options of a Select to multiple Selects by specifying 
* multiple toSelectNames and corresponding Regular Expressions (using array position) in optionMatches.
* If a Regular Expression matches the value or text (specified by optionMatchType) the appropriate
* option will be moved to the corresponding toSelect-Object
*
* @access: public
* @param: string formName
* @param: string fromSelectName
* @param: array toSelectNames
* @param: RegExp Array optionMatches: an array of regular expressions
* [@param: string optionKeyType: ('value'|'text'); default: 'value']
* [@param: string fromEmptyNoteValue (Hinweis in Form einer Option (value-wert), wenn keine Option mehr vorhanden)]
* [@param: string fromEmptyNoteText (Hinweis in Form einer Option (text-wert), wenn keine Option mehr vorhanden)]
* [@param: array toEmptyNoteValues (Hinweis pro toSelect-Feld jeweils in Form einer Option (value-werte), wenn in entsprechendem to-Select-Feld keine Option mehr vorhanden)]
* [@param: array toEmptyNoteTexts (Hinweis pro toSelect-Feld jeweils in Form einer Option (text-werte), wenn in entsprechendem to-Select-Feld keine Option mehr vorhanden)]
*/


function moveSelectOptionsToMultipleSelects(formName, fromSelectName, toSelectNames, optionMatches, optionKeyType, fromEmptyNoteValue, fromEmptyNoteText, toEmptyNoteValues, toEmptyNoteTexts)
{
	var confirmLimitStep = 3000;
	if(!optionKeyType) optionKeyType = "value";
	if(!toSelectNames[0]) toSelectNames = new Array(toSelectNames);
	var formObj = document.forms[formName];
	var fromSelObj = formObj.elements[fromSelectName];
	var fromSelObjOptions = fromSelObj.options;
	var toSelObjs = new Array();	
	var toSelectNamesLen = toSelectNames.length;
	for(var i1=0; i1<toSelectNamesLen; i1++)
		if(formObj.elements[toSelectNames[i1]])
			toSelObjs[toSelObjs.length] = formObj.elements[toSelectNames[i1]];
	var toSelObjsLen = toSelObjs.length;
	
	selOptions = getSelectedOptions(formName, fromSelectName, optionKeyType);
	//copy each selected option to its new location
	var selOption;
	var nextMaxValue = confirmLimitStep;
	for(var i1=0; i1<selOptions.length; i1++)
	{
		selOption = new Option(selOptions[i1].text, selOptions[i1].value);
		//add option to matching toSelect
		for(var i2=0; i2<toSelObjsLen; i2++)
		{
			var toSelObj = toSelObjs[i2];
			var regExp = new RegExp(optionMatches[i2]);
			if(regExp.exec(selOption[optionKeyType]) != null && (!fromEmptyNoteText || (fromEmptyNoteText && (fromEmptyNoteText != selOption.text))))
			{
				//delete option from fromSelect
				selOptions[i1] = null;
				for(var i3=0; i3<fromSelObjOptions.length; i3++)
					if(fromSelObjOptions[i3][optionKeyType] == selOption[optionKeyType])
					{	//delete option from select
						fromSelObjOptions[i3] = null;
						break;
					}
				//if fromEmptyNoteText is given and option was last option in from-Select-List, then add option with fromEmptyNoteText
				if(fromEmptyNoteValue && fromEmptyNoteText && fromSelObjOptions.length == 0)
					fromSelObjOptions[fromSelObjOptions.length] = new Option(fromEmptyNoteText, fromEmptyNoteValue);
				//if only one toSel-option and toSel-option equals toEmptyNoteTexts[i], then delete this option
				if(toEmptyNoteTexts && toEmptyNoteValues && toSelObj.options.length == 1 && toSelObj[0].text == toEmptyNoteTexts[i2] && toSelObj[0].value == toEmptyNoteValues[i2])
					toSelObj[0] = null;
				toSelObj.options[toSelObj.options.length] = selOption;
				break;
			}
		}
		if(nextMaxValue != -1 && i1 >= nextMaxValue)
			if(!confirm(nextMaxValue+" Empfänger wurden bereits verschoben.\nSoll der Vorgang fortgesetzt werden?")) 
				break;
			else 
				nextMaxValue = nextMaxValue + confirmLimitStep;
	}
}

/**
 * kopiere einen selektierten Wert eines Select-Felds in ein Hidden-Field
 * @param string selectName
 * @param string hiddenFieldName
 * @return boolean
 */

function copySelectedValueIntoHiddenField(formName, selectName, hiddenFieldName, errorOnEmptySelValue)
{
	var result = false;
	var f = document.forms[formName];
	var selValue = getSelectValue(formName, selectName);
	if((selValue != null && selValue != "undefined") && !(errorOnEmptySelValue == true && selValue == ""))
	{
		f[hiddenFieldName].value = selValue;
		result = true;
	}
	return result;
}

/**
 * kopiere einen Wert eines Felds in ein Hidden-Field
 * @param string formName
 * @param string fieldName
 * @param string hiddenFieldName
 * @param boolean errorOnEmptyFieldValue = false
 * @param string errorMsgOnEmptyFieldValue = ""
 * @param boolean submitForm = false
 * @param string formAction = null
 * @param string formMethod = null
 * @param string targetWin = null
 * @return boolean
 */
 
function copyInputValueIntoHiddenField(formName, fieldName, hiddenFieldName/*optional*/, errorOnEmptyFieldValue, errorMsgOnEmptyFieldValue, doSubmitForm, formAction, formMethod, targetWin)
{
	var result = false;
	var f;
	var field;
	var hiddenField;
	
	if(!document.forms[formName])
	{
		alert("function copyInputValueIntoHiddenField: Das Formular '"+formName+"' existiert nicht.");
		return false;
	}
	else
		f = document.forms[formName];
	
	if(!f.elements[fieldName])
	{
		alert("function copyInputValueIntoHiddenField: Das Feld '"+fieldName+"' im Formular '"+formName+"' existiert nicht.");
		return false;
	}
	else
		field = f.elements[fieldName];
		
	if(!f.elements[hiddenFieldName])
	{
		alert("function copyInputValueIntoHiddenField: Das Feld '"+hiddenFieldName+"' im Formular '"+formName+"' existiert nicht.");
		return false;
	}
	else
		hiddenField = f.elements[hiddenFieldName];
	
	hiddenField.value = field.value;
	if((field.value != "") || (errorOnEmptyFieldValue == false && field.value == ""))
	{
		f[hiddenFieldName].value = field.value;
		result = true;
		if(doSubmitForm)
		{
			submitForm(formName, formAction, formMethod, targetWin);
		}
	}
	if(!result && errorOnEmptyFieldValue && errorMsgOnEmptyFieldValue)
		alert(errorMsgOnEmptyFieldValue);
	return result;
}


/**
 * implode a select list to a string and put it into a specified (hidden) field
 * @param formName
 * @param selectName
 * @param targetFieldName
 * @param [optional] separator default:,
 * @param [optional] ignoreValues default: array()
 * @param [optional] selectedOnly default: false
 */

function implodeSelectToHiddenField(formName, selectName, targetFieldName,/*optional*/seperator,/*optional*/ignoreValues,/*optional*/selectedOnly)
{
	if(!seperator) seperator = ",";
	if(typeof(ignoreValues) == "string")
		ignoreValues = new Array(ignoreValues);
	var f = document.forms[formName].elements;
	var options = f[selectName].options;
	var options_len = options.length;
	var str = "";
	if(options_len > 0)
	{
		for(var i=0;i<options_len;i++)
		{
			var ignore = false;
			if(ignoreValues)
			{
				for(var i2=0;i2<ignoreValues.length;i2++)
					if(ignoreValues[i2] == options[i].value)
					{
						ignore = true;
						break;
					}
			}
			if(selectedOnly && !options[i].selected)
				ignore = true;
			if(!ignore) str += options[i].value + ",";
		}
	}
	if(str != "") str = str.substr(0,str.length-1);
	f[targetFieldName].value = str;
}

//implode multiple select lists to strings and put them into specified (hidden) fields

function implodeSelectsToHiddenFields(formName, selectNamePrefix, targetFieldNamePrefix, /*optional*/seperator,/*optional*/ignoreValues,/*optional*/selectedOnly)
{
	if(!seperator) seperator = ",";
	var f = document.forms[formName];
	
	//find checkboxes and targets
	var select_names = new Array();
	var field_names = new Array();
	var selects = new Array();
	var fields = new Array();
	
	var regexp_selects = new RegExp("^"+selectNamePrefix+".*$");
	var regexp_fields = new RegExp("^"+targetFieldNamePrefix+".*$");
	//first use assoc. arrays to prevent double entries
	for(i=0;i<f.length;i++)
	{
		var element = f[i];
		if(element.name.match(regexp_selects))
			select_names[element.name] = element.name;
		if(element.name.match(regexp_fields))
			field_names[element.name] = element.name;
	}

	for(k in select_names)
		selects[selects.length] = f.elements[k];
	for(k in field_names)
		fields[fields.length] = f.elements[k];
	
	//implode all checkboxes to their hidden fields	
	selectNamePrefixLen = selectNamePrefix.length;
	fieldNamePrefixLen = targetFieldNamePrefix.length;

	for(sn in select_names)
	{
		for(fn in field_names)
		{	//use regexp to compare the names, if e.g. one name is 'arrayed',like name[]
			var sn_substr = sn.substr(selectNamePrefixLen);
			var fn_substr = fn.substr(fieldNamePrefixLen);
			(sn_substr.length < fn_substr.length) ? substr_regexp_part = sn_substr : substr_regexp_part = fn_substr;
				regexp_names = new RegExp("^.*"+substr_regexp_part+".*$");
			if(sn.match(regexp_names) && fn.match(regexp_names))
			{
				var curr_select = f.elements[sn];
				var options = f.elements[sn].options;
				var options_len = options.length;
				var str = "";
				if(options_len > 0)
				{
					for(i=0;i<options_len;i++)
					{
						var ignore = false;
						if(ignoreValues)
						{
							for(var i2=0;i2<ignoreValues.length;i2++)
								if(ignoreValues[i2] == options[i].value)
								{
									ignore = true;
									break;
								}
						}
						if(selectedOnly && !options[i].selected)
							ignore = true;
						if(!ignore)
						{
							str+= options[i].value;
							if(i != options_len-1 && !(selectedOnly && options[i+1] && !options[i+1].selected)) 
								str+= ",";
						}
					}
				}
				f.elements[fn].value = str;
			}
		}
	}
}

//implode checkboxes to (hidden) field 
function implodeCheckboxGroupToHiddenField(formName, checkboxGroupName, targetFieldName,/*optional*/selectedOnly, notSelectedOnly, targetWin)
{
	var f = document.forms[formName];
	if(targetWin) f = targetWin.document.forms[formName];
	if(!selectedOnly) selectedOnly = false;
	if(selectedOnly != true) selectedOnly = false;
	if(!notSelectedOnly) notSelectedOnly = false;
	if(notSelectedOnly != true) notSelectedOnly = false;
	var checkboxGroup = f.elements[checkboxGroupName];
	if(checkboxGroup)
	{
		var checkedValues = new Array();
		if(checkboxGroup.value)
		{
			checkboxGroup = new Array(checkboxGroup);
		}
		for(i=0;i<checkboxGroup.length;i++)
		{
			if((!selectedOnly && !notSelectedOnly) || (selectedOnly && checkboxGroup[i].checked) || (notSelectedOnly && !checkboxGroup[i].checked))
				checkedValues[checkedValues.length] = checkboxGroup[i].value;
		}
		checkedValuesStr = checkedValues.join(",");

		f.elements[targetFieldName].value = checkedValuesStr;
	}
}

//implode multiple checkboxes to multiple (hidden) fields by prefix
function implodeCheckboxGroupsToHiddenFields(formName, checkboxGroupNamePrefix, targetFieldNamePrefix,/*optional*/selectedOnly, notSelectedOnly, targetWin)
{
	var f = document.forms[formName];
	if(targetWin) f = targetWin.document.forms[formName];
	if(!selectedOnly) selectedOnly = false;
	if(selectedOnly != true) selectedOnly = false;
	if(!notSelectedOnly) notSelectedOnly = false;
	if(notSelectedOnly != true) notSelectedOnly = false;
	
	//find checkboxes and targets
	var checkboxes_names = new Array();
	var field_names = new Array();
	var checkboxes = new Array();
	var fields = new Array();
	
	var regexp_checkboxes = new RegExp("^"+checkboxGroupNamePrefix+".*$");
	var regexp_fields = new RegExp("^"+targetFieldNamePrefix+".*$");
	//first use assoc. arrays to prevent double entries
	for(i=0;i<f.length;i++)
	{
		var element = f[i];
		if(element.name.match(regexp_checkboxes))
			checkboxes_names[element.name] = element.name;
		if(element.name.match(regexp_fields))
			field_names[element.name] = element.name;
	}
	
	for(k in checkboxes_names)
		checkboxes[checkboxes.length] = f.elements[k];
	for(k in field_names)
		fields[fields.length] = f.elements[k];

	//implode all checkboxes to their hidden fields	
	checkboxGroupNamePrefixLen = checkboxGroupNamePrefix.length;
	targetFieldNamePrefixLen = targetFieldNamePrefix.length;

	for(cn in checkboxes_names)
	{
		for(fn in field_names)
		{	//use regexp to compare the names, if e.g. one name is 'arrayed',like name[]
			var cn_substr = cn.substr(checkboxGroupNamePrefixLen);
			var fn_substr = fn.substr(targetFieldNamePrefixLen);
			(cn_substr.length < fn_substr.length) ? substr_regexp_part = cn_substr : substr_regexp_part = fn_substr;
				regexp_names = new RegExp("^.*"+substr_regexp_part+".*$");
			if(cn.match(regexp_names) && fn.match(regexp_names))
			{
				var values = new Array();
				var curr_checkboxes = f.elements[cn];
				if(curr_checkboxes.value)
				{
					curr_checkboxes = new Array(curr_checkboxes);
				}
				for(i=0;i<curr_checkboxes.length;i++)
				{
					if((!selectedOnly && !notSelectedOnly) || (selectedOnly && curr_checkboxes.checked) || (notSelectedOnly && !curr_checkboxes.checked))
						values[values.length] = curr_checkboxes[i].value;
				}
				valuesStr = values.join(",");
				f.elements[fn].value = valuesStr;
			}
		}
	}
}


//return all checked checkboxes of a checkbox group as object-array
function getChecked(formName, checkboxGroupName)
{
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	var checkedBoxes = new Array();
	for(i=0;i<checkboxGroup.length;i++)
	{
		if(checkboxGroup[i].checked)
		{
			checkedBoxes[checkedBoxes.length] = checkboxGroup[i];
		}
	}
	return checkedBoxes;
}

//return all checked checkbox values of a checkbox group as string-array
function getCheckedValues(formName, checkboxGroupName)
{
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	if(checkboxGroup)
	{
		var checkedValues = new Array();
		for(i=0;i<checkboxGroup.length;i++)
		{
			if(checkboxGroup[i].checked)
				checkedValues[checkedValues.length] = checkboxGroup[i].value;
		}
	}
	return checkedValues;
}

//remark a group of checkboxes
function remarkCheckboxes(formName, checkboxGroupName, checkboxValues)
{
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	for(i=0;i<checkboxGroup.length;i++)
	{
		for(ii=0; ii<checkboxValues.length; ii++)
		{	
			if(checkboxGroup[i].value == checkboxValues[ii])
			{
				checkboxGroup[i].checked = true;
			}
		}
	}
}

//switch the condition of (a) group(s) of checkboxes, released by triggerCheckbox
function switchCheckboxCondition(formName, triggerCheckboxName, checkboxGroupNames, forceCondition)
{
	var f = document.forms[formName];
	var trigger = f.elements[triggerCheckboxName];
	var newCondition = false;
	if(!checkboxGroupNames[0]) checkboxGroupNames = new Array(checkboxGroupNames);
	var checkboxGroupNamesLen = checkboxGroupNames.length;
	for(var i=0;i<checkboxGroupNamesLen;i++)
	{
		var checkboxGroup = f.elements[checkboxGroupNames[i]];
		if(typeof(forceCondition) == undefined)
			if(trigger.checked == true) newCondition = true;
		else
			newCondition = forceCondition;
		if(checkboxGroup.value) checkboxGroup = new Array(checkboxGroup);
		for(var ii=0;ii<checkboxGroup.length;ii++) 
			checkboxGroup[ii].checked = newCondition;
	}
}

/****
 * swapCheck()
 * purpose: swap the check of 2 checkboxes
 * @access public
 * @param string formName
 * @param string checkboxGroupName
 * @return object
 *
 */

function swapCheck(formName, checkboxName1, checkboxName2, forceCheck)
{
	var f = document.forms[formName];
	f.elements[checkboxName1].checked ? f.elements[checkboxName1].checked = true : f.elements[checkboxName1].checked = false;
	f.elements[checkboxName2].checked = false;
}

/****
 * getGroupValues()
 * purpose: return all values of a checkbox- or radiogroup
 * @access public
 * @param string formName
 * @param string checkboxGroupName
 * @return object
 *
 */

function getGroupValues(formName,checkboxGroupName)
{
	var checkboxValues = new Array();
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	if(!checkboxGroup[0]) checkboxGroup = new Array(checkboxGroup);
	checkboxGroupLen = checkboxGroup.length;
	for(var i=0;i<checkboxGroupLen;i++)
	{
		checkboxValues[checkboxValues.length] = checkboxGroup[i].value;
	}
	return checkboxValues;
}

/****
 * getChecked(formName,checkboxGroupName)
 * purpose: return the checked object of a checkbox- or radiogroup
 * @access public
 * @param string formName
 * @param string checkboxGroupName
 * @return object
 *
 */

function getChecked(formName,checkboxGroupName)
{
	var checkedBox = false;
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	if(!checkboxGroup[0]) checkboxGroup = new Array(checkboxGroup);
	checkboxGroupLen = checkboxGroup.length;
	for(var i=0;i<checkboxGroupLen;i++)
	{
		if(checkboxGroup[i].checked) checkedBox = checkboxGroup[i];
	}
	return checkedBox;
}

/****
 * getUnchecked(formName,checkboxGroupName)
 * purpose: return all checkbox- or radio buttons that are not checked within a checkbox group
 * @access public
 * @param string formName
 * @param string checkboxGroupName
 * @return object-array
 *
 */

function getUnchecked(formName,checkboxGroupName)
{
	var uncheckedBoxes = new Array();
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	if(!checkboxGroup[0]) checkboxGroup = new Array(checkboxGroup);
	checkboxGroupLen = checkboxGroup.length;
	for(var i=0;i<checkboxGroupLen;i++)
	{
		if(!checkboxGroup[i].checked) uncheckedBoxes[uncheckedBoxes.length] = checkboxGroup[i];
	}
	return uncheckedBoxes;
}

/****
 * getUncheckedValues(formName,checkboxGroupName)
 * purpose: return all checkbox- or radio button - values that are not checked within a checkbox group
 * @access public
 * @param string formName
 * @param string checkboxGroupName
 * @return string-array
 *
 */

function getUncheckedValues(formName,checkboxGroupName)
{
	var uncheckedBoxesValues = new Array();
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	if(!checkboxGroup[0]) checkboxGroup = new Array(checkboxGroup);
	checkboxGroupLen = checkboxGroup.length;
	for(var i=0;i<checkboxGroupLen;i++)
	{
		if(!checkboxGroup[i].checked) uncheckedBoxesValues[uncheckedBoxesValues.length] = checkboxGroup[i].value;
	}
	return uncheckedBoxesValues;
}

//validate isin / wkn
function isValidIsin(isin)
{
	var result = false;
	var regexp_isin = new RegExp("^[A-Za-z]{2}[A-Za-z0-9]{10}$");
	if(isin.match(regexp_isin))
	{
		result = true;
	}
	return result;
}

function isValidWkn(wkn)
{
	var result = false;
	regexp_wkn = new RegExp("^[0-9A-Za-z]{6}$");
	if(wkn.match(regexp_wkn))
	{
		result = true;
	}
	return result;
}

//parse an integer but note decimal places
function parseIntNoteDec(str, seperator)
{
	var result = 0;
	if(!seperator) seperator = ".";
	var numParts = str.split(seperator);
	if(numParts.length > 1)
	{
		var str = numParts[0]+'.'+numParts[1].replace('.','');
		result = parseFloat(str);
	}
	else
		result = parseInt(str);
		
	return result;
}

//calculate total size of different values switched by checkboxes
function calculateTotalSize(formName, checkboxGroupName, rootIdPrefix, targetId, seperator, roundPrecision, startValue)
{
	if(!startValue || startValue == "") startValue = "0";
	var totalSize = parseIntNoteDec(startValue, seperator);
	var f = document.forms[formName];
	if(!roundPrecision || roundPrecision < 0 || roundPrecision > 10) roundPrecision = 2;
	if(!seperator) seperator = ".";
	var checkboxGroup = f.elements[checkboxGroupName];
	var idValues = new Array();
	if(checkboxGroup.value)
	{
		checkboxGroup = new Array(checkboxGroup);
	}
	for(var i=0;i<checkboxGroup.length;i++)
	{
		var currNode = document.getElementById(rootIdPrefix+checkboxGroup[i].value);
		var currNodeValue = "0";
		if(currNode.firstChild && currNode.firstChild.nodeValue) 
			currNodeValue = currNode.firstChild.nodeValue;
		currNodeValue = parseIntNoteDec(currNodeValue, seperator);
		if(checkboxGroup[i].checked)
		{
			totalSize += currNodeValue;
		}
	}
	var vStr = "1";
	for(var i=0;i<parseInt(roundPrecision);i++)
		vStr += "0";
	var v = parseInt(vStr);
	totalSize = Math.round(totalSize*v)/v;
	var numParts = String(totalSize).split(".");
	if(numParts[1])
	{
		totalSize = numParts[0]+seperator+numParts[1];
		var rest = roundPrecision - numParts[1].length;
		if(rest != 0)
		{
			for(i=0; i<rest; i++)
			totalSize += "0";
		}
	}
	if(totalSize == "0") totalSize="0"+seperator+vStr.substr(1);
	if(targetId)
	{
		document.getElementById(targetId).firstChild.nodeValue = totalSize;
	}
	else
	{
		return totalSize;
	}
}

//switch display of an object.
function switchExtensionView(id, /*optional*/formName, /*optional*/checkboxName)
{
	var obj = document.getElementById(id);
	var newVal = 'none';
	if(formName && checkboxName)
	{
		var f = document.forms[formName];
		var checkboxChecked = f.elements[checkboxName].checked;
		if(checkboxChecked)
		newVal = '';
	}
	else
	{
		var oldVal = obj.style.display;
		if(oldVal == 'none') newVal = '';
	}
	obj.style.display = newVal;
}

/**
 * switch display of one ore more objects on check
 * @obj radioButtonObj: Radio-Button-Objekt
 * @array displayStates: Anzeigestatus. Aufbau: Array{<objId>:<displayStatus>,[<objId>:displayStatus, ...]}
 *
 * @example: switchDisplayOnCheck(this, {'A':'block','B':'none'});
 */
function switchDisplayOnCheck(radioButtonObj, displayStates)
{
	if(!(radioButtonObj instanceof Array))
		radioButtonObj = new Array(radioButtonObj);
	for(var i in radioButtonObj)
		if(radioButtonObj[i].checked)
			for(var displayStateObjId in displayStates)
				document.getElementById(displayStateObjId).style.display = displayStates[displayStateObjId];
}

//show ids if one checkbox of some checkboxes or a checkbox-group is activated
function showIdsIfCheckboxTrue(formName, checkboxNames, objIds)
{
	f = document.forms[formName];
	checkboxObjects = new Array;
	for(i=0;i<checkboxNames.length;i++)
	{
		var checkboxName = checkboxNames[i];
		var checkboxObj = f.elements[checkboxName];
		if(checkboxObj.value)
		{
			checkboxObjects[checkboxObjects.length] = checkboxObj;
		}
		else
		{
			for(ii=0;ii<checkboxObj.length;ii++)
			{
				checkboxObjects[checkboxObjects.length] = checkboxObj[ii];
			}
		}
	}

	var checkboxChecked = false;
	for(i=0;i<checkboxObjects.length;i++)
	{
		if(checkboxObjects[i].checked)
		{
			checkboxChecked = true;
		}
	}
	var displ = "";

	for(i=0;i<objIds.length;i++)
	{
		checkboxChecked ? displ="" : displ="none";
		document.getElementById(objIds[i]).style.display = displ;
	}
}

//check one checkbox within a checkbox group, if all are deactivated
function checkboxGroupMinCheck(formName, checkboxGroupName, minCheckedCheckboxPos)
{
	var result = false;
	var f = document.forms[formName];
	var checkboxGroup = f.elements[checkboxGroupName];
	if(checkboxGroup.value)
	{
		checkboxGroup = new Array(checkboxGroup);
	}
	var oneChecked = false;
	for(var i=0;i<checkboxGroup.length;i++)
	{
		var currCheckbox = checkboxGroup[i];
		if(currCheckbox.checked && i != minCheckedCheckboxPos)
			oneChecked = true;
	}
	if(!oneChecked)
	{
		checkboxGroup[minCheckedCheckboxPos].checked = true;
		result = true;
	}
	return result;
}

	/**
	 * Es gibt eine Checkbox-Gruppe. Eine Checkbox soll mindestens angeklickt sein. Jede aktive Checkbox besitzt ein zugeh�riges Element,
	 * welches sichtbar ist, wenn die zugehörige Checkbox aktiv ist, und unsichtbar ist, wenn die zugehörige Checkbox inaktiv ist.
	 * 
	 * required functions: checkboxGroupMinCheck(), switchDisplay()
	 *
	 * @param string 	formName [name des formulars]
	 * @param string 	switchId [in seiner sichtbarkeit zu switchendes objekt]
	 * @param string 	checkboxGroupName [name der checkbox-Gruppe]
	 * @param int		minCheckedCheckboxPos [position der checkbox in der checkbox-Gruppe, die mindestens aktiv sein soll]
	 * @param string	minCheckedTargetId [target-id des elements, welches sichtbar sein soll, wenn die mindest aktive checkbox aktiv ist]
	 * @param object	das aufrufende Objekt selbst
	 */
	function switchDisplay_CheckboxGroupMinCheck_PreserveDisplayStatus(formName, switchId, checkboxGroupName, minCheckedCheckboxPos, minCheckedTargetId, obj)
	{
		var f = document.forms[formName];
		var checkboxGroup = f.elements[checkboxGroupName];
		if(checkboxGroup.value) checkboxGroup = new Array(checkboxGroup);
		var checkboxGroupLen = checkboxGroup.length;
		var checkDone = checkboxGroupMinCheck(formName, checkboxGroupName, minCheckedCheckboxPos);

		if(checkDone)
		{
			switchDisplay(minCheckedTargetId, null, '');
		}
		var doSwitch = false;
		for(var i=1;i<checkboxGroupLen;i++)
			if(checkboxGroup[i].checked)
			{
				doSwitch = true;
				break;
			}	
		if(doSwitch || obj != f.elements[checkboxGroupName][minCheckedCheckboxPos])
			switchDisplay(switchId);
	}

/*** formFillFields() ***
 * @purpose: fill out multiple fields in a form
 * @access: public
 * @param string formName
 * @param array fields
 * @param array values
 * @return void
 */
function formFillFields(formName, fields, values)
{ 
	if(fields[0] && values[0])
	{
		var f = document.forms[formName];
		for(var i=0;i<fields.length;i++)
		{
			if(values[i]) f.elements[fields[i]].value = values[i];
		}
	}
}

/*** checkRadioSetFieldValues() ***
 * @purpose: set values of multiple fields if a specific radio button of a radio-group is checked
 * @access: public
 * @param string formName
 * @param string radioGroupName
 * @param string radioValue
 * @param array fields
 * @param array values
 * @return void
 */
function checkRadioSetFieldValues(formName, radioGroupName, radioValue, fields, values)
{
	if(fields[0] && values[0])
	{
		var f = document.forms[formName];
		var radioGroup = f.elements[radioGroupName];
		var radioGroupLen = radioGroup.length;
		var radio = false;
		for(var i=0; i<radioGroupLen; i++)
		{
			if(radioGroup[i].value == radioValue)
				radio = radioGroup[i];
		}
		if(radio && radio.checked)
		{
			var fieldsLen = fields.length;
			for(i=0; i<fieldsLen; i++)
			{
				if(f.elements[fields[i]])
				{
					if(values[i]) f.elements[fields[i]].value = values[i];
				}
			}
		}
	}
}

/*** makeFullPrice() ***
 * @purpose: return a full price declaration
 * @access: public
 * @param string|int [numeric] price
 * @param string seperator
 * @param string [optional] postfix
 * @param array fields
 * @param array values
 * @return string
 */

function makeFullPrice(price, seperator, postfix)
{
	var result = price;
	if(!seperator) seperator = ",";
	if(!postfix) postfix = "";
	var price = String(price);
	var priceRegExp = new RegExp("^\\d+?[\\"+seperator+"\\,]?\\d*$");
	if(price.match(priceRegExp))
	{
		price = String(parseFloat(price.replace(/,/,".")));
		var parts = new Array();
		if(price.indexOf(".") != -1) var parts = String(price).split("."); 
		if(parts[1]) 
		{
			if(parts[1].length > 2)
				parts[1] = String(parseInt(parseFloat(parts[1].substr(0,2)+"."+parts[1].substr(2))));
			if(parts[1].length == 1)
			{
				parts[1] = parts[1]+"0";
			}
		}
		else if(!parts[1])
		{
			parts[0] = price;
			parts[1] = "00";
		}
			
		result = parts[0]+seperator+parts[1]+postfix;
	}
	return result;
}

/**
 * @desc tausche Positionen von Options in einem Select-Feld aus.
 * @param string formName
 * @param string selectName
 * @param string direction = 'up'
 * @param boolean numbered = false
 * @return integer newPosition
 */
function swapSelectOptionPosition(formName, selectName, direction, numbered)
{
	if(!direction) direction = "up";
	var r = 0;
	var s = document.forms[formName].elements[selectName];
	var si = s.selectedIndex;
	if(si != -1)
	{
		if(direction == "down")
			var n = si+1;
		else
			var n = si-1;
		if(n >= 0 && n < s.options.length)
		{	
			r = n;
			var t = s.options[si].text;
			var ot = s.options[n].text;
			if(numbered)
			{
				if(t.charAt(1) == ".")
					t = (n+1)+t.slice(1);
				else
					t = (n+1)+t.slice(2);
				if(ot.charAt(1) == ".")
					ot = (si+1)+ot.slice(1);
				else
					ot = (si+1)+ot.slice(2);
			}
			s.options[n].text = t;
			s.options[si].text = ot;
			s.selectedIndex = n;
			//change string value
			if(numbered)
			{
				s = document.forms[formName].elements['manual_order'];
				var sv = s.value;
				var nsv = swapCommaSeperatedStringPositions(sv, si, n);
				s.value = nsv;
			}
		}
		else if(n < 0) r = 0;
		else if(n == s.options.length) r = s.options.length-1;
	}
	else
	{
		alert("Bitte wählen Sie zuerst ein zu verschiebendes Element aus.");
	}

	return r;
}

/**
 * @desc tausche Positionen in Kommagetrenntem String aus
 * @param str
 * @param oldPos
 * @param newPos
 * @return
 */
function swapCommaSeperatedStringPositions(str, oldPos, newPos)
{
	var result = str;
	var arr = str.split(",");
	var oldVal = arr[newPos];
	arr[newPos] = arr[oldPos];
	arr[oldPos] = oldVal;
	result = arr.join(",");
	return result;
}

/* openwin.js */

//fenster oeffnen
function openwin(file, name, width, height, left, top, scrollbars)
{
	if(window.opened_win && !window.opened_win.closed)
	{	
		opened_win.close();
	}
		if(left == null || left == "")
		{
			left = (screen.availWidth/2) - (width/2);
		}
		if(top == null || top == "")
		{
			top = (screen.availHeight/2) - (height/2);
		}
		if(scrollbars == null || scrollbars == "")
		{
			scrollbars = "no";
		}
		
		try
		{
			opened_win = window.open(file, name, "width="+width+", height="+height+", left="+left+", top="+top+", location=no, menubar=no, resizable=no, scrollbars="+scrollbars+", status=yes, toolbar=no");
			if(!opened_win || typeof(opened_win) != 'object' || opened_win.closed)
			{
      			throw "popup_failed"; 
   			}
				
			opened_win.focus();
		}
		catch(e)
		{
			if ( e == "popup_failed" )
			{
      			return false;
   			}
		}
	return opened_win;
}


/* strings.js */

//string funktionen
//trim: Strip whitespace from the beginning and end of a string
function trim(stringToTrim)
{
	return stringToTrim.replace(/^\s+|\s+$/g,"");
}

//replace string hits with repl using regExp.. u can use $n as backreference
function pregReplace(strRegExp, repl, str)
{
	var result = false;
	var regExp = new RegExp(strRegExp);
	result[i] = str.replace(regExp, repl);
	return result;
}

//replace all array-string-objects hits in arr with repl using regExp.. u can use $n as backreference
function arrPregReplace(strRegExp, repl, arr)
{
	var result = new Array();
	var regExp = new RegExp(strRegExp);

	if(arr[0])
	{
		for(var i=0;i<arr.length;i++)
		{		
			result[i] = arr[i].replace(regExp, repl);
		}
	}
	return result;
}

//return an array with all arr-string-objects that matched the reg. expr.
function arrPregMatch(strRegExp, repl, arr)
{
	var result = new Array();
	var regExp = new RegExp(strRegExp);

	if(arr[0])
	{
		for(var i=0;i<arr.length;i++)
		{
			if(arr[i].match(regExp, repl))
				result[i] = arr[i];
		}
	}
	return result;
}

//url encoding and decoding
function urlEncodeCharacter(c)
{
	return '%' + c.charCodeAt(0).toString(16);
};

function urlDecodeCharacter(str, c)
{
	return String.fromCharCode(parseInt(c, 16));
};

function urlEncode(s)
{
      return encodeURIComponent(s).replace( /\%20/g, '+' ).replace( /[!'()*~]/g, urlEncodeCharacter );
};

function urlDecode(s)
{
      return decodeURIComponent(s.replace( /\+/g, '%20' )).replace( /\%([0-9a-f]{2})/g, urlDecodeCharacter);
};


function strstr (haystack, needle, bool) {
    
	pos = haystack.indexOf(needle);
    if (pos == -1)
    {
        return false;
    }
    else
    {
        if (bool)
        {
            return haystack.substr(0, pos);        
        }
        else
        {
            return haystack.slice(pos);
        }
    }
}


/* time.js */


$(document).ready(function(){
	
	function get_time(format)
	{
		var date = new Date();
		var seconds = date.getSeconds().toString();
		var hours = date.getHours().toString();
		var minutes = date.getMinutes().toString();
		var day = date.getDate().toString();
		var month = (date.getMonth()+1).toString();
		var year = date.getFullYear().toString();
		var str_time = "";
		
		var parts = new Array(year, month, day, hours, minutes, seconds);
		
		for(i=1; i<parts.length; i++)
		{
			if(parts[i].length == 1)
			{
				parts[i] = "0"+parts[i];
			}
		}
		var full_date = parts[2]+"."+parts[1]+"."+parts[0];
		var full_time = parts[3]+":"+parts[4]+":"+parts[5];
		switch(format)
		{
			case "date": str_time = full_date;
			break;
			case "time": str_time = full_time;
			break;
			default:  str_time = full_date+" "+full_time;
		}
		return str_time;
	}

	function write_time(id, format)
	{
		var format = "";
		var id = "timeDisplay";
		var obj = document.getElementById(id);
		if(typeof(obj) == "object" && obj != null)
			obj.firstChild.nodeValue = get_time(format);
	}
	
	//var aktiv = window.setInterval(write_time, 1000);
});

/* events.js */

/**
 * add an event
 * @obj: object, where event occurs
 * @evType: type of the event (load, mouseover ...)
 * @fn: the function to be called
 */
 
function addEvent(obj, evType, fn)
{
	if (obj.addEventListener)
	{
		obj.addEventListener(evType, fn, false);
		return true;
	}
	else if (obj.attachEvent)
	{
		var r = obj.attachEvent("on"+evType, fn);
		return r;
	}
	else
	{
		return false;
	}
}

/**
 * remove an event
 * @obj: object, where event occurs
 * @evType: type of the event (load, mouseover ...)
 * @fn: the function to be called
 */
 
function removeEvent(obj, evType, fn)
{
	if (obj.removeEventListener)
	{
		obj.removeEventListener(evType, fn, false);
		return true;
	}
	else if (obj.detachEvent)
	{
		var r = obj.detachEvent("on"+evType, fn);
		return r;
	}
	else
	{
		return false;
	}
}

/**
* Button Mouseover
*/

function initJsButton()
{
	var regExp = new RegExp('(^.*?/?)(b\\d?_\\w*_)a\\.(gif|jpg|jpeg|png)$');
	//all images
	var imgs = document.getElementsByTagName('img');
	if(!imgs) imgs = new Array();
	//input type=images
	var inputs = document.getElementsByTagName('input');
	var inputImgs = new Array();
	var inputsLen = inputs.length;
	for(var i=0;i<inputsLen;i++)
		if(inputs[i].type == "image")
			inputImgs[inputImgs.length] = inputs[i];
	
	var imgsLen = imgs.length;
	var inputImgsLen = inputImgs.length;
	var totalLen = imgsLen + inputImgsLen;
	for(var i=0;i<totalLen;i++)
	{
		var img;	
		(i < imgsLen) ? img = imgs[i] : img = inputImgs[i-imgsLen];
		var res = regExp.exec(img.src);
		if(res)
		{
			var out = img.src;
			var over = res[1]+res[2]+"b."+res[3];
			img['jsButtonOut'] = out;
			img['jsButtonOver'] = over;
			//addEvent(img, 'mouseover', testmenow);
			img.onmouseover = function(){this.style.cursor = "pointer";this.src = this.jsButtonOver};
			//addEvent(img, 'mouseout', function(){this.style.cursor = "default";this.src = this.jsButtonOut});
			img.onmouseout = function(){this.style.cursor = "default";this.src = this.jsButtonOut};
		}
	}
}

addEvent(window, 'load', initJsButton);

/**
 * Form Sending
 * auto transform url-trails in action in method="get" forms
 *
 */
 
function initGetActionTrailTransformation()
{
	var fs = document.forms;
	for(var i=0;i<fs.length;i++)
	{	
		var f = fs[i];
		if(f.method && f.method.match(/get/i) && f.action)
		{
			var a = f.action;
			var delimPos = a.indexOf('?');
			if(delimPos != -1)
				var trail = a.substr(delimPos+1);
			else
				continue;
			var trailPieces = trail.split('&');
			for(var ii=0;ii<trailPieces.length;ii++)
			{
				var trailHash = trailPieces[ii].split('=');
				if(!f[trailHash[0]])
				{
					var eInput = document.createElement("input");
					eInput.type = "hidden";
					eInput.name = trailHash[0];
					eInput.value = trailHash[1];
					f.appendChild(eInput);
				}
			}
		}
	}
}

addEvent(window, 'load', initGetActionTrailTransformation);

/***********************************************
* IFrame SSI script II- ï¿½ Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
* Visit DynamicDrive.com for hundreds of original DHTML scripts
* This notice must stay intact for legal use
***********************************************/
/*
//Input the IDs of the IFRAMES you wish to dynamically resize to match its content height:
//Separate each ID with a comma. Examples: ["myframe1", "myframe2"] or ["myframe"] or [] for none:
var iframeids=[];

//Should script hide iframe from browsers that don't support this script (non IE5+/NS6+ browsers. Recommended):
var iframehide="yes";

var getFFVersion=navigator.userAgent.substring(navigator.userAgent.indexOf("Firefox")).split("/")[1]
var FFextraHeight=parseFloat(getFFVersion)>=0.1? 16 : 0 //extra height in px to add to iframe in FireFox 1.0+ browsers

function resizeCaller() {
var dyniframe=new Array()
for (i=0; i<iframeids.length; i++){
if (document.getElementById)
resizeIframe(iframeids[i])
//reveal iframe for lower end browsers? (see var above):
if ((document.all || document.getElementById) && iframehide=="no"){
var tempobj=document.all? document.all[iframeids[i]] : document.getElementById(iframeids[i])
tempobj.style.display="block"
}
}
}

function resizeIframe(frameid){
var currentfr=document.getElementById(frameid)
if (currentfr && !window.opera){
currentfr.style.display="block"
if (currentfr.contentDocument && currentfr.contentDocument.body.offsetHeight) //ns6 syntax
currentfr.height = currentfr.contentDocument.body.offsetHeight+FFextraHeight;
else if (currentfr.Document && currentfr.Document.body.scrollHeight) //ie5+ syntax
currentfr.height = currentfr.Document.body.scrollHeight;
if (currentfr.addEventListener)
currentfr.addEventListener("load", readjustIframe, false)
else if (currentfr.attachEvent){
currentfr.detachEvent("onload", readjustIframe) // Bug fix line
currentfr.attachEvent("onload", readjustIframe)
}
}
}

function readjustIframe(loadevt) {
var crossevt=(window.event)? event : loadevt
var iframeroot=(crossevt.currentTarget)? crossevt.currentTarget : crossevt.srcElement
if (iframeroot)
resizeIframe(iframeroot.id);
}

function loadintoIframe(iframeid, url){
if (document.getElementById)
document.getElementById(iframeid).src=url
}

//addEvent(window, 'load', resizeCaller);
*/

/* menu.js */


var delayTime = 10;
//arrow1 = new Image();
//arrow1.src = '../img/menu_arrow1.gif';
//arrow2 = new Image();
//arrow2.src = '../img/menu_arrow2.gif';

function menuLink(actID,linkText,urlInfo,subLength)
{	
	this.urlInfo = urlInfo;
	this.actID = actID;
	this.linkText = linkText;
	this.subLength = subLength;
}

		
function getPath(Id)
{
	var mDepth = Id.length;	
	var p = new Array();		
	if(mDepth>=1){p[0] =  'obj_'+Id.charAt(0);}
	if(mDepth>=2){p[1] = p[0]+Id.charAt(1);}
	if(mDepth>=3){p[2] = p[1]+Id.charAt(2);}
	if(mDepth>=4){p[3] = p[2]+Id.charAt(3);}
	if(mDepth>=5){p[4] = p[3]+Id.charAt(4);}
	if(mDepth>=6){p[5] = p[4]+Id.charAt(5);}
	if(mDepth>=7){p[6] = p[5]+Id.charAt(6);}
	if(mDepth>=8){p[7] = p[6]+Id.charAt(7);}
	if(mDepth>=9){p[8] = p[7]+Id.charAt(8);}
		
	switch(p.length)
	{
		case 1: var ObjPath=M[p[0]];break;
		case 2: var ObjPath=M[p[1]];break;
		case 3: var ObjPath=M[p[2]];break;
		case 4: var ObjPath=M[p[3]];break;
		case 5: var ObjPath=M[p[4]];break;
		case 6: var ObjPath=M[p[5]];break;
		case 7: var ObjPath=M[p[6]];break;	
		case 8: var ObjPath=M[p[7]];break;
		case 9: var ObjPath=M[p[8]];break;							
	}
	
	return ObjPath;
}
//Style Pfad	
function StylePath(layerID) 
	{
		if(!NN4)
		{
			return document.getElementById(layerID).style;
		}
		else
		{
			 e1 = (document.getElementById('pos'));
			 
			 return (e1.layers[layerID]);
		}
	}	
//Style Changes
function changeStyle(Id,Cond)
{
	if(!NN4)
	{
		var Obj = getPath(Id);
		var ObjID = Obj.actID;
		var Cond = String(Cond);		
		document.getElementById(ObjID).className = 'css_'+ObjID.slice(3,ObjID.length)+'_'+Cond;
		window.status = Obj.linkText; //statusanzeige
		StylePath(ObjID).cursor = 'pointer'; //cursor
	}
}
//Globals
var actMenus = new Array();
var actLinks = new Array();
t = 0; //Starter
delayer = window.setTimeout('HideAll()',(delayTime*100));

//Show/(Hide) Funktion
function Show(Id)
{	
	out = 0;	
	window.clearTimeout(delayer);

	var Obj = getPath(Id); //aktueller Obj Pfad
	var actML = actMenus.length;
	var actLL = actLinks.length;

	if(t!==0)
	{
		var lastObj = getPath(actMenus[actML-1]);
		var currAct = Id.length;
		var lastAct = actMenus[actML-1].length;
					
		for(i=(actML-1);i>=((actML-1)-(lastAct-currAct));i--)
		{
			var thisObj = getPath(actMenus[i]);
			StylePath(thisObj.actID+'_sub').visibility = 'hidden';
			changeStyle(actMenus[i],0);
			//actMenus.pop();
			actMenus.length = actMenus.length-1;
			t--;
		}	
	}
	
	for(i=(actLL-1);i>=0;i--)
	{
		changeStyle(actLinks[i],0);
		//actLinks.pop();
		actLinks.length = actLinks.length-1;
	}				
			
	if(Obj.subLength!==0)
	{	//Ja:
		StylePath(Obj.actID+'_sub').visibility = 'visible';
		//actMenus.push(Id);
		actMenus[actMenus.length] = Id;
		t++;
	}	
	else
	{	//nein:
		//actLinks.push(Id);
		actLinks[actLinks.length] = Id;
	}	

	changeStyle(Id,1);
}

//timeout
function Hide()
{	
	out = 1;
	delayer = window.setTimeout('HideAll()',(delayTime*100));	
}

//verstecke alle
function HideAll()
{	
	for(i=actMenus.length-1;i>=0;i--)
	{		
		var thisObj = getPath(actMenus[i]);		
		StylePath(thisObj.actID+'_sub').visibility = 'hidden';
		changeStyle(actMenus[i],0);
		//actMenus.pop();
		actMenus.length = actMenus.length-1;
		t--;		
	}
	for(i=((actLinks.length)-1);i>=0;i--)
	{
		changeStyle(actLinks[i],0);
		//actLinks.pop();
		actLinks.length = actLinks.length-1;
	}
}

//Link [link]&[target]
function UrL(Obj) 
{
	s=Obj.lastIndexOf('&');
	actURL = M[('obj_'+(Obj.slice(0,s)))].urlInfo;
	actTarget =  Obj.slice((s+1),(Obj.length));
	
	if(actTarget == '')
	{
		actTarget = '_self';
	}
	
	/*if(document.getElementsByTagName('body') && document.getElementsByTagName('body')[0].style)
		document.getElementsByTagName('body')[0].style.cursor = 'wait';*/
	
	switch(actTarget)
	{
		case '_self': document.location = actURL;
		break;
		case '_top': top.location = actURL;
		break;
		case '_blank': window.open(actURL);
		break;
		case '_parent': parent.location=actURL;
		break;
		default: parent.frames[actTarget].location=actURL;
	}
	
	HideAll();
}

/* printpage.js */

function printPage(cssFile)
{
	var head = document.getElementById("pageHeader");
	var link = document.createElement("link");
	var rel = document.createAttribute("rel"); 
	rel.nodeValue = "stylesheet";
	var type = document.createAttribute("type");
	type.nodeValue = "text/css";
	var media = document.createAttribute("media"); 
	media.nodeValue = "print, embossed";
	var href = document.createAttribute("href"); 
	href.nodeValue = "print.css";
	link.setAttributeNode(rel);
	link.setAttributeNode(media);
	link.setAttributeNode(href);
	link.setAttributeNode(type);
	head.appendChild(link);
	print();
}

/* slider/slider.js */

function addAnEvent(el, evname, func)
{
    if (el.attachEvent) { // IE
        el.attachEvent("on" + evname, func);
    } else if (el.addEventListener) { // Gecko / W3C
        el.addEventListener(evname, func, true);
    } else {
        el["on" + evname] = func;
    }
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *

Originally from:
  http://www.arantius.com/article/lightweight+javascript+slider+control

Copyright (c) 2006 Anthony Lieuallen, http://www.arantius.com/

Permission is hereby granted, free of charge, to any person obtaining a copy of 
this software and associated documentation files (the "Software"), to deal in 
the Software without restriction, including without limitation the rights to 
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of 
the Software, and to permit persons to whom the Software is furnished to do so, 
subject to the following conditions:

The above copyright notice and this permission notice shall be included in all 
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS 
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR 
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER 
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN 
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function drawSliderByVal(slider) {
	var knob=slider.getElementsByTagName('img')[0];
	var p=(slider.val-slider.min)/(slider.max-slider.min);
	var x=(slider.scrollWidth-19)*p;
	knob.style.left=x+"px";
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function findPosX(obj)
{
	var curleft = 0;
	if (obj.offsetParent)
	{
		while (obj.offsetParent)
		{
		curleft += obj.offsetLeft
		obj = obj.offsetParent;
		}
	}
	else if (obj.x)
	curleft += obj.x;
	return curleft;
}

function setSliderByClientX(slider, clientX) {
	var p = (clientX-findPosX(slider))/(slider.scrollWidth - 0); 
	slider.val=(slider.max-slider.min)*p + slider.min;
	if (slider.val>slider.max) slider.val=slider.max;
	if (slider.val<slider.min) slider.val=slider.min;

	drawSliderByVal(slider);
	slider.onchange(slider.val, slider.num);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function sliderClick(e) {
	var el=sliderFromEvent(e);
	if (!el) return;

	setSliderByClientX(el, e.clientX);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function sliderMouseMove(e) {
	var el=sliderFromEvent(e);
	if (!el) return;
	if (activeSlider<0) return;

	setSliderByClientX(el, e.clientX);
	stopEvent(e);
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function sliderFromEvent(e) {
	if (!e && window.event) e=window.event;
	if (!e) return false;

	var el;
	if (e.target) el=e.target;
	if (e.srcElement) el=e.srcElement;

	if (!el.id || !el.id.match(/slider\d+/)) el=el.parentNode;
	if (!el) return false;
	if (!el.id || !el.id.match(/slider\d+/)) return false;

	return el;
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
function attachSliderEvents() {
	var divs=document.getElementsByTagName('div');
	var divNum;
	for(var i=0; i<divs.length; i++) {
		if (divNum=divs[i].id.match(/\bslider(\d+)\b/)) {
			// set initial properties
			divNum=parseInt(divNum[1]);
			divs[i].min=slider[divNum].min;
			divs[i].max=slider[divNum].max;
			divs[i].val=slider[divNum].val;
			divs[i].onchange=slider[divNum].onchange;
			divs[i].num=divNum;
			// and make sure the display matches
			drawSliderByVal(divs[i]);
			divs[i].onchange(divs[i].val, divNum);

			addAnEvent(divs[i], 'mousedown', function(e){
				sliderClick(e);
				var el=sliderFromEvent(e);
				if (!el) return;
				activeSlider=el.num;
				stopEvent(e);
			});
			addAnEvent(document, 'mouseup', function(e){
				activeSlider=-1;
				stopEvent(e);
			});
			/*addAnEvent(divs[i], 'mouseout', function(e){
				activeSlider=-1;
				stopEvent(e);
			});*/
		}
	}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
//borrowed from prototype: http://prototype.conio.net/
function stopEvent(event) {
	if (event.preventDefault) {
		event.preventDefault();
		event.stopPropagation();
	} else {
		event.returnValue=false;
		event.cancelBubble=true;
	}
}
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */
addAnEvent(window, 'load', attachSliderEvents);
addAnEvent(document, 'mousemove', sliderMouseMove);
var activeSlider=-1;
/* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * */


/* bbcode.js */

var form = 'post';
var textarea = 'answer';
var which=null;

function AddTag(open, close, content) {
	if(typeof(document.forms[form].elements[textarea])=='undefined'){
		if(which==null){
			var textfield = document.forms[form].elements['answer[0]'];
		}
		else{
			var textfield = which;
		}
	}
	else{
		var textfield = document.forms[form].elements[textarea];
	}
	textfield.focus();
	if(typeof document.selection != 'undefined') {
		var range = document.selection.createRange();
		if(content == ''){
			var toinsert = range.text;
		}
		else{
			toinsert = content;
		}
		range.text = open + toinsert + close;
		range = document.selection.createRange();
		if (toinsert.length == 0) {
			range.move('character', -close.length);
		}
		else {
			range.moveStart('character', open.length + toinsert.length + close.length);      
		}
		range.select();
	}
	else if(typeof textfield.selectionStart != 'undefined') {
		var start = textfield.selectionStart;
		var end = textfield.selectionEnd;
		if(content == ''){
			var toinsert = textfield.value.substring(start, end);
		}
		else{
			toinsert = content;
		}
		textfield.value = textfield.value.substr(0, start) + open + toinsert + close + textfield.value.substr(end);
		var pos;
		if (toinsert.length == 0) {
			pos = start + open.length;
		} 
		else {
			pos = start + open.length + toinsert.length + close.length;
		}
		textfield.selectionStart = pos;
		textfield.selectionEnd = pos;
	}
	else {
		if(content == ''){
			var toinsert=open + close;
		}
		else{
			toinsert=open + content + close;
		}
		textfield.innerHTML+=toinsert;
	}
}
AddMinSavingPlan
//insert [fondsGesamt] tag
function AddFondsGesamt() {
	AddTag('[fondsGesamt]', '', '');
}

//insert [minimaleSparplanHöhe] tag
function AddMinSavingPlan() {
	AddTag('[minimaleSparplanHöhe]', '', '');
}

//insert [minimaleVLSparplanHöhe] tag
function AddMinVLSavingPlan() {
	AddTag('[minimaleVLSparplanHöhe]', '', '');
}

//insert [fonds100Rabatt] tag
function AddFonds100Rabatt() {
	AddTag('[fonds100Rabatt]', '', '');
}

//insert [vlFondsGesamt] tag
function AddVLFondsGesamt() {
	AddTag('[vlFondsGesamt]', '', '');
}

//insert [fondsSparplanfähig] tag
function AddSPFondsGesamt() {
	AddTag('[fondsSparplanfähig]', '', '');
}

//insert [verlinkteAnbieterLogos] tag
function AddVerlinkteAnbieterLogos() {
	AddTag('[verlinkteAnbieterLogos]', '', '');
}

//insert [verlinkteProduktkategorien] tag
function AddVerlinkteProduktkategorien() {
	AddTag('[verlinkteProduktkategorien]', '', '');
}

//insert [info=?] tag
function AddKnowledgeBBCode()
{
	var category = prompt('Name der gewünschten Kategorie eingeben:');
	AddTag('[info=' + category + ']', '', '');
}

function AddKnowledgeLinkBBCode()
{
	var id = prompt('ID zur Verlinkung eingeben:');
	AddTag('[infolink=' + id + ']', '', '');
}

function AddProductTypeBox()
{
	var id = prompt('Name des Produkttyps eingeben:');
	AddTag('[producttypebox=' + id + ']', '', '');
}

// insert [img] tag
function AddImg() {
	AddTag('[IMG]', '[/IMG]', '');
}

// insert [url] or [email] tag
function AddLink(thetype) {
	AddTag("[" + thetype + "]", "[/" + thetype + "]", '');
}

//insert prebuild links
function AddURL()
{
	var target	= prompt('Ziel des Links eingeben:');
	var text	= prompt('Linktext eingeben:');
	
	AddTag('[URL=' + target + ']', '[/URL]', text)
}

//insert table
function AddTable()
{
	var header	= prompt('Tabellenüberschriften gewünscht? \'ja\' oder \'nein\' eingeben');
	var columns	= prompt('Anzahl Spalten eingeben');
	var rows	= prompt('Anzahl Zeilen eingeben');
	
	var tableStart = "[T]";
	
	if(header == 'ja') 
	{
		var headerStart = '[TR]';
		var headerContent = '';
		for(var i = 1; i <= columns; i++)
		{
			headerContent += '[TH][/TH]\n';
		}
		var headerEnd = '[/TR]';
	}
	if(header == 'ja') var completeHeader = headerStart + '\n' + headerContent + headerEnd + '\n';
	else var completeHeader = '';
	
	var completeRows = '';
	for(var j = 1; j <= rows; j++)
	{
		var rowStart = '[TR]';
		var rowContent = '';
		for(var i = 1; i <= columns; i++)
		{
			if(i != columns) rowContent += '[TD][/TD]\n';
			else rowContent += '[TD][/TD]';
		}
		var rowEnd = '[/TR]';
		
		completeRows += rowStart + '\n' + rowContent + '\n' + rowEnd + '\n';
	}
	
	var tableEnd = "[/T]";
	
	var completeTable = tableStart + '\n' + completeHeader + completeRows + tableEnd + '\n';
	
	AddTag('', '', completeTable);
}

// insert html list
function AddList() {
	type = prompt('Gebe \'1\' für eine nummerierte Liste, \'a\' für eine alphabetische Liste oder \'\' für eine gepunktete Liste ein', "");
	if((type == "a") || (type == "1")) {
		list = "[LIST=" + type + "]\n";
		listend = "[/LIST=" + type + "]";
	}
	else {
		list = "[LIST]\n";
		listend = "[/LIST]";
	}
	entry = "start";
	while ((entry != "") && (entry != null)) {
		entry = prompt('Gebe einen Listen-Punkt ein. Gebe nichts ein oder klicke auf \'abbrechen\' um die Liste zu beenden.', "");
		if ((entry != "") && (entry != null))
			list = list + "[*]" + entry + "[/*]\n";
	}
	if(list != "[LIST]\n" && list !="[LIST=" + type + "]\n"){
		addtext = list + listend;	
		AddTag('', '', addtext);
	}
}

//insert [H3] tag
function AddH3() {
	AddTag('[H]', '[/H]', '');
}

// insert [b] tag
function AddB() {
	AddTag('[B]', '[/B]', '');
}

// insert [U] tag
function AddU() {
	AddTag('[U]', '[/U]', '');
}

// insert [I] tag
function AddI() {
	AddTag('[I]', '[/I]', '');
}

// insert [S] tag
function AddS() {
	AddTag('[S]', '[/S]', '');
}

// insert [quote] tag
function AddQuote() {
	AddTag('[quote]', '[/quote]', '');
}

// insert [code] tag
function AddCodetag() {
	AddTag('[code]', '[/code]', '');
}

//bbcode checker
function validbbcode(txt){
	searchregexp = /\[(B|\/B|U|\/U|T|\/T|TH|\/TH|TR|\/TR|TD|\/TD|H|\/H|I|\/I|S|\/S|code|\/code|LIST|LIST[a1=]*|\/LIST[a1=]*|\*|\/\*|\/LIST|EMAIL[a-zA-Z0-9=#@\._-]*|\/EMAIL|URL[a-zA-Z0-9=#,;+@&?%:\/\._-]*|\/URL|IMG|\/IMG|QUOTE[^\]]*|\/QUOTE|TOGGLE[^\]]*|\/TOGGLE|SIZE=[1-5]{1}|\/SIZE|COLOR[^\]]*|\/COLOR|ALIGN[^\]]*|\/ALIGN|FONT[^\]]*|\/FONT)\]/ig;
	resulttemp=txt.match(searchregexp);
	if(null==resulttemp){
	  resulttemp=new Array();
	}
	result=new Array();
	ocode=0;
	putincounter=0;
	for(c=0;c<resulttemp.length;c++){
		if((resulttemp[c]=='[code]') || (resulttemp[c]=='[CODE]') || (resulttemp[c]=='[/code]') || (resulttemp[c]=='[/CODE]')){
			if((resulttemp[c]=='[code]') || (resulttemp[c]=='[CODE]')){
				ocode++;
				if(ocode==1){
					result[putincounter]=resulttemp[c];
					putincounter++;
				}
			}
			else{
				ocode--;
				if(ocode==0){
					result[putincounter]=resulttemp[c];
					putincounter++;
				}
			}
		}
		else{
			if(ocode<1){
				result[putincounter]=resulttemp[c];
				putincounter++;
			}
			continue
		}
	}
	if(result==null){
    return true;
  }
  arraylength=result.length;
  if(arraylength>0){
	  starttest=result[0].split('=');
	  if(!(arraylength % 2)){
		  if(starttest[0].indexOf('/')==-1){
		  	openingtagcounter=0;
		  	closingtagcounter=0;
		  	for(i=0;i<arraylength;i++){
		  		temp=result[i].split('[');
		  		temp=temp[1].split(']');
		  		temp=temp[0].split('=');
					if(temp[0].indexOf('/')==-1){
		  			openingtagcounter++;
		  		}
		  		else{ 
		  			closingtagcounter++;
		  		}
		  	}
		  	if(openingtagcounter==closingtagcounter){
		  		openingtags=new Array();
		  		closingtags=new	Array();
		  		for(i=0;i<arraylength;i++){
		  			temp=result[i].split('[');
			  		temp=temp[1].split(']');
			  		temp=temp[0].split('=');
					  if(temp[0].indexOf('/')==-1){ 
			  			openingtags.push(temp[0]);
			  		}
			  		else{  
			  			tmpstring=openingtags.pop();
			  			if((temp[0].toLowerCase()) == (('/' + tmpstring).toLowerCase())){
			  				
			  			}
			  			else{
			  				window.alert('Falsche Schachtelung der BBCode Tags');
			  				return false;
			  			}
			  		}
		  		}
		  		return true;
		  	}
		  	else{
		  		window.alert('Ungleiche Anzahl öffnender und schließender BBCode Tags');
		  		return false; 
		  	}
		  }
		  else{
		  	window.alert('Erster BBcode Tag im Text darf kein schließender Tag sein');
		  	return false; 
		  }
	  }
	  else{
	  	window.alert('Ungerade Anzahl an BBCode Tags');
	  	return false;
	  }
	}
	else{
	  return true;
	}
}


