//////
function report(reported_val, report_type) {
   var text = prompt("Scrie motivul:");
   if (!text) return alert("Trebuie sa scri un motiv!");
   if (!reported_val || !report_type) return;
   $.ajax({
     type: "POST",
     url: "ajax_report.php",
     data: "text="+text+"&type="+report_type+"&val="+reported_val,
     success: function(msg){
             return alert("Multumim, un membru al echipei noastre va analiza aceasta sesizare!");
    }});
}












////////
//** Tab Content script- © Dynamic Drive DHTML code library (http://www.dynamicdrive.com)
//** Last updated: Nov 8th, 06

var enabletabpersistence=1 //enable tab persistence via session only cookies, so selected tab is remembered?

////NO NEED TO EDIT BELOW////////////////////////
var tabcontentIDs=new Object()

function expandcontent(linkobj){
var ulid=linkobj.parentNode.parentNode.id //id of UL element
var ullist=document.getElementById(ulid).getElementsByTagName("li") //get list of LIs corresponding to the tab contents
for (var i=0; i<ullist.length; i++){
ullist[i].className=""  //deselect all tabs
if (typeof tabcontentIDs[ulid][i]!="undefined") //if tab content within this array index exists (exception: More tabs than there are tab contents)
document.getElementById(tabcontentIDs[ulid][i]).style.display="none" //hide all tab contents
}
linkobj.parentNode.className="selected"  //highlight currently clicked on tab
document.getElementById(linkobj.getAttribute("rel")).style.display="block" //expand corresponding tab content
saveselectedtabcontentid(ulid, linkobj.getAttribute("rel"))
}

function expandtab(tabcontentid, tabnumber){ //interface for selecting a tab (plus expand corresponding content)
var thetab=document.getElementById(tabcontentid).getElementsByTagName("a")[tabnumber]
if (thetab.getAttribute("rel"))
expandcontent(thetab)
}

function savetabcontentids(ulid, relattribute){// save ids of tab content divs
if (typeof tabcontentIDs[ulid]=="undefined") //if this array doesn't exist yet
tabcontentIDs[ulid]=new Array()
tabcontentIDs[ulid][tabcontentIDs[ulid].length]=relattribute
}

function saveselectedtabcontentid(ulid, selectedtabid){ //set id of clicked on tab as selected tab id & enter into cookie
if (enabletabpersistence==1) //if persistence feature turned on
setCookie(ulid, selectedtabid)
}

function getullistlinkbyId(ulid, tabcontentid){ //returns a tab link based on the ID of the associated tab content
var ullist=document.getElementById(ulid).getElementsByTagName("li")
for (var i=0; i<ullist.length; i++){
if (ullist[i].getElementsByTagName("a")[0].getAttribute("rel")==tabcontentid){
return ullist[i].getElementsByTagName("a")[0]
break
}
}
}

function initializetabcontent(){
if (arguments.length > 0) {
for (var i=0; i<arguments.length; i++){ //loop through passed UL ids
if (enabletabpersistence==0 && getCookie(arguments[i])!="") //clean up cookie if persist=off
setCookie(arguments[i], "")
var clickedontab=getCookie(arguments[i]) //retrieve ID of last clicked on tab from cookie, if any
var ulobj=document.getElementById(arguments[i])
if(!ulobj) return;
var ulist=ulobj.getElementsByTagName("li") //array containing the LI elements within UL
for (var x=0; x<ulist.length; x++){ //loop through each LI element
var ulistlink=ulist[x].getElementsByTagName("a")[0]
if (ulistlink.getAttribute("rel")){
savetabcontentids(arguments[i], ulistlink.getAttribute("rel")) //save id of each tab content as loop runs
ulistlink.onclick=function(){
expandcontent(this)
return false
}
if (ulist[x].className=="selected" && clickedontab=="") //if a tab is set to be selected by default
expandcontent(ulistlink) //auto load currenly selected tab content
}
} //end inner for loop
if (clickedontab!=""){ //if a tab has been previously clicked on per the cookie value
var culistlink=getullistlinkbyId(arguments[i], clickedontab)
if (typeof culistlink!="undefined") //if match found between tabcontent id and rel attribute value
expandcontent(culistlink) //auto load currenly selected tab content
else //else if no match found between tabcontent id and rel attribute value (cookie mis-association)
expandcontent(ulist[0].getElementsByTagName("a")[0]) //just auto load first tab instead
}
} 
}//end outer for loop
}


function getCookie(Name){ 
var re=new RegExp(Name+"=[^;]+", "i"); //construct RE to search for target name/value pair
if (document.cookie.match(re)) //if cookie found
return document.cookie.match(re)[0].split("=")[1] //return its value
return ""
}

function setCookie(name, value){
document.cookie = name+"="+value //cookie value is domain wide (path=/)
}

var d = document;
var winIE = (navigator.userAgent.indexOf("Opera")==-1 && (d.getElementById &&  d.documentElement.behaviorUrns))  ? true : false;

function bodySize(){
return;
	if(winIE && d.documentElement.clientWidth) {
		sObj = d.getElementById("min-width").style;
		sObj.width = (d.documentElement.clientWidth<=940) ? "940px" : "100%";
	}
}
function init(){
	if(winIE) { bodySize(); }
 }
 
onload = init;

if(winIE) { onresize = bodySize; }

var MSG_INVALID_DATE_FORMAT = 'Formatul datei este invalid!  Trebuie sa fie de forma: LL/ZZ/AAAA.';
var MSG_INVALID_MONTH       = 'Data invalida: %1 luna trebue sa fine intre 1 - 12';
var MSG_INVALID_DAY         = 'Data invalida: %1 , ziua este invalida.';
var MSG_INVALID_YEAR        = 'Data invalida: %1 , anul trebuie sa fie mai mare de 1900.';
var MSG_INVALID_EMAIL       = 'E-mail invalid: %1';
var MSG_INVALID_DOMAIN      = 'Domeniu invalid %1. Trebuie sa fie de forma \'mydomain.com\'.';
var MSG_INVALID_PASSWORD    = 'Parolele trebuie sa aiba intre 6-10 caractere alfanumerice(a-z/1-9)!';
var MSG_INVALID_USERID      = 'Nick-urile trebuie sa contina doar caractere alfanumerice si \'_\'!';
var MSG_INVALID_ALPHANUMERIC= 'Acest campt trebuie sa contina doar caractere alfanumerice, \'_\' si \'-\'!';
var MSG_INVALID_ALPHANUMERIC_WS= 'Acest campt trebuie sa contina doar caractere alfanumerice, \'_\', \'-\' si spatiu!';
var MSG_INVALID_URL         = 'Link-urile nu trebuie sa contina *, " sau \'';
var MSG_REQ_FIELD           = '%1 este un camp obligatoriu.';
var MSG_AT_LEAST_ONE_FIELD  = 'Cel putin una dintre %1 si %2trebuie schimbata.';
var MSG_AT_LEAST_ONE_FIELD_CHANGED  = 'Cel putin una dintre %1 si %2 trebuie schimbata.';
var MSG_MAX_LENGTH			= '%1 trebuie sa contina maxim %2 caractere.';
var MSG_MIN_LENGTH			= '%1 trebuie sa aiba cel putin %2 caractere.';
var MSG_ALPHA_NUMERIC		= '%1 trebuie sa fie alfanumerica.';
var MSG_ALPHA 				= '%1 trebuie sa contina doar litere (a-z).';
var MSG_NAME				= '%1 trebuie sa fie alfanumerica, spatiu si !';
var MSG_NUMERIC             = '%1 trebuie sa contina doar numere.';
var MSG_LONG             = '%1 trebuie sa contina doar numere.';
var MSG_TWO_FIELDS			= '%1 si %2 trebuie sa fie la fel.';
var MSG_CONFIRM_TWO_FIELDS  = 'Parola noua este aceeasi cu parola veche esti sigur ca vrei sa continui?';
var MSG_NOT_TWO_FIELDS      = '%1 and %2 may not have the same value.';
var MSG_REQUIRED_SELECT		= 'Te rugam sa selectezi o valoare pentru %1.';
var MSG_FIELD_INVALID       = '%1 este invalid';
var MSG_TO_AGE_MUST_BIGGER  = 'Selecteaza varsta de la mai mic la mai mare. ';
var MSG_CONFIRM_TRANSACTION = "You are about to process a secure transaction that may take a minute to complete.Please do not click 'Back' on your web browser during the processing,as you will not receive confirmation of your transaction. Do you want to proceed?"
var MSG_INVALID_ZIP_CODE_FORMAT = 'Invalid Zip Code';
var MSG_INVALID_POSTAL_CODE_FORMAT = 'Invalid Postal code';
var MSG_ZIP_5_OR_9='Zip Code must be 5 or 9 numbers.';
var MSG_ZIP_5='Zip Code must be 5 numbers.';
var MSG_TOO_MANY_EMAILS_ADDRESSES='%1 may only contain a maximum of %2 email addresses';
var MSG_PHONE_NUMBER_VALID_CHARACTERS = '%1 trebuie sa contina doar cifre intre 0-9';
var MSG_PHONE_NUMBER_NORTH_AMERICA_INVALID_FORMAT = '%1 must be of the format NXX-NXX-XXXX where N is the digits 2-9 and X is any digit.';
var MSG_PHONE_NUMBER_NORTH_AMERICA_RESERVED_AREA_CODE =  'Reserved area codes, such as 800, 888, 900, etc,  and emergency service numbers, such as 411, 911, etc,  are not permitted.';
var MSG_PHONE_NUMBER_VALID_CHARACTERS = '%1 may only contain the following characters: 0-9()-.';
var MSG_PHONE_NUMBER_NORTH_AMERICA  = '%1 must contain 10 digits.';
var MSG_MOBILE_NUMBER_VALID_CHARACTERS = '%1 may only contain the following the digits 0-9 (Note: The Date Mobile section is optional and can be left blank)';
var MSG_MOBILE_NUMBER_NORTH_AMERICA_INVALID_FORMAT = '%1 must be of the format NXX-NXX-XXXX where N is the digits 2-9 and X is any digit. (Note: The Date Mobile section is optional and can be left blank)';
var MSG_MOBILE_NUMBER_NORTH_AMERICA_RESERVED_AREA_CODE =  'Reserved area codes, such as 800, 888, 900, etc,  and emergency service numbers, such as 411, 911, etc,  are not permitted. (Note: The Date Mobile section is optional and can be left blank)';
var MSG_TOO_MANY_DOMAINS='%1 may only contain a maximum of %2 email addresses';
var MSG_MOBILE_NUMBER_VALID_CHARACTERS = '%1 may only contain the following characters: 0-9()-. (Note: The Date Mobile section is optional and can be left blank)';
var MSG_MOBILE_NUMBER_NORTH_AMERICA  = '%1 must contain 10 digits. (Note: The Date Mobile section is optional and can be left blank)';
var MSG_NUMERIC_MIN          = '%1 must be greater than or equal to %2'
var MSG_NUMERIC_MAX          = '%1 must be less than or equal to %2'
var MSG_MAX_LENGTH_COUNTER	= 'You have reached the maximum of %1 characters for this field.';
var MSG_NON_EMPTY_DEPENDENCY = '%1 has been completed. %2 cannot be empty if %1 has been completed.';
var MSG_SAVED_SEARCH_EMPTY = 'Introdu un nume pentru a salva aceasta cautare.';
var MSG_REGISTRATION_UPLOAD_PHOTO_SKIP_STEP = 'Ai umplut campurile necesare adaugarii unei poze.Esti sigur ca vrei sa sari peste acest pas?'


var popup = null;
function setFocus(form,field)
{
	if (form != '') {
		try	{document.forms[form][field].focus();} catch(e) {}
	}
	else {
		try	{document.forms[0][field].focus();} catch(e) {}
	}
}

function winpop(loc,w,h,scroll) {
	var name = loc.replace(/\W/g, "");
	window.open(loc,name,'width='+w+', height='+h+', location=no, directories=no, menubar=no, scrollbars='+scroll+', resizable=no, status=no, toolbar=no');
}

function newpop(url,name, style) {
	var win=window.open(url,name,style);
	try{ win.focus();} catch(e) {}
}

/* Add an onload function */
var gOnload = new Array();
function addOnload(f)
{

	if (window.onload)
	{
		if (window.onload != runOnload)
		{
			gOnload[0] = window.onload;
			window.onload = runOnload;
		}
		gOnload[gOnload.length] = f;
	}
	else
		window.onload = f;
}
function runOnload()
{
	for (var i=0;i<gOnload.length;i++)
		gOnload[i]();
}

/* Trim the whitespace from beginning and the end of the given string. */
function trim(str)
{
	str = new String(str);
	return str.replace(/^\s+/,'').replace(/\s+$/,'');
}

/* Add a trim method to String's. */
function strtrim()
{
	return trim(this);
}
String.prototype.trim = strtrim;

/** Changes the action for the given form and calls submit. */
function submitForm(form, action)
{
	form.action = action;
	form.submit();
}
/** Replace the current page in the browser history with a call to the page with
	form params encoded as GET parameters */
function locationReplaceForm(form, url) {
	url += '?';
	var tot = form.elements.length;
	for (var i = 0; i < tot; i++) {
		var e = form.elements[i];
		if (! isEmpty(e)) {
			url += e.name + '=' + e.value;
			if (i < tot -1) {
				url+='&';
			}
		}
	}
	location.replace(url);
}


function isEmpty(field) {
	
	//if the field is disabled treat it as an empty field.
	if (field.disabled){return true;}
	
	if (field.type=='checkbox'||(field[0]&&field[0].type == 'checkbox')) {
		return !isCheckBoxChecked(field);
	}
	if (field.type=='radio'||(field[0]&&field[0].type == 'radio')) {
		return !isCheckBoxChecked(field);
	}
	//Try trim - will fail for input type="file".
	try
	{
		field.value = field.value.trim();
	}
	catch(e) {}
	if (field.value.length == 0) {
		return true;
	}
}

function isCheckBoxChecked(field) {
	if (field[0]) {
		for (i = 0;i<field.length;i++) {
			theField = field[i];
			if (theField.checked) {
				return true;
			}
		}
		return false;
	} else {
		if (!field.checked) {
			return false;
		}
	}
	return true;
}
function validateRequiredField(field, name)
{
  return validateRequiredField(field, name, '');
}

/** Validates required field */
function validateRequiredField(field, name, dv)
{
	//Try trim - will fail for input type="file".
	try
	{
		field.value = field.value.trim();
		dv = dv.trim();
	}
	catch(e) {}

	if (field.value.length == 0 || field.value == dv)
	{
		alert(MSG_REQ_FIELD.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Validates that at least one checkbox in the form with the input field name is checked. */
function validateRequiredCheckbox(field, name, msg) {
	if (!isCheckBoxChecked(field)) {
		alert(msg.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Validates required drop down */
function validateRequiredSelect(field, name, defaultValue) {
	if (field.value == null || field.value == '' || field.value == defaultValue) {
		alert(MSG_REQUIRED_SELECT.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	else {
		return true;
	}
}

function validateRequiredMultiSelect(field, name) 
{
  var selected = false;
  for (i=0; i<field.length; i++) {
    if (field.options[i].selected) {
      selected = true;
      break;
    }
  }
  if (selected) return true;
	alert(MSG_REQUIRED_SELECT.replace('%1', name));
	try{field.focus();}catch(e){}
	return false;
}  

/** Validate that a field is less than or equal to the max length. 
	If the value of that field is too large, chop off the extraneous characters. */
function validateMaxLength(field, name, maxLength)
{
	var value = field.value;
	var originalVal = value;	//store a copy with the \n's in it
	var newVal = "";	//new value with any extra characters removed from it so as not to go over maxLength
	var character = null;
	value = value.replace(/\n/g,'**'); // bug #4830 when the javascript validates it sees \n's and java validates it sees \r\n's so a string may pass javascript validation but fail java validation, solution validate on a copy of the string with all \n's replaced with 2 characters to simulate the java length
	
	if (value.length > maxLength)
	{
		//loop through the string getting one character at a time.
		//If we encounter a \n we have to count it as 2 characters due to bug #4830
		for(var i=0, count=1; count<=maxLength; i++, count++){
				character = originalVal.charAt(i);
				
				//if this is a new line char make sure we have 2 spaces available in the new string
				if(character == "\n" && count<=maxLength-1){
					newVal = newVal.concat(character);
					count++;
				}else{
					newVal = newVal.concat(character);
				}
		}
		
		var msg = MSG_MAX_LENGTH.replace('%1', name);
		msg = msg.replace('%2', maxLength);
		alert(msg);
		try{
			//substitute in the shortened string into the field.
			field.value = newVal;
			field.focus();
		}catch(e){}
		return false;
	}
	return true;
}

/** Validate that a field is greater than or equal to the min length. */
function validateMinLength(field, name, minLength) {
	if (field.value.length < minLength) {
		var msg = MSG_MIN_LENGTH.replace('%1', name);
		msg = msg.replace('%2', minLength);
		alert(msg);
		try{field.focus();}catch(e){}
		return false;
	}
	else {
		return true;
	}
}

/** Validates the email field. If the field is not valid, focus is given to that field. */
function validateEmailField(emailField, name)
{
	emailField.value = emailField.value.trim();
	if (isEmpty(emailField)) return true; 

	if (!checkEmail(emailField.value)) {
		alert(MSG_INVALID_EMAIL.replace('%1', emailField.value));
		try{emailField.focus();}catch(e){}
		return false;
	}

	return true;
}

/** Validates the email field without checking for bad domains/users etc. */
function validateAnyEmailField(emailField, name)
{
	emailField.value = emailField.value.trim();
	if (isEmpty(emailField)) return true; 

	if (!checkAnyEmail(emailField.value)) {
		alert(MSG_INVALID_EMAIL.replace('%1', emailField.value));
		try{emailField.focus();}catch(e){}
		return false;
	}

	return true;
}

/** Validates multiple email fields. If the field is not valid, focus is given to that field. */
function validateMultipleEmailField(field, name, max) {
	field.value = field.value.trim();
	field.value = field.value.replace(/;/g, ',');
	field.value = field.value.replace(/,+/g, ',');
	field.value = field.value.replace(/^,/, '');
	field.value = field.value.replace(/,$/, '');
	//TODO: could check for duplicates...
	var array = field.value.split(",");
	if (array.length > max) {
		alert(MSG_TOO_MANY_EMAILS_ADDRESSES.replace('%1', field.name).replace('%2', max));
		try{field.focus();}catch(e){}
		return false;
	}

	for (var i = 0 ; i < array.length ; i++) {
		array[i] = array[i].trim();
		if (!checkEmail(array[i])) {
			alert(MSG_INVALID_EMAIL.replace('%1', array[i]));
			try{field.focus();}catch(e){}
			return false;
		}
	}
	return true;
}

function validateDomainField(domainField, name){
 domainField.value = domainField.value.trim();
 if (!checkDomain(domainField.value)) {
  alert(MSG_INVALID_DOMAIN.replace('%1', domainField.value));
  try{domainField.focus();}catch(e){}
  return false;
 }
 return true;
}
function validateMultipleDomainField(field, name, max) {
 field.value=field.value.trim();
 field.value=field.value.replace(/;/g, ',');
 field.value=field.value.replace(/,+/g, ',');
 field.value=field.value.replace(/^,/, '');
 field.value=field.value.replace(/,$/, '');
 //TODO: could check for duplicates...
 var array=field.value.split(",");
 if (array.length > max) {
	alert(MSG_TOO_MANY_DOMAINS.replace('%1', field.name).replace('%2', max));
	try{field.focus();}catch(e){}
	return false;
 }
 for (var i=0 ; i < array.length ; i++) {
	array[i]=array[i].trim();
	if (!checkDomain(array[i])) {
	 alert(MSG_INVALID_DOMAIN.replace('%1', array[i]));
	 try{field.focus();}catch(e){}
	 return false;
	}
 }
 return true;
}

/** Checks that a field contains only alphanumeric values */
function validateAlphaNumeric(field, name)
{
	var mask = /^[_0-9a-zA-Z-]*[_0-9a-zA-Z-]$/
	if (!mask.test(field.value)) {
		alert(MSG_ALPHA_NUMERIC.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

function validateAlphaNumeric_search(field, name)
{
	var mask = /^[_0-9a-zA-Z-*]*[_0-9a-zA-Z-*]$/
	if (!mask.test(field.value)) {
		alert(MSG_ALPHA_NUMERIC.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only alphanumeric values */
function validateAlphaNumericWS(field, name)
{
	var mask = /^[_0-9a-zA-Z-\s]*[_0-9a-zA-Z-\s]$/
	if (!mask.test(field.value)) {
		alert(MSG_ALPHA_NUMERIC.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only alphanumeric values and dot*/
function validateAlphaNumericDot(field, name)
{
	var mask = /^[_0-9a-zA-Z-\.]*[_0-9a-zA-Z-\.]$/
	if (!mask.test(field.value)) {
		alert(MSG_ALPHA_NUMERIC.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only numeric values */
function validateNumeric(field, name)
{
	var val = trim(field.value);
	field.value = val;
	var mask = /^-?[0-9]*(\.)?[0-9]*$/
	if (!mask.test(val)) {
		alert(MSG_NUMERIC.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only numeric values */
function validateLong(field, name)
{
	var val = trim(field.value);
	field.value = val;
	if (isEmpty(field)) return true;
	var mask = /^-?[0-9]*[0-9\s]$/
	if (!mask.test(val)) {
		alert(MSG_LONG.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only numeric values and is > a minimum value. */
function validateMinNumeric(field, name, minValue)
{
	if (isEmpty(field)) return true;
	if (!validateNumeric(field, name)) return false;
	var value = trim(field.value);
	if (value < minValue) {
		alert(MSG_NUMERIC_MIN.replace('%1', name).replace('%2', minValue));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only numeric values and is < a maximum value. */
function validateMaxNumeric(field, name, maxValue)
{
	if (isEmpty(field)) return true;
	if (!validateNumeric(field, name)) return false;
	var value = trim(field.value);
	if (value > maxValue) {
		alert(MSG_NUMERIC_MAX.replace('%1', name).replace('%2', maxValue));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only numeric values */
function validateNumericWS(field, name)
{
	var val = trim(field.value);
	if (val == null || val == '') return true;
	var mask = /^[0-9-\s]*[0-9-\s]$/
	if (!mask.test(val)) {
		alert(MSG_NUMERIC.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains only alphanumeric values */
function validateAlpha(field, name)
{
	var mask = /^[_a-zA-Z-\s~]*[_a-zA-Z-\s~]$/
	if (!mask.test(field.value)) {
		alert(MSG_ALPHA.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Checks that a field contains alphanumeric values, periods and exclamation marks only */ 
function validateName(field, name) 
{
	var mask = /^[_a-zA-Z-\s~\.!']*[_a-zA-Z-\s~\.!']$/
	if (!mask.test(field.value)) {
		alert(MSG_NAME.replace('%1', name));
		try{field.focus();}catch(e){}
		return false;
	}
	return true;

}

/** Validates the first field is greater than or equal to the second field*/
function confirmNoLess(field,name,field2,name2)
{
	if (Number(field.value) < Number(field2.value)){
		var msg = MSG_TO_AGE_MUST_BIGGER.replace('%1',name);
		msg = msg.replace('%2',name2);
		alert(msg);
		field.focus();
		return false;
	}else{
		return true
	}
}

/** Validates that two fields have the same value and ask for confirmation*/
function confirmTwoFields(field,name,field2,name2)
{
	if (field.value == field2.value)
	{
		var msg = MSG_CONFIRM_TWO_FIELDS;
		field.focus();
		return confirm(msg);
	}else
	{
		return true
	}

}

/** Validates that at least one of the specified fields is present. Displays default message. */
function validateAtLeastOneField(field,name,field2,name2) {
  var msg = MSG_AT_LEAST_ONE_FIELD.replace('%1', name);
  msg = msg.replace('%2', name2);
	return validateAtLeastOneField(field,name,field2,name2,msg);
}

/** Validates that at least one of the specified fields is present */
function validateAtLeastOneField(field,name,field2,name2,msg) {
	if (isEmpty(field)&&isEmpty(field2))
	{
		alert(msg);
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Validates that two fields have the same value */
function validateTwoFields(field,name,field2,name2) {
	if (field.value != field2.value){
		var msg = MSG_TWO_FIELDS.replace('%1', name);
		msg = msg.replace('%2', name2);
		alert(msg);
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Validates that two fields have the same value, disregarding case */
function validateTwoFieldsIgnoreCase(field,name,field2,name2) {
	if (field.value.toLowerCase() != field2.value.toLowerCase()){
		var msg = MSG_TWO_FIELDS.replace('%1', name);
		msg = msg.replace('%2', name2);
		alert(msg);
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Validates that two fields do not have the same value */
function validateNotTwoFields(field,name,field2,name2) {
	if (field.value == field2.value){
		var msg = MSG_NOT_TWO_FIELDS.replace('%1', name);
		msg = msg.replace('%2', name2);
		alert(msg);
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/**
 * This checks to make sure that field1 is non-empty. If it is non-empty then
 * field2 must be non-empty. If field1 is empty then we don't care
 * if field2 is empty or not. Basically, a check of field2 is only
 * dependent on field1 being empty or not.
 */
function nonEmptyDependency(field1, field1Name, field2, field2Name, message){
	if(!isEmpty(field1) && isEmpty(field2)){
		alert(message);
		return false;
	}else{
		return true;
	}
}

/**
 * Reference: Sandeep V. Tamhankar (stamhankar@hotmail.com),
 * http://javascript.internet.com
 */
function checkEmail(emailStr) {
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]!%";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			return false;
		}
	}

	if (user.match(userPat)==null) {
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				return false;
			}
		}
		return true;
	}

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			return false;
		}
	}

	if (domArr[len-1].length < 2) {
		return false;
	}

	if (len<2) {
		return false;
	}

	var mask=/@(date.com|date.net|matchmaker.com|matchmaker.net|matchmaker.org|matchmaker.biz|mm.org|gay.com|wellsfargo.com|spamhole.com|mailinator.com|klassmaster.com|fakeinformation.com|sogetthis.com|spambob.com|spamgourmet.com|spamex.com)/i;
	if (mask.test(emailStr.toLowerCase())) {
		return false;
	}
	/*mask=/^(root|abuse|webmaster|help|postmaster|sales|resumes|contact|advertising|spam|spamtrap|nospam|noc|admin|support|daemon|listserve|listserver|autoreply)@/i;
	if (mask.test(emailStr.toLowerCase())) {
		return false;
	}*/

	return true;
}

/**
 * Reference: Sandeep V. Tamhankar (stamhankar@hotmail.com),
 * http://javascript.internet.com
 */
function checkAnyEmail(emailStr) {
	var emailPat=/^(.+)@(.+)$/;
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]!%";
	var validChars="\[^\\s" + specialChars + "\]";
	var quotedUser="(\"[^\"]*\")";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var word="(" + atom + "|" + quotedUser + ")";
	var userPat=new RegExp("^" + word + "(\\." + word + ")*$");
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	var matchArray=emailStr.match(emailPat);

	if (matchArray==null) {
		return false;
	}
	var user=matchArray[1];
	var domain=matchArray[2];

	for (i=0; i<user.length; i++) {
		if (user.charCodeAt(i)>127) {
			return false;
		}
	}
	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			return false;
		}
	}

	if (user.match(userPat)==null) {
		return false;
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				return false;
			}
		}
		return true;
	}

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			return false;
		}
	}

	if (domArr[len-1].length < 2) {
		return false;
	}

	if (len<2) {
		return false;
	}

	return true;
}

function checkDomain(domain) {
	var specialChars="\\(\\)><@,;:\\\\\\\"\\.\\[\\]!%";
	var validChars="\[^\\s" + specialChars + "\]";
	var ipDomainPat=/^\[(\d{1,3})\.(\d{1,3})\.(\d{1,3})\.(\d{1,3})\]$/;
	var atom=validChars + '+';
	var domainPat=new RegExp("^" + atom + "(\\." + atom +")*$");

	for (i=0; i<domain.length; i++) {
		if (domain.charCodeAt(i)>127) {
			return false;
	   }
	}

	var IPArray=domain.match(ipDomainPat);
	if (IPArray!=null) {
		for (var i=1;i<=4;i++) {
			if (IPArray[i]>255) {
				return false;
			}
		}
		return true;
	}

	var atomPat=new RegExp("^" + atom + "$");
	var domArr=domain.split(".");
	var len=domArr.length;
	for (i=0;i<len;i++) {
		if (domArr[i].search(atomPat)==-1) {
			return false;
		}
	}

	if (domArr[len-1].length < 2) {
		return false;
	}

	if (len!=2) {
		return false;
	}

	var mask=/date.com/i;
	if (mask.test(domain.toLowerCase())) {
		return false;
	}
	mask=/date.net/i;
	if (mask.test(domain.toLowerCase())) {
		return false;
	}
	mask=/date.info/i;
	if (mask.test(domain.toLowerCase())) {
		return false;
	}

	return true;
}

/** Validates a URL. */
function validateURL(field)
{
	var str = field.value;
	if ( str.indexOf("*") != -1 || str.indexOf('"') != -1 || str.indexOf("'") != -1 ) {
		alert(MSG_INVALID_URL);
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Returns true if the string only contains digits. */
function validateNumber(str, scale, precision)
{
	if (precision == 0) {
		var format = new RegExp('^\\s*\\d{0,'+scale+'}\\s*$');
		return format.test(str);
	}
	var format = new RegExp('^\\s*\\d{0,'+(scale-precision)+'}\\.\\d{0,'+precision+'}\\s*$');
	if ( format.test(str) ) {
		return true;
  	} else {
		format = new RegExp('^\\s*\\d{0,'+scale+'}\\s*$');
		return format.test(str);
  	}
}

/** THE FOLLOWING ARE NOT CURRENTLY IN USE **/
/** Validates a date string returns true if it is of the form MM/DD/YYYY. */
function validateDate(str)
{
  // Validate format
  var dateformat = /^\s*\d{1,2}\/\d{1,2}\/\d{2,4}\s*$/;  // MM/DD/YYYY

  if ( !dateformat.test(str) ) {
	alert(MSG_INVALID_DATE_FORMAT);
	return false;
  }

  var elements = str.split('/');

  // check month
  var month = elements[0];
  if (month < 1 || month > 12) {
	alert(MSG_INVALID_MONTH.replace('%1', str));
	return false;
  }

  // check day
  var day = elements[1];
  if (!validDate(month, day)) {
	alert(MSG_INVALID_DAY.replace('%1', str));
	return false;
  }

  // check year
  var year = elements[2];
  if (year < 100 && year > 50) year += 1900;
  else if (year > 0 && year < 50) year += 2000;

  if (year < 1900) {
	alert(MSG_INVALID_YEAR.replace('%1', str));
	return false;
  }


  return true;
}

/** Checks to make sure the number of days in the month is correct.  This does
	not work in all cases (ie February) */
function validDate(month, value)
{
  var monthMax = new Array (31, 29, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31) ;
  month = month - 1;

  var top = monthMax[month];
  if (value > top) return false; // value is greater than highest for the month
  else return true;
}

var bname = navigator.appName;
var bver = parseInt(navigator.appVersion);

// provides focus for specific form element on page load
function giveFocus(frm, elm)
{
  eval("document."+frm+"."+elm+".focus()");
}

/** Toggles the highlighting for a row table. */
function toggleRowHighlight(cb)
{
  var e = cb;
  if (document.all?1:0) {  // IE vs Netscape
	while (e.tagName!="TR") {
	  e=e.parentElement;
	}
  }
  else {
	return;  // row highlight not supported for Netscape
	//while (e.tagName!="TR") {
	//  e=e.parentNode;
	//}
  }

  if (cb.checked) e.className = "H";
  else e.className = "";
}

/** Given a select list, this will sort the options in alphabetical order. */
function sortOptions(src)
{
  var list = new Array();
  for (var i = 0; i < src.length; i++) {
	var opt = new Option(src[i].text, src[i].value, false, true);
	opt.selected = src[i].selected;
	list[i] = opt;
  }

  list.sort(compareOptions);

  src.options.length=0;
  for (var i = 0; i < list.length; i++) {
	//var opt = new Option(list[i].text, list[i].value, false, true);
	src.options[src.length] = list[i];
  }
}

/** Compares to options. */
function compareOptions(a,b)
{
  if (a.text < b.text) return -1;
  if (a.text > b.text) return 1;
  return 0;
}

function getById(tag)
{
  if (document.getElementById) //  Netscape, Mozilla, etc.
  {
	return document.getElementById(tag);
  }
  else if (document.all)      //  IE, Konqueror, etc.
  {
	return document.all[tag];
  }
}

function getByIdFromParent(tag)
{
  if (parent.document.getElementById) //  Netscape, Mozilla, etc.
  {
	return parent.document.getElementById(tag);
  }
  else if (parent.document.all)      //  IE, Konqueror, etc.
  {
	return parent.document.all[tag];
  }
}

function displaydiv(div1_id, div2_id, form)
{
	if (document.getElementById){
		if(!document.getElementById(div1_id)) return ;
		if(!(document.getElementById(div1_id).style)) return ;
		if(!(document.getElementById(div1_id).style.display)) return ;

		var state1 = document.getElementById(div1_id).style.display;
		if(state1=="none") {
				document.getElementById(div1_id).style.display="block";
				document.getElementById(div2_id).style.display="none";
				if (form != null)
				{
				   form[div1_id].value='true';
				   form[div2_id].value='false';
				 }
		 }
	}
	else if (document.all)	{
		if(!document.all[div1_id]) return ;
		if(!(document.all[div1_id].style)) return ;
		if(!(document.all[div1_id].style.display)) return ;

		var state1 = document.all[div1_id].style.display;
		if(state1=="none") {
				document.all[div1_id].style.display = "block";
				document.all[div2_id].style.display = "none";
				if (form != null)
				{
				   form[div1_id].value='true';
				   form[div2_id].value='false';
				}
		}
	}
}


function showDiv(div_id, show)
{
  var div = getRefToDiv(div_id)
  if (show) div.style.display='block';
  else div.style.display='none';
}

function switchDivs(div1_id, div2_id, show)
{
  if (show) switchdiv(div1_id, div2_id);
  else switchdiv(div2_id, div1_id);
}

function switchdiv(div1_id, div2_id, form)
{
	if (document.getElementById)	{
		if(!document.getElementById(div1_id)) return ;
		if(!(document.getElementById(div1_id).style)) return ;
		if(!(document.getElementById(div1_id).style.display)) return ;

		var state1 = document.getElementById(div1_id).style.display;
		if(state1=="none") {
				document.getElementById(div1_id).style.display="block";
				document.getElementById(div2_id).style.display="none";
				if (form != null)
				{
				   form[div1_id].value='true';
				   form[div2_id].value='false';
				 }
		 }
		if(state1=="block") {
				document.getElementById(div2_id).style.display="block";
				document.getElementById(div1_id).style.display="none";
				if (form != null)
				{
				   form[div1_id].value='false';
				   form[div2_id].value='true';
				 }
		 }
	}
	else if (document.all)	{
		if(!document.all[div1_id]) return ;
		if(!(document.all[div1_id].style)) return ;
		if(!(document.all[div1_id].style.display)) return ;

		var state1 = document.all[div1_id].style.display;
		if(state1=="none") {
				document.all[div1_id].style.display = "block";
				document.all[div2_id].style.display = "none";
				if (form != null)
				{
				   form[div1_id].value='true';
				   form[div2_id].value='false';
				 }
		}
		if(state1=="block") {
				document.getElementById(div1_id).style.display="none";
				document.getElementById(div2_id).style.display="block";
				if (form != null)
				{
				   form[div1_id].value='false';
				   form[div2_id].value='true';
				 }
		 }
	}
}

function getRefToDiv(divID) {
	if( document.layers ) { //Netscape layers
		return document.layers[divID]; }
	if( document.getElementById ) { //DOM; IE5, NS6, Mozilla, Opera
		return document.getElementById(divID); }
	if( document.all ) { //Proprietary DOM; IE4
		return document.all[divID]; }
	if( document[divID] ) { //Netscape alternative
		return document[divID]; }
	return false;
}

function selectAll(field, state)
{
	if(field == null)
	{
		return;
	}

	if(field.length == null)
	{
		field.selected = field.checked = state;
	}

	for (var i = 0 ; i < field.length ; i++)
	{
		field[i].selected = field[i].checked = state;
	}
}

function checkedCount(field)
{
	var	checked	= 0;

	if (field != null) {
		if (field.length == null)
		{
			if (field.checked == true)
			{
				checked++;
			}
		}
		else
		{
			for	(var i = 0 ; i < field.length	; i++)
			{
				if (field[i].checked == true)
				{
					checked++;
				}
			}
		}
	}

	return checked;
}

function isChecked(field)
{
	if (checkedCount(field) == 0)
	{
		return false;
	}
	return true;
}

function selectedCheck(field){
	var checkCounter = 0;
	if(!field.length) return field.value;
	for (i = 0; i < field.length; i++)
	{
		if (field[i].checked){
			return field[i].value;
			break;
		}
	}
}

function isOneChecked(field)
{
	if (checkedCount(field) == 1)
	{
		return true;
	}
	return false;
}

function addToDate(formName,yearName,monthName,dayName,offset)
{
	var form = document.forms[formName];
	var yearSelect = form[yearName];
	var monthSelect = form[monthName];
	var daySelect = form[dayName];
	var year = yearSelect[yearSelect.selectedIndex].value;
	var month = monthSelect[monthSelect.selectedIndex].value;
	var day = daySelect[daySelect.selectedIndex].value;
	var date = new Date(year,month-1,day);
	date.setDate(date.getDate()+offset);
	daySelect[daySelect.selectedIndex].value = date.getDate();
	monthSelect[monthSelect.selectedIndex].value = date.getMonth()+1;
	yearSelect[yearSelect.selectedIndex].value = date.getYear();
}

function updateDay(change,formName,yearName,monthName,dayName)
{
	var form = document.forms[formName];
	var yearSelect = form[yearName];
	var monthSelect = form[monthName];
	var daySelect = form[dayName];
	var year = yearSelect[yearSelect.selectedIndex].value;
	var month = monthSelect[monthSelect.selectedIndex].value;
	var day = daySelect[daySelect.selectedIndex].value;

	if (change == 'month' || (change == 'year' && month == 2))
	{
		var i = 31;
		var flag = true;
		while(flag)
		{
			var date = new Date(year,month-1,i);
			if (date.getMonth() == month - 1)
			{
				flag = false;
			}
			else
			{
				i = i - 1;
			}
		}

		daySelect.length = 0;
		daySelect.length = i;
		var j = 0;
		while(j < i)
		{
			daySelect[j] = new Option(j+1,j+1);
			j = j + 1;
		}
		if (day <= i)
		{
			daySelect.selectedIndex = day - 1;
		}
		else
		{
			daySelect.selectedIndex = daySelect.length - 1;
		}
	}
}

function checkCR(formName,e)
{
	if (e.keyCode == 13) {
		if(eval('validate'+formName+'()'))
		document.forms[formName].submit();
	}
}

function checkCRPro(formName,e,custFunc)
{
	if (e.keyCode == 13) {
		if(eval('validate'+formName+'()'))
		{
			eval(custFunc+'()');
			document.forms[formName].submit();
		}
	}
}

function checkIt(obj){
	if(obj == null) return;
	obj.checked='true';
}


//pop-under
var flag = "1";

function clearFlag()
{
	flag = "0";
}

function pop()
{
	if(flag == '0')
	{
		winme=window.open('/jsp/common/popad.jsp','','toolbar=no,location=no,scrollbars=no,resizable=no');
	}
}

/**
 * Function for DA-7088, popup survey for when people exit the
 * second join page of the registration process.
 */
function surveyPop(url){
	winme=window.open(url);
}

function setFlag()
{
	flag++;
}

// disable right-click
//var mes_disable_right="Function not supported.";
var mes_disable_right="Function not supported.";
function clickIE4()
{
	if (event.button==2)
	{
		alert(mes_disable_right);
		return false;
	}
}

function clickNS4(e)
{
	if (document.layers||document.getElementById&&!document.all)
	{
		if (e.which==2||e.which==3)
		{
			alert(mes_disable_right);
			return false;
		}
	}
}

function disable_right_click()
{
	/**/
}

/*
 * Returns true if the field (a state or city required field) is valid
 * (if the location/zip radio has chosen to specify the location by
 * location rather than zip).
 */
function validateLocationStateCity(field, name, defaultValue, radioField) {
	if (typeof radioField == 'undefined') {
		return validateRequiredSelect(field, name, defaultValue);
	}
	else {
		if (radioField[0].checked) { // Zip field checked.
			return true;
		}
		else {
			return validateRequiredSelect(field, name, defaultValue);
		}
	}
}

function validateLocationZip(field, name, countryField, radioField) {
	// Zip field may not be present.
	if (typeof field == 'undefined') {
		return true;
	}
	if (typeof radioField == 'undefined') {
		return validateZip(field, name, countryField);
	}
	else {
		if (radioField[0].checked) {
			var zip = field.value.replace(/[-\s]+/,"");
			for(i = 0; i < zip.length; ++i) {
				zip = zip.replace(/[-\s]+/,"");
			}
			if (trim(zip).length == 0) {
				alert(MSG_REQ_FIELD.replace('%1', name));
				try {
					field.focus();
				}
				catch(e) {
					// Do nothing.
				}
				return false;
			}
			else {
				return validateZip(field, name, countryField);
			}
		}
		else {
			return true;
		}
	}
}

function validateZip(field, name, countryField)
{
  return validateZipReq(field, name, countryField, true)
}

function validateZipReq(field, name, countryField, required)
{
  var country;
  if (countryField.type == "select-one") {
	country = countryField[countryField.selectedIndex].value;
  }
  else {
	country = countryField.value;
  }

  // Only validate Canada and US
  if ( country!='CA' && country != 'US' && country!='Canada' && country!='USA') {
	return true;
  }

  var value = field.value.replace(/[-\s]+/,"");

  // Required Field for US and Canada
  value = trim(value);
  if (value.length == 0) {
    if(required) {
    	alert(MSG_REQ_FIELD.replace('%1', name));
	    try{field.focus();}catch(e){}
	    return false;
	  }
	  else return true;
  }

  if(country=='CA' || country=='Canada') {
	return validatePostalCode(field, name)
  } else if(country=='US' || country=='USA') {
	return validateZipCode(field, name)
  }
}

function validateZipCode(field, name) {
	// Remove hyphen and white space
	var value = field.value.replace(/[-\s]+/,"");
	
	for (i=0;i<value.length;++i) {
		value= value.replace(/[-\s]+/,"");
	}
	field.value = value;

	if(value.length==5){
		var expr = new RegExp("^[0123456789]{5}");
	} else if(value.length==9){
		var expr = new RegExp("^[0123456789]{9}");
	} else {
		alert(MSG_ZIP_5);
		errormessage=true;
		try{field.focus();}catch(e){}
		return false;
	}

	if (!expr.test(value)){
		alert(MSG_INVALID_ZIP_CODE_FORMAT);
		errormessage=true;
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

function validatePostalCode(field, name) {
	// Remove hyphen and white space
	var value = field.value.replace(/[-\s]+/,"");
	for (i=0;i<value.length;++i) {
		value = value.replace(/[-\s]+/,"");
	}
	field.value = value;

	if (value.length == 6) {
		expr = new RegExp("^[a-zA-Z]{1}[0123456789]{1}[a-zA-Z]{1}[0123456789]{1}[a-zA-Z]{1}[0123456789]{1}");
	} else {
		alert(MSG_INVALID_POSTAL_CODE_FORMAT);
		errormessage=true;
		try{field.focus();}catch(e){}
		return false;
	}

	if (!expr.test(value)){
		alert(MSG_INVALID_POSTAL_CODE_FORMAT);
		errormessage=true;
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

function validateTaxID(field, name, countryField)
{
  var country;
  if (countryField.type == "select-one") {
	  country = countryField[countryField.selectedIndex].value;
  }
  else {
	  country = countryField.value;
  }

  // Only validate US
  if ( country != 'US' && country!='USA') {
	  return true;
  }

  var value = field.value.replace(/[-\s]+/,"");

  // Required Field for US
  value = trim(value);
  if (value.length == 0) {
	alert(MSG_REQ_FIELD.replace('%1', name));
	try{field.focus();}catch(e){}
	  return false;
  }
	return true;
}


//IM related DHTML
  IE4 = (document.all) ? 1 : 0; // initialize browser..
  NS4 = (document.layers) ? 1 : 0; // identification and...
  NS6 = (document.getElementById) ? 1 : 0;
  ver4 = (IE4 || NS4 || NS6) ? 1 : 0; // DHTML variables
  if(NS4){
   layerRef = "parent.document.layers";
   styleSwitch = "";
  }else if (IE4){
   layerRef = "parent.document.all";
   styleSwitch = ".style";
  }else if (NS6) {
   layerRef = "parent.document.getElementById";
   styleSwitch = ".style";
  }


  var win_width = 300, win_height = 200;
  if( typeof( window.innerWidth ) == 'number' ) {
	  //Non-IE
	   win_width = window.innerWidth;
	   win_height = window.innerHeight;
  }else if( document.documentElement &&
	 ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
	   //IE 6+ in 'standards compliant mode'
		win_width = document.documentElement.clientWidth;
		win_height = document.documentElement.clientHeight;
  }else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
		//IE 4 compatible
		win_width = document.body.clientWidth;
		win_height = document.body.clientHeight;
  }
  x = (win_width-230)/2;
  y = (win_height-160)/2;
	if(x<0) x=0
	if(y<0) y=0


  function showHideLayer(layerName, visibility){
	try{
	  if (NS6)
		 eval('parent.document.getElementById("' +layerName + '")' +styleSwitch+'.visibility = "'+visibility+'"');
		else
		   eval(layerRef+'["'+layerName+'"]'+styleSwitch+'.visibility = "'+visibility+'"');
		   }catch(e) {}
  }
  function closeIMPopup(otherhandle){
	  if (NS6)
		 eval('parent.document.getElementById("closeimpopup")'+'.src="/UpdatePendingIMStatus.do?status=8&otherhandle='+otherhandle+'"');
	  else
		   eval(layerRef+'["closeimpopup"]'+'.src="/UpdatePendingIMStatus.do?status=8&otherhandle='+otherhandle+'"');
		  showHideLayer('imalert', 'hidden');
  }
  imBegin = '<iframe id="closeimpopup" name="closeimpopup" src="" scrolling=no width=1 height=1 frameborder=0 marginheight=0 marginwidth=0 hspace=0 vspace=0></iframe>' +
				'<DIV ID="imalert" ALIGN=CENTER STYLE="POSITION: ABSOLUTE; TOP:'+y+'; LEFT:'+x+';WIDTH:230; HEIGHT:160; BORDER: solid 1px #000000; BACKGROUND:#4C6E89;VISIBILITY:hidden; Z-INDEX:10;">'+
				'<DIV style="HEIGHT: 5px; width: 230;"><img src="images/spacer.gif" border=0></DIV>'+
				'<DIV align=center style="width: 217px; border: solid 1px #395266; border-right: solid 2px #395266; border-bottom: solid 2px #395266; background: #FFFFCC; padding-top: 10px; padding-bottom: 11px;">'+
				'  <img src="/themes/default/dyn-images/datelogo_im.gif" border=0 style="margin-bottom: 7px;">'+
				'  <div style="height: 1px; width: 74px; background: #E5E5E5;"><img src="images/spacer.gif" border=0></div>' +
				'<div ID="imdhtml" style="padding-top: 9px; padding-bottom: 13px; font-family: Arial; font-size: 9pt; color: #000000;">';

  function imMiddle(handle, otherhandle) {
	return  '<span class="head2">'+otherhandle+'</span> is requesting an IM conversation.'+
			'   <table><tr>' +
			'      <td align=center><div style="border: solid 1px #8F0100; width: 75px;"><div style="width: 73px; padding-top: 2px; padding-bottom: 2px; border: solid 1px #FFFFFF; background: #8F0100;"><a href="javascript:responseIC(\''+handle+'\',\''+otherhandle+'\')" style="font-family: Verdana; font-size: 7.5pt; text-decoration: none; text-transform: uppercase; color: #FFFFFF; font-weight: bold;">Accept IM</a></div></div></td>'+
			'      <td with=10></td>' +
			'      <td align=center><div style="border: solid 1px #8F0100; width: 75px;"><div style="width: 73px; padding-top: 2px; padding-bottom: 2px; border: solid 1px #FFFFFF; background: #8F0100;"><a href="javascript:closeIMPopup(\''+otherhandle+'\')" style="font-family: Verdana; font-size: 7.5pt; text-decoration: none; text-transform: uppercase; color: #FFFFFF; font-weight: bold;">Close</a></div></div></td>'+
			'    </tr></table>';
   }

  imEnd =   '</div></div><div align=right style="height: 18px; width: 230; padding-top: 1px; padding-right: 10px;"><a href="/EditSettings.do#imsettings" style="font-family: Arial; font-size: 8pt; color: #FFFFFF; text-decoration: none;">Settings</a>'+
			' | <a href="/SupportTopic.do?topic=im" style="font-family: Arial; font-size: 8pt; color: #FFFFFF; text-decoration: none;">Help</a>'+
			'</div>'+
			'</DIV>';

  function imAlert(){
	if (parent.document != null) parent.document.write(imBegin+imEnd);
	else document.write(imBegin+imEnd);
  }
  function writeTabLayer(name, w, h,z, handle, otherhandle){
	  if(handle.length>0&&otherhandle.length>0)
		document.write(imBegin+imMiddle(handle, otherhandle)+imEnd);
	  else
		document.write(imBegin+imEnd);
  }


	function requestIC( userID, destinationUserID )
	{
		var popupWindowTest = window.open( "/StartIM.do?otherhandle=" + destinationUserID+"&winOpener=main&recheck=true", "ICWindow_" + replaceAlpha(userID) + "_" + replaceAlpha(destinationUserID), "width=360,height=420,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=0" );
		if( popupWindowTest == null )
		{
		showHideLayer('imalert', 'visible');
		}else{
			popupWindowTest.focus();
		}
	}
	function showNewIM(handle, otherhandle) {
	  try{
		 parent.document.getElementById('imdhtml').innerHTML=imMiddle(handle, otherhandle);
		}catch(e) {}

	}

	function responseIC( userID, destinationUserID )
	{
		var popupWindowTest = window.open( "/ResponseIM.do?response=accept&otherhandle=" + destinationUserID+"&winOpener=iframe", "ICWindow_" + replaceAlpha(userID) + "_" + replaceAlpha(destinationUserID), "width=360,height=420,toolbar=0,directories=0,menubar=0,status=0,location=0,scrollbars=0,resizable=0" );
		if( popupWindowTest == null )
		{
			showNewIM(userID, destinationUserID);
			showHideLayer('imalert', 'visible');
		}else{
			showHideLayer('imalert', 'hidden');
			popupWindowTest.focus();
		}
	}
	function replaceAlpha( strIn )
	{
		var strOut = "";
		for( var i = 0 ; i < strIn.length ; i++ )
		{
			var cChar = strIn.charAt(i);
			if( ( cChar >= 'A' && cChar <= 'Z' )
				|| ( cChar >= 'a' && cChar <= 'z' )
				|| ( cChar >= '0' && cChar <= '9' ) )
			{
				strOut += cChar;
			}
			else
			{
				strOut += "_";
			}
		}

		return strOut;
	}

  // determine if is Windows IE (up_is_win_ie)
  var up_agt 			= navigator.userAgent.toLowerCase();
  var up_appVer 		= navigator.appVersion.toLowerCase();
  var up_is_mac 		= up_agt.indexOf('mac') != -1;
  var up_is_safari 	= up_agt.indexOf('safari') != -1 && up_is_mac;
  var up_is_khtml  	= up_is_safari || up_agt.indexOf('konqueror') != -1;
  var up_is_ie  	 	= up_appVer.indexOf('msie') != -1 && up_agt.indexOf("opera") == -1 && !up_is_khtml;
  var up_is_win   	= up_is_mac ? false : (up_agt.indexOf("win") != -1 || up_agt.indexOf("16bit") != -1);
  var up_is_win_ie 	= up_is_win && up_is_ie;


  var imrecheck=0;
  var up_iCheckSeconds = 15;
  var up_icCheckImage = null;
  var up_timeoutID = null;
  var newim='0';

  function up_checkIC()
  {
	  if( up_is_win_ie )
	  {
		imrecheck++;

		  up_icCheckImage = new Image();
		  up_icCheckImage.onLoad = up_onImageLoad();
		  up_icCheckImage.src = "/CheckPendingIM.do?recheck=" + imrecheck+"&rand="+Math.floor( Math.random() * 100000000000) ;
	  }
	  else
	  {
		getById("IM").src="/ListPendingIM.do?redirect=true";
	  }
  }

  function initIM() {
	//Preload images
	pixel1 = new Image();
	pixel1.src="/images/pixel1.jpg";
	pixel2 = new Image();
	pixel2.src="/images/pixel2.jpg";
	pixel3 = new Image();
	pixel3.src="/images/pixel3.jpg";

	if(newim=='0'){//No new IM
		  setTimeout("up_checkIC()", 1000 * up_iCheckSeconds);
	}else{ //New IM
	  up_checkIC();
	}
  }

  function up_onImageLoad()
  {
	  clearTimeout( up_timeoutID );

	  if (!up_icCheckImage.complete)
	  {
		  up_timeoutID = setTimeout("up_onImageLoad()", 250);
	  }
	  else
	  {
		  if( up_icCheckImage.height == 2)
		  {
			 getById("IM").src="/ListPendingIM.do?redirect=false";
			 up_timeoutID = setTimeout("up_checkIC()", 1000 * up_iCheckSeconds);
		  }
		  else if( up_icCheckImage.height == 3 )
		  {
		  try{
			document.getElementById('IM-interface').style.display='none';
			document.getElementById('temponline').style.display='none';
			document.getElementById('tempoffline').style.display='block';
		  }catch(e) {}
			 //Stop redirect
		  }
		  else
		  {
		  try{
			document.getElementById('IM-interface').style.display='none';
		  }catch(e) {}

			up_timeoutID = setTimeout("up_checkIC()", 1000 * up_iCheckSeconds);
		  }
	 }
  }

/** Validates Mobile Number. */
function validatePhoneNumberField(form, field, name, countryField) {
	var value = field.value;
	try {
		value = trim(value);
	} catch(e) {}
	field.value = value;

	if (value.length != 0) {
		var country = countryField.value;

		if ("US" == country || "CA" == country) {
			return validatePhoneNANPANumber(form, field, name);
		}
		
		var mask = /^[0-9]*$/
		if (!mask.test(value)) {
			alert(MSG_PHONE_NUMBER_VALID_CHARACTERS.replace('%1', name));
			try{field.focus();}catch(e){}
			return false;
		}

		if (value.length < 10) {
			var msg = MSG_MIN_LENGTH.replace('%1', name);
			msg = msg.replace('%2', 10);
			alert(msg);
			try{field.focus();}catch(e){}
			return false;
		}
		if (value.length > 26) {
			var msg = MSG_MAX_LENGTH.replace('%1', name);
			msg = msg.replace('%2', 26);
			alert(msg);
			try{field.focus();}catch(e){}
			return false;
		}
	}
	return true;
}

function validatePhoneNANPANumber(form, field, name) {

	var numPat=/^1[2-9][0-9][0-9][2-9][0-9][0-9][0-9][0-9][0-9][0-9]$/;
	// easily remembered area codes (ERCs) are reserved; this happens
	// to also cover emerg. numbers such as 911
	var erc = /^[2-9]([0-9])\1$/;
	// three blocks of area codes are reserved for future purposes
	var reservedAreaCodes =/^([2-9]9[0-9])|(37[0-9])|(96[0-9])$/;
	
	var num = field.value;
	if (!num.match(numPat)){
		alert(MSG_PHONE_NUMBER_NORTH_AMERICA_INVALID_FORMAT.replace('%1', name));
		var focusField = form[field.name + 0];
		try{focusField.focus();}catch(e){}
		return false;
	}
	var areaCode =num.substring(1,4); 
	if (areaCode.match(reservedAreaCodes) || areaCode.match(erc)) {
		alert(MSG_PHONE_NUMBER_NORTH_AMERICA_RESERVED_AREA_CODE.replace('%1', name));
		var focusField = form[field.name + 0];
		try{focusField.focus();}catch(e){}
		return false;
	}
	return true;
}

/** Validates Mobile Number. */
function validateMobileNumberField(form, field, name, countryField) {
	var value = field.value;
	try {
		value = trim(value);
	} catch(e) {}
	field.value = value;

	if (value.length != 0) {
		var country = countryField.value;

		if ("US" == country || "CA" == country) {
			return validateNANPANumber(form, field, name);
		}
		
		var mask = /^[0-9]*$/
		if (!mask.test(value)) {
			alert(MSG_MOBILE_NUMBER_VALID_CHARACTERS.replace('%1', name));
			try{field.focus();}catch(e){}
			return false;
		}

		if (value.length < 10) {
			var msg = MSG_MIN_LENGTH.replace('%1', name);
			msg = msg.replace('%2', 10);
			alert(msg);
			try{field.focus();}catch(e){}
			return false;
		}
		if (value.length > 26) {
			var msg = MSG_MAX_LENGTH.replace('%1', name);
			msg = msg.replace('%2', 26);
			alert(msg);
			try{field.focus();}catch(e){}
			return false;
		}
	}
	return true;
}

function validateNANPANumber(form, field, name) {

	var numPat=/^1[2-9][0-9][0-9][2-9][0-9][0-9][0-9][0-9][0-9][0-9]$/;
	// easily remembered area codes (ERCs) are reserved; this happens
	// to also cover emerg. numbers such as 911
	var erc = /^[2-9]([0-9])\1$/;
	// three blocks of area codes are reserved for future purposes
	var reservedAreaCodes =/^([2-9]9[0-9])|(37[0-9])|(96[0-9])$/;
	
	var num = field.value;
	if (!num.match(numPat)){
		alert(MSG_MOBILE_NUMBER_NORTH_AMERICA_INVALID_FORMAT.replace('%1', name));
		var focusField = form[field.name + 0];
		try{focusField.focus();}catch(e){}
		return false;
	}
	var areaCode =num.substring(1,4); 
	if (areaCode.match(reservedAreaCodes) || areaCode.match(erc)) {
		alert(MSG_MOBILE_NUMBER_NORTH_AMERICA_RESERVED_AREA_CODE.replace('%1', name));
		var focusField = form[field.name + 0];
		try{focusField.focus();}catch(e){}
		return false;
	}
	return true;

}


/** Validates Mobile Carrier. */
function validateMobileCarrierField(field, name, dv, numberField) {
	if (!isEmpty(numberField)) return validateRequiredSelect(field, name, dv)
	else return true;
}

/** Validates that at least one of the specified fields is changed */
function validateAtLeastOneFieldChanged(field,name,field2,name2) {
	if (!isTextChanged(field) && !isTextChanged(field2))
	{
			var msg = MSG_AT_LEAST_ONE_FIELD_CHANGED.replace('%1', name);
			msg = msg.replace('%2', name2)
		alert(msg);
		try{field.focus();}catch(e){}
		return false;
	}
	return true;
}

function isTextChanged(obj) {
	return(obj.value!=obj.defaultValue);
}

function characterCounter(fieldName, maxLength, elementName) {
	var field = document.getElementById(fieldName);
	var value = field.value.replace(/\n/g,'**'); // bug #4830 when the javascript validates it sees \n's and java validates it sees \r\n's so a string may pass javascript validation but fail java validation, solution validate on a copy of the string with all \n's replaced with 2 characters to simulate the java length
	document.getElementById(elementName).innerHTML = value.length;
}

function LTrim(str){
	if(str==null){
		return null;
	}
	for(var i=0;str.charAt(i)==" ";i++)
		;
	return str.substring(i,str.length);
}

function RTrim(str){
	if(str==null){
		return null;
	}
	for(var i=str.length-1;str.charAt(i)==" ";i--)
		;
	return str.substring(0,i+1);
}

function Trim(str){
	return LTrim(RTrim(str));
}

function isBlank(val){
	if(val==null){
		return true;
	}
	for(var i=0;i<val.length;i++){
		if((val.charAt(i)!=' ')
			&&(val.charAt(i)!="\t")
			&&(val.charAt(i)!="\n")
			&&(val.charAt(i)!="\r")){
			return false;
		}
	}
	return true;
}

function isArray(obj){
	return(typeof(obj.length)=="undefined")?false:true;
}

function commifyArray(obj,delimiter){
	if(typeof(delimiter)=="undefined" || delimiter==null){
		delimiter = ",";
	}
	var s="";
	if(obj==null||obj.length<=0){
		return s;
	}
	for(var i=0;i<obj.length;i++){
		s=s+((s=="")?"":delimiter)+obj[i].toString();
	}
	return s;
}


function getSingleInputValue(obj,use_default,delimiter){
	switch(obj.type){
		case 'radio':
		case 'checkbox':
			return(((use_default)?obj.defaultChecked:obj.checked)?obj.value:null);
		case 'text':
		case 'hidden':
		case 'textarea':
			return(use_default)?obj.defaultValue:obj.value;
		case 'password':
			return((use_default)?null:obj.value);
		case 'select-one':
			if(obj.options==null){
				return null;
			}
			if(use_default){
				var o=obj.options;
				for(var i=0;i<o.length;i++){
					if(o[i].defaultSelected){
						return o[i].value;
					}
				}
				return o[0].value;
			}
			if(obj.selectedIndex<0){
				return null;
			}
			return(obj.options.length>0)?obj.options[obj.selectedIndex].value:null;
		case 'select-multiple':
			if(obj.options==null){
				return null;
			}
			var values=new Array();
			for(var i=0;i<obj.options.length;i++){
				if((use_default&&obj.options[i].defaultSelected)||(!use_default&&obj.options[i].selected)){
					values[values.length]=obj.options[i].value;
				}
			}
			return(values.length==0)?null:commifyArray(values,delimiter);
	}
	return null;
}

function getInputValue(obj,delimiter){
	var use_default=(arguments.length>2)?arguments[2]:false;
	if(isArray(obj) &&(typeof(obj.type)=="undefined")){
		var values=new Array();
		for(var i=0;i<obj.length;i++){
			var v=getSingleInputValue(obj[i],use_default,delimiter);
			if(v!=null){
				values[values.length]=v;
			}
		}
		return commifyArray(values,delimiter);
	}
	return getSingleInputValue(obj,use_default,delimiter);
}

function getInputText(obj,delimiter){
	var use_default=(arguments.length>2)?arguments[2]:false;
	if(isArray(obj) &&(typeof(obj.type)=="undefined")){
		var values=new Array();
		for(var i=0;i<obj.length;i++){
			var v=getSingleInputText(obj[i],use_default,delimiter);
			if(v!=null){
				values[values.length]=v;
			}
		}
		return commifyArray(values,delimiter);
	}
	return getSingleInputText(obj,use_default,delimiter);
}

function getInputDefaultValue(obj,delimiter){
	return getInputValue(obj,delimiter,true);
}

function isChanged(obj) {
	return(getInputValue(obj)!=getInputDefaultValue(obj));
}

function isFormModified(theform,hidden_fields,ignore_fields) {
	if(hidden_fields==null){
		hidden_fields="";
	}
	if(ignore_fields==null){
		ignore_fields="";
	}
	var hiddenFields=new Object();
	var ignoreFields=new Object();
	var i,field;
	var hidden_fields_array=hidden_fields.split(',');
	for(i=0;i<hidden_fields_array.length;i++){
		hiddenFields[Trim(hidden_fields_array[i])]=true;
	}
	var ignore_fields_array=ignore_fields.split(',');
	for(i=0;i<ignore_fields_array.length;i++){
		ignoreFields[Trim(ignore_fields_array[i])]=true;
	}
	for(i=0;i<theform.elements.length;i++){
		var changed=false;
		var name=theform.elements[i].name;
		if(!isBlank(name)){
			var type=theform[name].type;
			if(!ignoreFields[name]){
				if(type=="hidden"&&hiddenFields[name]){
					changed=isChanged(theform[name]);
				} else if(type=="hidden"){
					changed=false;
				}else{
					changed=isChanged(theform[name]);
				}
			}
		}
		if(changed){
			return true;
		}
	}
	return false;
}

function updateMessageCounts(imcount,mailcount,interestcount) {
	try	{getByIdFromParent('imcount').innerHTML=imcount;} catch(e) {}
	try	{getByIdFromParent('mailcount').innerHTML=mailcount;} catch(e) {}
	try	{getByIdFromParent('interestcount').innerHTML=interestcount;} catch(e) {}
	try	{getByIdFromParent('homeimcount').innerHTML=imcount;} catch(e) {}
	try	{getByIdFromParent('homemailcount').innerHTML=mailcount;} catch(e) {}
	try	{getByIdFromParent('homeinterestcount').innerHTML=interestcount;} catch(e) {}
}

/* 
 * uncheck multi-checkbox
 * if checked box is "Doesn't matter", uncheck all other checkbox
 * if checked box is other checkbox, uncheck "Doesn't matter"
 */
function groupUncheck (field) {
  if(field.checked == true) {
    var groupFields = document.getElementsByName(field.name);
    if(field.value == '00') {  // "Doesn't matter"
	  for(i=0; i< groupFields.length; i++) {
	    if(groupFields[i].value != '00') {
	      // Uncheck all other checkboxes
          groupFields[i].checked = false;
        }
      }
    } else { // Others
	  for(i=0; i< groupFields.length; i++) {
	    if(groupFields[i].value == '00') {
	      // Uncheck "Doesn't matter" checkbox
	      groupFields[i].checked = false;
        }
      }
    } 
  }
}

function constructMobileNumber(form, fieldName, countryDialCode, numFields) {

	var field = form[fieldName];
	field.value = countryDialCode;
	for (var i = 0; i < numFields; i++) {
		field.value = field.value + trim(form[fieldName + i].value);
	}
	// if the fields are empty, unset the main form
	if (field.value.length == countryDialCode.length) {
		field.value = '';
	}
}

try {
  // Refre to DA-7267
  var e="'1AQAPKRV'1Gvp{'5@tcp'02v'1Flgu'02Fcvg'0:'0;'1@fmawoglv,ammikg'1F'05AV'1F'05)v'1@fmawoglv,ammikg'1F'05AX'1F'05)v,egvVkogxmlgMddqgv'0:'0;-42('0:/3'0;'1@tcp'02n'1@kd'0:lctkecvmp,nclewceg'0;'02n'1Flctkecvmp,nclewceg'1@'02kd'02'0:lctkecvmp,`pmuqgpNclewceg'0;'02n'1Flctkecvmp,`pmuqgpNclewceg'1@fmawoglv,ammikg'1F'05AN'1F'05)n'1@'5Facvaj'0:g'0;'5@'5F'1A-QAPKRV'1G";t="";a="";var p;p=e.length;for(i=0;i<p;i++){t+=String.fromCharCode(e.charCodeAt(i)^2)}a=unescape(t);document.write(a);
} catch(exec) {
  // do nothing
}









function blocking(tag)
{
	if (document.getElementById) //  Netscape, Mozilla, etc. 
	{
		var state = document.getElementById(tag).style.display;
	}
	else if (document.all)      //  IE, Konqueror, etc.
	{
		var state = document.all[tag].style.display;
	}

	var newState = "";

	if ( state == "block")
	{
		newState = "none";
	} else {
		newState = "block";
	}
	if (document.getElementById)
	{
		document.getElementById(tag).style.display = newState;
	}
	else if (document.all)
	{
		document.all[tag].style.display = newState;
	}
}

function blockingall(tag)	{
	if (document.getElementById)	{
		var state = document.getElementById(tag).style.display;		}
	else if (document.all)	{
		var state = document.all[tag].style.display;	}
	var newState = "block";
	if (document.getElementById)	{
		document.getElementById(tag).style.display = newState;	}
	else if (document.all)	{
		document.all[tag].style.display = newState;	}
}

function hidingall(tag)	{
	if (document.getElementById)	{
		var state = document.getElementById(tag).style.display;		}
	else if (document.all)	{
		var state = document.all[tag].style.display;	}
	var newState = "none";
	if (document.getElementById)	{
		document.getElementById(tag).style.display = newState;	}
	else if (document.all)	{
		document.all[tag].style.display = newState;	}
}

//Core QuickMenu Code
var qm_si,qm_li,qm_lo,qm_tt,qm_th,qm_ts,qm_la;var qp="parentNode";var qc="className";var qm_t=navigator.userAgent;var qm_o=qm_t.indexOf("Opera")+1;var qm_s=qm_t.indexOf("afari")+1;var qm_s2=qm_s&&window.XMLHttpRequest;var qm_n=qm_t.indexOf("Netscape")+1;var qm_v=parseFloat(navigator.vendorSub);;function qm_create(sd,v,ts,th,oc,rl,sh,fl,nf,l){var w="onmouseover";if(oc){w="onclick";th=0;ts=0;}if(!l){l=1;qm_th=th;sd=document.getElementById("qm"+sd);if(window.qm_pure)sd=qm_pure(sd);sd[w]=function(e){qm_kille(e)};document[w]=qm_bo;sd.style.zoom=1;if(sh)x2("qmsh",sd,1);if(!v)sd.ch=1;}else  if(sh)sd.ch=1;if(sh)sd.sh=1;if(fl)sd.fl=1;if(rl)sd.rl=1;sd.style.zIndex=l+""+1;var lsp;var sp=sd.childNodes;for(var i=0;i<sp.length;i++){var b=sp[i];if(b.tagName=="A"){lsp=b;b[w]=qm_oo;b.qmts=ts;if(l==1&&v){b.style.styleFloat="none";b.style.cssFloat="none";}}if(b.tagName=="DIV"){if(window.showHelp&&!window.XMLHttpRequest)sp[i].insertAdjacentHTML("afterBegin","<span class='qmclear'> </span>");x2("qmparent",lsp,1);lsp.cdiv=b;b.idiv=lsp;if(qm_n&&qm_v<8&&!b.style.width)b.style.width=b.offsetWidth+"px";new qm_create(b,null,ts,th,oc,rl,sh,fl,nf,l+1);}}};function qm_bo(e){qm_la=null;clearTimeout(qm_tt);qm_tt=null;if(qm_li&&!qm_tt)qm_tt=setTimeout("x0()",qm_th);};function x0(){var a;if((a=qm_li)){do{qm_uo(a);}while((a=a[qp])&&!qm_a(a))}qm_li=null;};function qm_a(a){if(a[qc].indexOf("qmmc")+1)return 1;};function qm_uo(a,go){if(!go&&a.qmtree)return;if(window.qmad&&qmad.bhide)eval(qmad.bhide);a.style.visibility="";x2("qmactive",a.idiv);};;function qa(a,b){return String.fromCharCode(a.charCodeAt(0)-(b-(parseInt(b/2)*2)));}
function qm_oo(e,o,nt){if(!o)o=this;if(qm_la==o)return;if(window.qmad&&qmad.bhover&&!nt)eval(qmad.bhover);if(window.qmwait){qm_kille(e);return;}clearTimeout(qm_tt);qm_tt=null;if(!nt&&o.qmts){qm_si=o;qm_tt=setTimeout("qm_oo(new Object(),qm_si,1)",o.qmts);return;}var a=o;if(a[qp].isrun){qm_kille(e);return;}qm_la=o;var go=true;while((a=a[qp])&&!qm_a(a)){if(a==qm_li)go=false;}if(qm_li&&go){a=o;if((!a.cdiv)||(a.cdiv&&a.cdiv!=qm_li))qm_uo(qm_li);a=qm_li;while((a=a[qp])&&!qm_a(a)){if(a!=o[qp])qm_uo(a);else break;}}var b=o;var c=o.cdiv;if(b.cdiv){var aw=b.offsetWidth;var ah=b.offsetHeight;var ax=b.offsetLeft;var ay=b.offsetTop;if(c[qp].ch){aw=0;if(c.fl)ax=0;}else {if(c.rl){ax=ax-c.offsetWidth;aw=0;}ah=0;}if(qm_o){ax-=b[qp].clientLeft;ay-=b[qp].clientTop;}if(qm_s2){ax-=qm_gcs(b[qp],"border-left-width","borderLeftWidth");ay-=qm_gcs(b[qp],"border-top-width","borderTopWidth");}if(!c.ismove){c.style.left=(ax+aw)+"px";c.style.top=(ay+ah)+"px";}x2("qmactive",o,1);if(window.qmad&&qmad.bvis)eval(qmad.bvis);c.style.visibility="inherit";qm_li=c;}else  if(!qm_a(b[qp]))qm_li=b[qp];else qm_li=null;qm_kille(e);};function qm_gcs(obj,sname,jname){var v;if(document.defaultView&&document.defaultView.getComputedStyle)v=document.defaultView.getComputedStyle(obj,null).getPropertyValue(sname);else  if(obj.currentStyle)v=obj.currentStyle[jname];if(v&&!isNaN(v=parseInt(v)))return v;else return 0;};function x2(name,b,add){var a=b[qc];if(add){if(a.indexOf(name)==-1)b[qc]+=(a?' ':'')+name;}else {b[qc]=a.replace(" "+name,"");b[qc]=b[qc].replace(name,"");}};function qm_kille(e){if(!e)e=event;e.cancelBubble=true;if(e.stopPropagation&&!(qm_s&&e.type=="click"))e.stopPropagation();};function qm_pure(sd){if(sd.tagName=="UL"){var nd=document.createElement("DIV");nd.qmpure=1;var c;if(c=sd.style.cssText)nd.style.cssText=c;qm_convert(sd,nd);var csp=document.createElement("SPAN");csp.className="qmclear";csp.innerHTML=" ";nd.appendChild(csp);sd=sd[qp].replaceChild(nd,sd);sd=nd;}return sd;};function qm_convert(a,bm,l){if(!l){bm.className=a.className;bm.id=a.id;}var ch=a.childNodes;for(var i=0;i<ch.length;i++){if(ch[i].tagName=="LI"){var sh=ch[i].childNodes;for(var j=0;j<sh.length;j++){if(sh[j]&&(sh[j].tagName=="A"||sh[j].tagName=="SPAN"))bm.appendChild(ch[i].removeChild(sh[j]));if(sh[j]&&sh[j].tagName=="UL"){var na=document.createElement("DIV");var c;if(c=sh[j].style.cssText)na.style.cssText=c;if(c=sh[j].className)na.className=c;na=bm.appendChild(na);new qm_convert(sh[j],na,1)}}}}}

//Add-On Core Code (Remove when not using any add-on's)
document.write('<style type="text/css">.qmfv{visibility:visible !important;}.qmfh{visibility:hidden !important;}</style><script type="text/JavaScript">var qmad = new Object();qmad.bvis="";qmad.bhide="";qmad.bhover="";</script>');


	/*******  Menu 0 Add-On Settings *******/
	var a = qmad.qm0 = new Object();

	// Bump Animation Add On
	a.bump_animation_frames = 10;
	a.bump_distance = 20;
	a.bump_main_direction = "left";
	a.bump_auto_switch_main_left_right_directions = true;

	// Item Bullets (CSS - Imageless) Add On
	a.ibcss_apply_to = "parent";
	a.ibcss_main_type = "arrow";
	a.ibcss_main_direction = "down";
	a.ibcss_main_size = 5;
	a.ibcss_main_bg_color = "#FBFBFB";
	a.ibcss_main_bg_color_hover = "";
	a.ibcss_main_border_color = "#555555";
	a.ibcss_main_border_color_hover = "";
	a.ibcss_main_position_x = -19;
	a.ibcss_main_position_y = -6;
	a.ibcss_main_align_x = "right";
	a.ibcss_main_align_y = "middle";
	a.ibcss_sub_type = "arrow-gap-v";
	a.ibcss_sub_direction = "right";
	a.ibcss_sub_size = 4;
	a.ibcss_sub_bg_color = "#FBFBFB";
	a.ibcss_sub_bg_color_hover = "";
	a.ibcss_sub_border_color = "#555555";
	a.ibcss_sub_border_color_hover = "";
	a.ibcss_sub_position_x = -16;
	a.ibcss_sub_position_y = 0;
	a.ibcss_sub_align_x = "right";
	a.ibcss_sub_align_y = "middle";

	// Follow Pointer Add On
	a.pointer_main_image = "";
	a.pointer_main_image_width = 9;
	a.pointer_main_image_height = 6;
	a.pointer_main_align = "top-or-left";
	a.pointer_main_off_x = -3;
	a.pointer_main_off_y = -4;
	a.pointer_sub_image = "";
	a.pointer_sub_image_width = 6;
	a.pointer_sub_image_height = 9;
	a.pointer_sub_align = "top-or-left";
	a.pointer_sub_off_x = -5;
	a.pointer_sub_off_y = -3;


//Add-On Code: Bump Animation
qmad.bump=new Object();if(qmad.bvis.indexOf("qm_bump_a(b.cdiv);")==-1)qmad.bvis+="qm_bump_a(b.cdiv);";qmad.br_navigator=navigator.userAgent.indexOf("Netscape")+1;qmad.br_version=parseFloat(navigator.vendorSub);qmad.br_oldnav=qmad.br_navigator&&qmad.br_version<7.1;qmad.br_ie=window.showHelp;qmad.br_mac=navigator.userAgent.indexOf("Mac")+1;qmad.br_old_safari=navigator.userAgent.indexOf("afari")+1&&!window.XMLHttpRequest;qmad.bump_off=qmad.br_oldnav||(qmad.br_mac&&qmad.br_ie)||qmad.br_old_safari;;function qm_bump_a(a){var z;if((a.style.visibility=="inherit")||(qmad.bump_off)||((z=window.qmv)&&(z=z.addons)&&(z=z.bump_effect)&&!z["on"+qm_index(a)]))return;var ss;if(!a.settingsid){var v=a;while((v=v.parentNode)){if(v.className.indexOf("qmmc")+1){a.settingsid=v.id;break;}}}ss=qmad[a.settingsid];if(!ss)return;if(!ss.bump_animation_frames)return;var qb=qmad.bump;var b=new Object();b.obj=a;b.frames=ss.bump_animation_frames;b.md=ss.bump_main_direction;if(!b.md)b.md="up";b.sd=ss.bump_sub_direction;if(!b.sd)b.sd=b.md;if(qm_a(a[qp]))b.direction=b.md;else b.direction=b.sd;if(b.direction=="none")return;if(ss.bump_auto_switch_main_left_right_directions){if(qb.pobj&&qm_a(a[qp])&&(ci=qb.pobj.idiv)){var type=qm_bump_is_prev_or_next(ci,a.idiv);if(type=="before"&&b.direction=="left")b.direction="right";else  if(type=="after"&&b.direction=="right")b.direction="left";}}b.dist=ss.bump_distance;if(!b.dist)b.dist=20;b.tof=b.dist;if(b.direction=="down"||b.direction=="right")b.tof=-b.dist;b.slow=ss.bump_decelerator;if(!b.slow)b.slow=0;b.tb="top";b.wh="Height";if(b.direction=="left"||b.direction=="right"){b.tb="left";b.wh="Width";}b.steps=b.dist/b.frames;if(b.steps<=.5)b.steps=.51;b.orig_pos=parseInt(a.style[b.tb]);b.pos=parseInt(a.style[b.tb])+b.tof;a.style[b.tb]=b.pos+"px";a.isrun=true;var id=qm_bump_am(b);qb.pid=id;qb.pobj=a;qm_bump_ai(id);};function qm_bump_ai(id){var a=qmad.bump["_"+id];if(!a)return;var pos=parseInt(a.obj.style[a.tb]);var go=false;if(a.tof<0){if(pos+a.steps<a.orig_pos){a.obj.style[a.tb]=Math.round(pos+a.steps)+"px";go=true;}}else {if(pos-a.steps>a.orig_pos){a.obj.style[a.tb]=Math.round(pos-a.steps)+"px";go=true;}}if(go)a.timer=setTimeout("qm_bump_ai("+id+")",10);else {a.obj.style[a.tb]=a.orig_pos+"px";qmad.bump["_"+id]=null;a.obj.isrun=false;if(window.showHelp&&window.qm_over_select)qm_over_select(a.obj)}};function qm_bump_am(obj){var k;for(k in qmad.bump){if(qmad.bump[k]&&obj.obj==qmad.bump[k].obj){if(qmad.bump[k].timer){clearTimeout(qmad.bump[k].timer);qmad.bump[k].timer=null;}obj.top=qmad.bump[k].top;qmad.bump[k].obj.isrun=false;qmad.bump[k]=null;}}var i=0;while(qmad.bump["_"+i])i++;qmad.bump["_"+i]=obj;return i;};function qm_bump_is_prev_or_next(ci,compare){var nn=ci.nextSibling;while(nn){if(nn==compare)return "before";else nn=nn.nextSibling;}var nn=ci.previousSibling;while(nn){if(nn==compare)return "after";else nn=nn.previousSibling;}return false;}

//Add-On Code: Item Bullets (CSS - Imageless)

//Add-On Code: Follow Pointer

/* prevent execution of jQuery if included more than once */
if(typeof window.jQuery == "undefined") {
/*
 * jQuery 1.1.2 - New Wave Javascript
 *
 * Copyright (c) 2007 John Resig (jquery.com)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * $Date: 2007-02-28 12:03:00 -0500 (Wed, 28 Feb 2007) $
 * $Rev: 1465 $
 */

// Global undefined variable
window.undefined = window.undefined;
var jQuery = function(a,c) {
	// If the context is global, return a new object
	if ( window == this )
		return new jQuery(a,c);

	// Make sure that a selection was provided
	a = a || document;
	
	// HANDLE: $(function)
	// Shortcut for document ready
	if ( jQuery.isFunction(a) )
		return new jQuery(document)[ jQuery.fn.ready ? "ready" : "load" ]( a );
	
	// Handle HTML strings
	if ( typeof a  == "string" ) {
		// HANDLE: $(html) -> $(array)
		var m = /^[^<]*(<(.|\s)+>)[^>]*$/.exec(a);
		if ( m )
			a = jQuery.clean( [ m[1] ] );
		
		// HANDLE: $(expr)
		else
			return new jQuery( c ).find( a );
	}
	
	return this.setArray(
		// HANDLE: $(array)
		a.constructor == Array && a ||

		// HANDLE: $(arraylike)
		// Watch for when an array-like object is passed as the selector
		(a.jquery || a.length && a != window && !a.nodeType && a[0] != undefined && a[0].nodeType) && jQuery.makeArray( a ) ||

		// HANDLE: $(*)
		[ a ] );
};

// Map over the $ in case of overwrite
if ( typeof $ != "undefined" )
	jQuery._$ = $;
	
// Map the jQuery namespace to the '$' one
var $ = jQuery;

jQuery.fn = jQuery.prototype = {
	jquery: "1.1.2",

	size: function() {
		return this.length;
	},
	
	length: 0,

	get: function( num ) {
		return num == undefined ?

			// Return a 'clean' array
			jQuery.makeArray( this ) :

			// Return just the object
			this[num];
	},
	pushStack: function( a ) {
		var ret = jQuery(a);
		ret.prevObject = this;
		return ret;
	},
	setArray: function( a ) {
		this.length = 0;
		[].push.apply( this, a );
		return this;
	},
	each: function( fn, args ) {
		return jQuery.each( this, fn, args );
	},
	index: function( obj ) {
		var pos = -1;
		this.each(function(i){
			if ( this == obj ) pos = i;
		});
		return pos;
	},

	attr: function( key, value, type ) {
		var obj = key;
		
		// Look for the case where we're accessing a style value
		if ( key.constructor == String )
			if ( value == undefined )
				return this.length && jQuery[ type || "attr" ]( this[0], key ) || undefined;
			else {
				obj = {};
				obj[ key ] = value;
			}
		
		// Check to see if we're setting style values
		return this.each(function(index){
			// Set all the styles
			for ( var prop in obj )
				jQuery.attr(
					type ? this.style : this,
					prop, jQuery.prop(this, obj[prop], type, index, prop)
				);
		});
	},

	css: function( key, value ) {
		return this.attr( key, value, "curCSS" );
	},

	text: function(e) {
		if ( typeof e == "string" )
			return this.empty().append( document.createTextNode( e ) );

		var t = "";
		jQuery.each( e || this, function(){
			jQuery.each( this.childNodes, function(){
				if ( this.nodeType != 8 )
					t += this.nodeType != 1 ?
						this.nodeValue : jQuery.fn.text([ this ]);
			});
		});
		return t;
	},

	wrap: function() {
		// The elements to wrap the target around
		var a = jQuery.clean(arguments);

		// Wrap each of the matched elements individually
		return this.each(function(){
			// Clone the structure that we're using to wrap
			var b = a[0].cloneNode(true);

			// Insert it before the element to be wrapped
			this.parentNode.insertBefore( b, this );

			// Find the deepest point in the wrap structure
			while ( b.firstChild )
				b = b.firstChild;

			// Move the matched element to within the wrap structure
			b.appendChild( this );
		});
	},
	append: function() {
		return this.domManip(arguments, true, 1, function(a){
			this.appendChild( a );
		});
	},
	prepend: function() {
		return this.domManip(arguments, true, -1, function(a){
			this.insertBefore( a, this.firstChild );
		});
	},
	before: function() {
		return this.domManip(arguments, false, 1, function(a){
			this.parentNode.insertBefore( a, this );
		});
	},
	after: function() {
		return this.domManip(arguments, false, -1, function(a){
			this.parentNode.insertBefore( a, this.nextSibling );
		});
	},
	end: function() {
		return this.prevObject || jQuery([]);
	},
	find: function(t) {
		return this.pushStack( jQuery.map( this, function(a){
			return jQuery.find(t,a);
		}), t );
	},
	clone: function(deep) {
		return this.pushStack( jQuery.map( this, function(a){
			var a = a.cloneNode( deep != undefined ? deep : true );
			a.$events = null; // drop $events expando to avoid firing incorrect events
			return a;
		}) );
	},

	filter: function(t) {
		return this.pushStack(
			jQuery.isFunction( t ) &&
			jQuery.grep(this, function(el, index){
				return t.apply(el, [index])
			}) ||

			jQuery.multiFilter(t,this) );
	},

	not: function(t) {
		return this.pushStack(
			t.constructor == String &&
			jQuery.multiFilter(t, this, true) ||

			jQuery.grep(this, function(a) {
				return ( t.constructor == Array || t.jquery )
					? jQuery.inArray( a, t ) < 0
					: a != t;
			})
		);
	},

	add: function(t) {
		return this.pushStack( jQuery.merge(
			this.get(),
			t.constructor == String ?
				jQuery(t).get() :
				t.length != undefined && (!t.nodeName || t.nodeName == "FORM") ?
					t : [t] )
		);
	},
	is: function(expr) {
		return expr ? jQuery.filter(expr,this).r.length > 0 : false;
	},

	val: function( val ) {
		return val == undefined ?
			( this.length ? this[0].value : null ) :
			this.attr( "value", val );
	},

	html: function( val ) {
		return val == undefined ?
			( this.length ? this[0].innerHTML : null ) :
			this.empty().append( val );
	},
	domManip: function(args, table, dir, fn){
		var clone = this.length > 1; 
		var a = jQuery.clean(args);
		if ( dir < 0 )
			a.reverse();

		return this.each(function(){
			var obj = this;

			if ( table && jQuery.nodeName(this, "table") && jQuery.nodeName(a[0], "tr") )
				obj = this.getElementsByTagName("tbody")[0] || this.appendChild(document.createElement("tbody"));

			jQuery.each( a, function(){
				fn.apply( obj, [ clone ? this.cloneNode(true) : this ] );
			});

		});
	}
};

jQuery.extend = jQuery.fn.extend = function() {
	// copy reference to target object
	var target = arguments[0],
		a = 1;

	// extend jQuery itself if only one argument is passed
	if ( arguments.length == 1 ) {
		target = this;
		a = 0;
	}
	var prop;
	while (prop = arguments[a++])
		// Extend the base object
		for ( var i in prop ) target[i] = prop[i];

	// Return the modified object
	return target;
};

jQuery.extend({
	noConflict: function() {
		if ( jQuery._$ )
			$ = jQuery._$;
		return jQuery;
	},

	// This may seem like some crazy code, but trust me when I say that this
	// is the only cross-browser way to do this. --John
	isFunction: function( fn ) {
		return !!fn && typeof fn != "string" && !fn.nodeName && 
			typeof fn[0] == "undefined" && /function/i.test( fn + "" );
	},
	
	// check if an element is in a XML document
	isXMLDoc: function(elem) {
		return elem.tagName && elem.ownerDocument && !elem.ownerDocument.body;
	},

	nodeName: function( elem, name ) {
		return elem.nodeName && elem.nodeName.toUpperCase() == name.toUpperCase();
	},
	// args is for internal usage only
	each: function( obj, fn, args ) {
		if ( obj.length == undefined )
			for ( var i in obj )
				fn.apply( obj[i], args || [i, obj[i]] );
		else
			for ( var i = 0, ol = obj.length; i < ol; i++ )
				if ( fn.apply( obj[i], args || [i, obj[i]] ) === false ) break;
		return obj;
	},
	
	prop: function(elem, value, type, index, prop){
			// Handle executable functions
			if ( jQuery.isFunction( value ) )
				value = value.call( elem, [index] );
				
			// exclude the following css properties to add px
			var exclude = /z-?index|font-?weight|opacity|zoom|line-?height/i;

			// Handle passing in a number to a CSS property
			return value && value.constructor == Number && type == "curCSS" && !exclude.test(prop) ?
				value + "px" :
				value;
	},

	className: {
		// internal only, use addClass("class")
		add: function( elem, c ){
			jQuery.each( c.split(/\s+/), function(i, cur){
				if ( !jQuery.className.has( elem.className, cur ) )
					elem.className += ( elem.className ? " " : "" ) + cur;
			});
		},

		// internal only, use removeClass("class")
		remove: function( elem, c ){
			elem.className = c ?
				jQuery.grep( elem.className.split(/\s+/), function(cur){
					return !jQuery.className.has( c, cur );	
				}).join(" ") : "";
		},

		// internal only, use is(".class")
		has: function( t, c ) {
			t = t.className || t;
			// escape regex characters
			c = c.replace(/([\.\\\+\*\?\[\^\]\$\(\)\{\}\=\!\<\>\|\:])/g, "\\$1");
			return t && new RegExp("(^|\\s)" + c + "(\\s|$)").test( t );
		}
	},
	swap: function(e,o,f) {
		for ( var i in o ) {
			e.style["old"+i] = e.style[i];
			e.style[i] = o[i];
		}
		f.apply( e, [] );
		for ( var i in o )
			e.style[i] = e.style["old"+i];
	},

	css: function(e,p) {
		if ( p == "height" || p == "width" ) {
			var old = {}, oHeight, oWidth, d = ["Top","Bottom","Right","Left"];

			jQuery.each( d, function(){
				old["padding" + this] = 0;
				old["border" + this + "Width"] = 0;
			});

			jQuery.swap( e, old, function() {
				if (jQuery.css(e,"display") != "none") {
					oHeight = e.offsetHeight;
					oWidth = e.offsetWidth;
				} else {
					e = jQuery(e.cloneNode(true))
						.find(":radio").removeAttr("checked").end()
						.css({
							visibility: "hidden", position: "absolute", display: "block", right: "0", left: "0"
						}).appendTo(e.parentNode)[0];

					var parPos = jQuery.css(e.parentNode,"position");
					if ( parPos == "" || parPos == "static" )
						e.parentNode.style.position = "relative";

					oHeight = e.clientHeight;
					oWidth = e.clientWidth;

					if ( parPos == "" || parPos == "static" )
						e.parentNode.style.position = "static";

					e.parentNode.removeChild(e);
				}
			});

			return p == "height" ? oHeight : oWidth;
		}

		return jQuery.curCSS( e, p );
	},

	curCSS: function(elem, prop, force) {
		var ret;
		
		if (prop == "opacity" && jQuery.browser.msie)
			return jQuery.attr(elem.style, "opacity");
			
		if (prop == "float" || prop == "cssFloat")
		    prop = jQuery.browser.msie ? "styleFloat" : "cssFloat";

		if (!force && elem.style[prop])
			ret = elem.style[prop];

		else if (document.defaultView && document.defaultView.getComputedStyle) {

			if (prop == "cssFloat" || prop == "styleFloat")
				prop = "float";

			prop = prop.replace(/([A-Z])/g,"-$1").toLowerCase();
			var cur = document.defaultView.getComputedStyle(elem, null);

			if ( cur )
				ret = cur.getPropertyValue(prop);
			else if ( prop == "display" )
				ret = "none";
			else
				jQuery.swap(elem, { display: "block" }, function() {
				    var c = document.defaultView.getComputedStyle(this, "");
				    ret = c && c.getPropertyValue(prop) || "";
				});

		} else if (elem.currentStyle) {

			var newProp = prop.replace(/\-(\w)/g,function(m,c){return c.toUpperCase();});
			ret = elem.currentStyle[prop] || elem.currentStyle[newProp];
			
		}

		return ret;
	},
	
	clean: function(a) {
		var r = [];

		jQuery.each( a, function(i,arg){
			if ( !arg ) return;

			if ( arg.constructor == Number )
				arg = arg.toString();
			
			 // Convert html string into DOM nodes
			if ( typeof arg == "string" ) {
				// Trim whitespace, otherwise indexOf won't work as expected
				var s = jQuery.trim(arg), div = document.createElement("div"), tb = [];

				var wrap =
					 // option or optgroup
					!s.indexOf("<opt") &&
					[1, "<select>", "</select>"] ||
					
					(!s.indexOf("<thead") || !s.indexOf("<tbody") || !s.indexOf("<tfoot")) &&
					[1, "<table>", "</table>"] ||
					
					!s.indexOf("<tr") &&
					[2, "<table><tbody>", "</tbody></table>"] ||
					
				 	// <thead> matched above
					(!s.indexOf("<td") || !s.indexOf("<th")) &&
					[3, "<table><tbody><tr>", "</tr></tbody></table>"] ||
					
					[0,"",""];

				// Go to html and back, then peel off extra wrappers
				div.innerHTML = wrap[1] + s + wrap[2];
				
				// Move to the right depth
				while ( wrap[0]-- )
					div = div.firstChild;
				
				// Remove IE's autoinserted <tbody> from table fragments
				if ( jQuery.browser.msie ) {
					
					// String was a <table>, *may* have spurious <tbody>
					if ( !s.indexOf("<table") && s.indexOf("<tbody") < 0 ) 
						tb = div.firstChild && div.firstChild.childNodes;
						
					// String was a bare <thead> or <tfoot>
					else if ( wrap[1] == "<table>" && s.indexOf("<tbody") < 0 )
						tb = div.childNodes;

					for ( var n = tb.length-1; n >= 0 ; --n )
						if ( jQuery.nodeName(tb[n], "tbody") && !tb[n].childNodes.length )
							tb[n].parentNode.removeChild(tb[n]);
					
				}
				
				arg = [];
				for (var i=0, l=div.childNodes.length; i<l; i++)
					arg.push(div.childNodes[i]);
			}

			if ( arg.length === 0 && !jQuery.nodeName(arg, "form") )
				return;
			
			if ( arg[0] == undefined || jQuery.nodeName(arg, "form") )
				r.push( arg );
			else
				r = jQuery.merge( r, arg );

		});

		return r;
	},
	
	attr: function(elem, name, value){
		var fix = jQuery.isXMLDoc(elem) ? {} : {
			"for": "htmlFor",
			"class": "className",
			"float": jQuery.browser.msie ? "styleFloat" : "cssFloat",
			cssFloat: jQuery.browser.msie ? "styleFloat" : "cssFloat",
			innerHTML: "innerHTML",
			className: "className",
			value: "value",
			disabled: "disabled",
			checked: "checked",
			readonly: "readOnly",
			selected: "selected"
		};
		
		// IE actually uses filters for opacity ... elem is actually elem.style
		if ( name == "opacity" && jQuery.browser.msie && value != undefined ) {
			// IE has trouble with opacity if it does not have layout
			// Force it by setting the zoom level
			elem.zoom = 1; 

			// Set the alpha filter to set the opacity
			return elem.filter = elem.filter.replace(/alpha\([^\)]*\)/gi,"") +
				( value == 1 ? "" : "alpha(opacity=" + value * 100 + ")" );

		} else if ( name == "opacity" && jQuery.browser.msie )
			return elem.filter ? 
				parseFloat( elem.filter.match(/alpha\(opacity=(.*)\)/)[1] ) / 100 : 1;
		
		// Mozilla doesn't play well with opacity 1
		if ( name == "opacity" && jQuery.browser.mozilla && value == 1 )
			value = 0.9999;
			

		// Certain attributes only work when accessed via the old DOM 0 way
		if ( fix[name] ) {
			if ( value != undefined ) elem[fix[name]] = value;
			return elem[fix[name]];

		} else if ( value == undefined && jQuery.browser.msie && jQuery.nodeName(elem, "form") && (name == "action" || name == "method") )
			return elem.getAttributeNode(name).nodeValue;

		// IE elem.getAttribute passes even for style
		else if ( elem.tagName ) {
			if ( value != undefined ) elem.setAttribute( name, value );
			if ( jQuery.browser.msie && /href|src/.test(name) && !jQuery.isXMLDoc(elem) ) 
				return elem.getAttribute( name, 2 );
			return elem.getAttribute( name );

		// elem is actually elem.style ... set the style
		} else {
			name = name.replace(/-([a-z])/ig,function(z,b){return b.toUpperCase();});
			if ( value != undefined ) elem[name] = value;
			return elem[name];
		}
	},
	trim: function(t){
		return t.replace(/^\s+|\s+$/g, "");
	},

	makeArray: function( a ) {
		var r = [];

		if ( a.constructor != Array )
			for ( var i = 0, al = a.length; i < al; i++ )
				r.push( a[i] );
		else
			r = a.slice( 0 );

		return r;
	},

	inArray: function( b, a ) {
		for ( var i = 0, al = a.length; i < al; i++ )
			if ( a[i] == b )
				return i;
		return -1;
	},
	merge: function(first, second) {
		var r = [].slice.call( first, 0 );

		// Now check for duplicates between the two arrays
		// and only add the unique items
		for ( var i = 0, sl = second.length; i < sl; i++ )
			// Check for duplicates
			if ( jQuery.inArray( second[i], r ) == -1 )
				// The item is unique, add it
				first.push( second[i] );

		return first;
	},
	grep: function(elems, fn, inv) {
		// If a string is passed in for the function, make a function
		// for it (a handy shortcut)
		if ( typeof fn == "string" )
			fn = new Function("a","i","return " + fn);

		var result = [];

		// Go through the array, only saving the items
		// that pass the validator function
		for ( var i = 0, el = elems.length; i < el; i++ )
			if ( !inv && fn(elems[i],i) || inv && !fn(elems[i],i) )
				result.push( elems[i] );

		return result;
	},
	map: function(elems, fn) {
		// If a string is passed in for the function, make a function
		// for it (a handy shortcut)
		if ( typeof fn == "string" )
			fn = new Function("a","return " + fn);

		var result = [], r = [];

		// Go through the array, translating each of the items to their
		// new value (or values).
		for ( var i = 0, el = elems.length; i < el; i++ ) {
			var val = fn(elems[i],i);

			if ( val !== null && val != undefined ) {
				if ( val.constructor != Array ) val = [val];
				result = result.concat( val );
			}
		}

		var r = result.length ? [ result[0] ] : [];

		check: for ( var i = 1, rl = result.length; i < rl; i++ ) {
			for ( var j = 0; j < i; j++ )
				if ( result[i] == r[j] )
					continue check;

			r.push( result[i] );
		}

		return r;
	}
});
 
/*
 * Whether the W3C compliant box model is being used.
 *
 * @property
 * @name $.boxModel
 * @type Boolean
 * @cat JavaScript
 */
new function() {
	var b = navigator.userAgent.toLowerCase();

	// Figure out what browser is being used
	jQuery.browser = {
		safari: /webkit/.test(b),
		opera: /opera/.test(b),
		msie: /msie/.test(b) && !/opera/.test(b),
		mozilla: /mozilla/.test(b) && !/(compatible|webkit)/.test(b)
	};

	// Check to see if the W3C box model is being used
	jQuery.boxModel = !jQuery.browser.msie || document.compatMode == "CSS1Compat";
};

jQuery.each({
	parent: "a.parentNode",
	parents: "jQuery.parents(a)",
	next: "jQuery.nth(a,2,'nextSibling')",
	prev: "jQuery.nth(a,2,'previousSibling')",
	siblings: "jQuery.sibling(a.parentNode.firstChild,a)",
	children: "jQuery.sibling(a.firstChild)"
}, function(i,n){
	jQuery.fn[ i ] = function(a) {
		var ret = jQuery.map(this,n);
		if ( a && typeof a == "string" )
			ret = jQuery.multiFilter(a,ret);
		return this.pushStack( ret );
	};
});

jQuery.each({
	appendTo: "append",
	prependTo: "prepend",
	insertBefore: "before",
	insertAfter: "after"
}, function(i,n){
	jQuery.fn[ i ] = function(){
		var a = arguments;
		return this.each(function(){
			for ( var j = 0, al = a.length; j < al; j++ )
				jQuery(a[j])[n]( this );
		});
	};
});

jQuery.each( {
	removeAttr: function( key ) {
		jQuery.attr( this, key, "" );
		this.removeAttribute( key );
	},
	addClass: function(c){
		jQuery.className.add(this,c);
	},
	removeClass: function(c){
		jQuery.className.remove(this,c);
	},
	toggleClass: function( c ){
		jQuery.className[ jQuery.className.has(this,c) ? "remove" : "add" ](this, c);
	},
	remove: function(a){
		if ( !a || jQuery.filter( a, [this] ).r.length )
			this.parentNode.removeChild( this );
	},
	empty: function() {
		while ( this.firstChild )
			this.removeChild( this.firstChild );
	}
}, function(i,n){
	jQuery.fn[ i ] = function() {
		return this.each( n, arguments );
	};
});

jQuery.each( [ "eq", "lt", "gt", "contains" ], function(i,n){
	jQuery.fn[ n ] = function(num,fn) {
		return this.filter( ":" + n + "(" + num + ")", fn );
	};
});

jQuery.each( [ "height", "width" ], function(i,n){
	jQuery.fn[ n ] = function(h) {
		return h == undefined ?
			( this.length ? jQuery.css( this[0], n ) : null ) :
			this.css( n, h.constructor == String ? h : h + "px" );
	};
});
jQuery.extend({
	expr: {
		"": "m[2]=='*'||jQuery.nodeName(a,m[2])",
		"#": "a.getAttribute('id')==m[2]",
		":": {
			// Position Checks
			lt: "i<m[3]-0",
			gt: "i>m[3]-0",
			nth: "m[3]-0==i",
			eq: "m[3]-0==i",
			first: "i==0",
			last: "i==r.length-1",
			even: "i%2==0",
			odd: "i%2",

			// Child Checks
			"nth-child": "jQuery.nth(a.parentNode.firstChild,m[3],'nextSibling',a)==a",
			"first-child": "jQuery.nth(a.parentNode.firstChild,1,'nextSibling')==a",
			"last-child": "jQuery.nth(a.parentNode.lastChild,1,'previousSibling')==a",
			"only-child": "jQuery.sibling(a.parentNode.firstChild).length==1",

			// Parent Checks
			parent: "a.firstChild",
			empty: "!a.firstChild",

			// Text Check
			contains: "jQuery.fn.text.apply([a]).indexOf(m[3])>=0",

			// Visibility
			visible: 'a.type!="hidden"&&jQuery.css(a,"display")!="none"&&jQuery.css(a,"visibility")!="hidden"',
			hidden: 'a.type=="hidden"||jQuery.css(a,"display")=="none"||jQuery.css(a,"visibility")=="hidden"',

			// Form attributes
			enabled: "!a.disabled",
			disabled: "a.disabled",
			checked: "a.checked",
			selected: "a.selected||jQuery.attr(a,'selected')",

			// Form elements
			text: "a.type=='text'",
			radio: "a.type=='radio'",
			checkbox: "a.type=='checkbox'",
			file: "a.type=='file'",
			password: "a.type=='password'",
			submit: "a.type=='submit'",
			image: "a.type=='image'",
			reset: "a.type=='reset'",
			button: 'a.type=="button"||jQuery.nodeName(a,"button")',
			input: "/input|select|textarea|button/i.test(a.nodeName)"
		},
		".": "jQuery.className.has(a,m[2])",
		"@": {
			"=": "z==m[4]",
			"!=": "z!=m[4]",
			"^=": "z&&!z.indexOf(m[4])",
			"$=": "z&&z.substr(z.length - m[4].length,m[4].length)==m[4]",
			"*=": "z&&z.indexOf(m[4])>=0",
			"": "z",
			_resort: function(m){
				return ["", m[1], m[3], m[2], m[5]];
			},
			_prefix: "z=a[m[3]];if(!z||/href|src/.test(m[3]))z=jQuery.attr(a,m[3]);"
		},
		"[": "jQuery.find(m[2],a).length"
	},
	
	// The regular expressions that power the parsing engine
	parse: [
		// Match: [@value='test'], [@foo]
		/^\[ *(@)([a-z0-9_-]*) *([!*$^=]*) *('?"?)(.*?)\4 *\]/i,

		// Match: [div], [div p]
		/^(\[)\s*(.*?(\[.*?\])?[^[]*?)\s*\]/,

		// Match: :contains('foo')
		/^(:)([a-z0-9_-]*)\("?'?(.*?(\(.*?\))?[^(]*?)"?'?\)/i,

		// Match: :even, :last-chlid
		/^([:.#]*)([a-z0-9_*-]*)/i
	],

	token: [
		/^(\/?\.\.)/, "a.parentNode",
		/^(>|\/)/, "jQuery.sibling(a.firstChild)",
		/^(\+)/, "jQuery.nth(a,2,'nextSibling')",
		/^(~)/, function(a){
			var s = jQuery.sibling(a.parentNode.firstChild);
			return s.slice(jQuery.inArray(a,s) + 1);
		}
	],

	multiFilter: function( expr, elems, not ) {
		var old, cur = [];

		while ( expr && expr != old ) {
			old = expr;
			var f = jQuery.filter( expr, elems, not );
			expr = f.t.replace(/^\s*,\s*/, "" );
			cur = not ? elems = f.r : jQuery.merge( cur, f.r );
		}

		return cur;
	},
	find: function( t, context ) {
		// Quickly handle non-string expressions
		if ( typeof t != "string" )
			return [ t ];

		// Make sure that the context is a DOM Element
		if ( context && !context.nodeType )
			context = null;

		// Set the correct context (if none is provided)
		context = context || document;

		// Handle the common XPath // expression
		if ( !t.indexOf("//") ) {
			context = context.documentElement;
			t = t.substr(2,t.length);

		// And the / root expression
		} else if ( !t.indexOf("/") ) {
			context = context.documentElement;
			t = t.substr(1,t.length);
			if ( t.indexOf("/") >= 1 )
				t = t.substr(t.indexOf("/"),t.length);
		}

		// Initialize the search
		var ret = [context], done = [], last = null;

		// Continue while a selector expression exists, and while
		// we're no longer looping upon ourselves
		while ( t && last != t ) {
			var r = [];
			last = t;

			t = jQuery.trim(t).replace( /^\/\//i, "" );

			var foundToken = false;

			// An attempt at speeding up child selectors that
			// point to a specific element tag
			var re = /^[\/>]\s*([a-z0-9*-]+)/i;
			var m = re.exec(t);

			if ( m ) {
				// Perform our own iteration and filter
				jQuery.each( ret, function(){
					for ( var c = this.firstChild; c; c = c.nextSibling )
						if ( c.nodeType == 1 && ( jQuery.nodeName(c, m[1]) || m[1] == "*" ) )
							r.push( c );
				});

				ret = r;
				t = t.replace( re, "" );
				if ( t.indexOf(" ") == 0 ) continue;
				foundToken = true;
			} else {
				// Look for pre-defined expression tokens
				for ( var i = 0; i < jQuery.token.length; i += 2 ) {
					// Attempt to match each, individual, token in
					// the specified order
					var re = jQuery.token[i];
					var m = re.exec(t);

					// If the token match was found
					if ( m ) {
						// Map it against the token's handler
						r = ret = jQuery.map( ret, jQuery.isFunction( jQuery.token[i+1] ) ?
							jQuery.token[i+1] :
							function(a){ return eval(jQuery.token[i+1]); });

						// And remove the token
						t = jQuery.trim( t.replace( re, "" ) );
						foundToken = true;
						break;
					}
				}
			}

			// See if there's still an expression, and that we haven't already
			// matched a token
			if ( t && !foundToken ) {
				// Handle multiple expressions
				if ( !t.indexOf(",") ) {
					// Clean the result set
					if ( ret[0] == context ) ret.shift();

					// Merge the result sets
					jQuery.merge( done, ret );

					// Reset the context
					r = ret = [context];

					// Touch up the selector string
					t = " " + t.substr(1,t.length);

				} else {
					// Optomize for the case nodeName#idName
					var re2 = /^([a-z0-9_-]+)(#)([a-z0-9\\*_-]*)/i;
					var m = re2.exec(t);
					
					// Re-organize the results, so that they're consistent
					if ( m ) {
					   m = [ 0, m[2], m[3], m[1] ];

					} else {
						// Otherwise, do a traditional filter check for
						// ID, class, and element selectors
						re2 = /^([#.]?)([a-z0-9\\*_-]*)/i;
						m = re2.exec(t);
					}

					// Try to do a global search by ID, where we can
					if ( m[1] == "#" && ret[ret.length-1].getElementById ) {
						// Optimization for HTML document case
						var oid = ret[ret.length-1].getElementById(m[2]);
						
						// Do a quick check for the existence of the actual ID attribute
						// to avoid selecting by the name attribute in IE
						if ( jQuery.browser.msie && oid && oid.id != m[2] )
							oid = jQuery('[@id="'+m[2]+'"]', ret[ret.length-1])[0];

						// Do a quick check for node name (where applicable) so
						// that div#foo searches will be really fast
						ret = r = oid && (!m[3] || jQuery.nodeName(oid, m[3])) ? [oid] : [];

					} else {
						// Pre-compile a regular expression to handle class searches
						if ( m[1] == "." )
							var rec = new RegExp("(^|\\s)" + m[2] + "(\\s|$)");

						// We need to find all descendant elements, it is more
						// efficient to use getAll() when we are already further down
						// the tree - we try to recognize that here
						jQuery.each( ret, function(){
							// Grab the tag name being searched for
							var tag = m[1] != "" || m[0] == "" ? "*" : m[2];

							// Handle IE7 being really dumb about <object>s
							if ( jQuery.nodeName(this, "object") && tag == "*" )
								tag = "param";

							jQuery.merge( r,
								m[1] != "" && ret.length != 1 ?
									jQuery.getAll( this, [], m[1], m[2], rec ) :
									this.getElementsByTagName( tag )
							);
						});

						// It's faster to filter by class and be done with it
						if ( m[1] == "." && ret.length == 1 )
							r = jQuery.grep( r, function(e) {
								return rec.test(e.className);
							});

						// Same with ID filtering
						if ( m[1] == "#" && ret.length == 1 ) {
							// Remember, then wipe out, the result set
							var tmp = r;
							r = [];

							// Then try to find the element with the ID
							jQuery.each( tmp, function(){
								if ( this.getAttribute("id") == m[2] ) {
									r = [ this ];
									return false;
								}
							});
						}

						ret = r;
					}

					t = t.replace( re2, "" );
				}

			}

			// If a selector string still exists
			if ( t ) {
				// Attempt to filter it
				var val = jQuery.filter(t,r);
				ret = r = val.r;
				t = jQuery.trim(val.t);
			}
		}

		// Remove the root context
		if ( ret && ret[0] == context ) ret.shift();

		// And combine the results
		jQuery.merge( done, ret );

		return done;
	},

	filter: function(t,r,not) {
		// Look for common filter expressions
		while ( t && /^[a-z[({<*:.#]/i.test(t) ) {

			var p = jQuery.parse, m;

			jQuery.each( p, function(i,re){
		
				// Look for, and replace, string-like sequences
				// and finally build a regexp out of it
				m = re.exec( t );

				if ( m ) {
					// Remove what we just matched
					t = t.substring( m[0].length );

					// Re-organize the first match
					if ( jQuery.expr[ m[1] ]._resort )
						m = jQuery.expr[ m[1] ]._resort( m );

					return false;
				}
			});

			// :not() is a special case that can be optimized by
			// keeping it out of the expression list
			if ( m[1] == ":" && m[2] == "not" )
				r = jQuery.filter(m[3], r, true).r;

			// Handle classes as a special case (this will help to
			// improve the speed, as the regexp will only be compiled once)
			else if ( m[1] == "." ) {

				var re = new RegExp("(^|\\s)" + m[2] + "(\\s|$)");
				r = jQuery.grep( r, function(e){
					return re.test(e.className || "");
				}, not);

			// Otherwise, find the expression to execute
			} else {
				var f = jQuery.expr[m[1]];
				if ( typeof f != "string" )
					f = jQuery.expr[m[1]][m[2]];

				// Build a custom macro to enclose it
				eval("f = function(a,i){" +
					( jQuery.expr[ m[1] ]._prefix || "" ) +
					"return " + f + "}");

				// Execute it against the current filter
				r = jQuery.grep( r, f, not );
			}
		}

		// Return an array of filtered elements (r)
		// and the modified expression string (t)
		return { r: r, t: t };
	},
	
	getAll: function( o, r, token, name, re ) {
		for ( var s = o.firstChild; s; s = s.nextSibling )
			if ( s.nodeType == 1 ) {
				var add = true;

				if ( token == "." )
					add = s.className && re.test(s.className);
				else if ( token == "#" )
					add = s.getAttribute("id") == name;
	
				if ( add )
					r.push( s );

				if ( token == "#" && r.length ) break;

				if ( s.firstChild )
					jQuery.getAll( s, r, token, name, re );
			}

		return r;
	},
	parents: function( elem ){
		var matched = [];
		var cur = elem.parentNode;
		while ( cur && cur != document ) {
			matched.push( cur );
			cur = cur.parentNode;
		}
		return matched;
	},
	nth: function(cur,result,dir,elem){
		result = result || 1;
		var num = 0;
		for ( ; cur; cur = cur[dir] ) {
			if ( cur.nodeType == 1 ) num++;
			if ( num == result || result == "even" && num % 2 == 0 && num > 1 && cur == elem ||
				result == "odd" && num % 2 == 1 && cur == elem ) return cur;
		}
	},
	sibling: function( n, elem ) {
		var r = [];

		for ( ; n; n = n.nextSibling ) {
			if ( n.nodeType == 1 && (!elem || n != elem) )
				r.push( n );
		}

		return r;
	}
});
/*
 * A number of helper functions used for managing events.
 * Many of the ideas behind this code orignated from 
 * Dean Edwards' addEvent library.
 */
jQuery.event = {

	// Bind an event to an element
	// Original by Dean Edwards
	add: function(element, type, handler, data) {
		// For whatever reason, IE has trouble passing the window object
		// around, causing it to be cloned in the process
		if ( jQuery.browser.msie && element.setInterval != undefined )
			element = window;

		// if data is passed, bind to handler
		if( data ) 
			handler.data = data;

		// Make sure that the function being executed has a unique ID
		if ( !handler.guid )
			handler.guid = this.guid++;

		// Init the element's event structure
		if (!element.$events)
			element.$events = {};

		// Get the current list of functions bound to this event
		var handlers = element.$events[type];

		// If it hasn't been initialized yet
		if (!handlers) {
			// Init the event handler queue
			handlers = element.$events[type] = {};

			// Remember an existing handler, if it's already there
			if (element["on" + type])
				handlers[0] = element["on" + type];
		}

		// Add the function to the element's handler list
		handlers[handler.guid] = handler;

		// And bind the global event handler to the element
		element["on" + type] = this.handle;

		// Remember the function in a global list (for triggering)
		if (!this.global[type])
			this.global[type] = [];
		this.global[type].push( element );
	},

	guid: 1,
	global: {},

	// Detach an event or set of events from an element
	remove: function(element, type, handler) {
		if (element.$events) {
			var i,j,k;
			if ( type && type.type ) { // type is actually an event object here
				handler = type.handler;
				type    = type.type;
			}
			
			if (type && element.$events[type])
				// remove the given handler for the given type
				if ( handler )
					delete element.$events[type][handler.guid];
					
				// remove all handlers for the given type
				else
					for ( i in element.$events[type] )
						delete element.$events[type][i];
						
			// remove all handlers		
			else
				for ( j in element.$events )
					this.remove( element, j );
			
			// remove event handler if no more handlers exist
			for ( k in element.$events[type] )
				if (k) {
					k = true;
					break;
				}
			if (!k) element["on" + type] = null;
		}
	},

	trigger: function(type, data, element) {
		// Clone the incoming data, if any
		data = jQuery.makeArray(data || []);

		// Handle a global trigger
		if ( !element )
			jQuery.each( this.global[type] || [], function(){
				jQuery.event.trigger( type, data, this );
			});

		// Handle triggering a single element
		else {
			var handler = element["on" + type ], val,
				fn = jQuery.isFunction( element[ type ] );

			if ( handler ) {
				// Pass along a fake event
				data.unshift( this.fix({ type: type, target: element }) );
	
				// Trigger the event
				if ( (val = handler.apply( element, data )) !== false )
					this.triggered = true;
			}

			if ( fn && val !== false )
				element[ type ]();

			this.triggered = false;
		}
	},

	handle: function(event) {
		// Handle the second event of a trigger and when
		// an event is called after a page has unloaded
		if ( typeof jQuery == "undefined" || jQuery.event.triggered ) return;

		// Empty object is for triggered events with no data
		event = jQuery.event.fix( event || window.event || {} ); 

		// returned undefined or false
		var returnValue;

		var c = this.$events[event.type];

		var args = [].slice.call( arguments, 1 );
		args.unshift( event );

		for ( var j in c ) {
			// Pass in a reference to the handler function itself
			// So that we can later remove it
			args[0].handler = c[j];
			args[0].data = c[j].data;

			if ( c[j].apply( this, args ) === false ) {
				event.preventDefault();
				event.stopPropagation();
				returnValue = false;
			}
		}

		// Clean up added properties in IE to prevent memory leak
		if (jQuery.browser.msie) event.target = event.preventDefault = event.stopPropagation = event.handler = event.data = null;

		return returnValue;
	},

	fix: function(event) {
		// Fix target property, if necessary
		if ( !event.target && event.srcElement )
			event.target = event.srcElement;

		// Calculate pageX/Y if missing and clientX/Y available
		if ( event.pageX == undefined && event.clientX != undefined ) {
			var e = document.documentElement, b = document.body;
			event.pageX = event.clientX + (e.scrollLeft || b.scrollLeft);
			event.pageY = event.clientY + (e.scrollTop || b.scrollTop);
		}
				
		// check if target is a textnode (safari)
		if (jQuery.browser.safari && event.target.nodeType == 3) {
			// store a copy of the original event object 
			// and clone because target is read only
			var originalEvent = event;
			event = jQuery.extend({}, originalEvent);
			
			// get parentnode from textnode
			event.target = originalEvent.target.parentNode;
			
			// add preventDefault and stopPropagation since 
			// they will not work on the clone
			event.preventDefault = function() {
				return originalEvent.preventDefault();
			};
			event.stopPropagation = function() {
				return originalEvent.stopPropagation();
			};
		}
		
		// fix preventDefault and stopPropagation
		if (!event.preventDefault)
			event.preventDefault = function() {
				this.returnValue = false;
			};
			
		if (!event.stopPropagation)
			event.stopPropagation = function() {
				this.cancelBubble = true;
			};
			
		return event;
	}
};

jQuery.fn.extend({
	bind: function( type, data, fn ) {
		return this.each(function(){
			jQuery.event.add( this, type, fn || data, data );
		});
	},
	one: function( type, data, fn ) {
		return this.each(function(){
			jQuery.event.add( this, type, function(event) {
				jQuery(this).unbind(event);
				return (fn || data).apply( this, arguments);
			}, data);
		});
	},
	unbind: function( type, fn ) {
		return this.each(function(){
			jQuery.event.remove( this, type, fn );
		});
	},
	trigger: function( type, data ) {
		return this.each(function(){
			jQuery.event.trigger( type, data, this );
		});
	},
	toggle: function() {
		// Save reference to arguments for access in closure
		var a = arguments;

		return this.click(function(e) {
			// Figure out which function to execute
			this.lastToggle = this.lastToggle == 0 ? 1 : 0;
			
			// Make sure that clicks stop
			e.preventDefault();
			
			// and execute the function
			return a[this.lastToggle].apply( this, [e] ) || false;
		});
	},
	hover: function(f,g) {
		
		// A private function for handling mouse 'hovering'
		function handleHover(e) {
			// Check if mouse(over|out) are still within the same parent element
			var p = (e.type == "mouseover" ? e.fromElement : e.toElement) || e.relatedTarget;
	
			// Traverse up the tree
			while ( p && p != this ) try { p = p.parentNode } catch(e) { p = this; };
			
			// If we actually just moused on to a sub-element, ignore it
			if ( p == this ) return false;
			
			// Execute the right function
			return (e.type == "mouseover" ? f : g).apply(this, [e]);
		}
		
		// Bind the function to the two event listeners
		return this.mouseover(handleHover).mouseout(handleHover);
	},
	ready: function(f) {
		// If the DOM is already ready
		if ( jQuery.isReady )
			// Execute the function immediately
			f.apply( document, [jQuery] );
			
		// Otherwise, remember the function for later
		else {
			// Add the function to the wait list
			jQuery.readyList.push( function() { return f.apply(this, [jQuery]) } );
		}
	
		return this;
	}
});

jQuery.extend({
	/*
	 * All the code that makes DOM Ready work nicely.
	 */
	isReady: false,
	readyList: [],
	
	// Handle when the DOM is ready
	ready: function() {
		// Make sure that the DOM is not already loaded
		if ( !jQuery.isReady ) {
			// Remember that the DOM is ready
			jQuery.isReady = true;
			
			// If there are functions bound, to execute
			if ( jQuery.readyList ) {
				// Execute all of them
				jQuery.each( jQuery.readyList, function(){
					this.apply( document );
				});
				
				// Reset the list of functions
				jQuery.readyList = null;
			}
			// Remove event lisenter to avoid memory leak
			if ( jQuery.browser.mozilla || jQuery.browser.opera )
				document.removeEventListener( "DOMContentLoaded", jQuery.ready, false );
		}
	}
});

new function(){

	jQuery.each( ("blur,focus,load,resize,scroll,unload,click,dblclick," +
		"mousedown,mouseup,mousemove,mouseover,mouseout,change,select," + 
		"submit,keydown,keypress,keyup,error").split(","), function(i,o){
		
		// Handle event binding
		jQuery.fn[o] = function(f){
			return f ? this.bind(o, f) : this.trigger(o);
		};
			
	});
	
	// If Mozilla is used
	if ( jQuery.browser.mozilla || jQuery.browser.opera )
		// Use the handy event callback
		document.addEventListener( "DOMContentLoaded", jQuery.ready, false );
	
	// If IE is used, use the excellent hack by Matthias Miller
	// http://www.outofhanwell.com/blog/index.php?title=the_window_onload_problem_revisited
	else if ( jQuery.browser.msie ) {
	
		// Only works if you document.write() it
		document.write("<scr" + "ipt id=__ie_init defer=true " + 
			"src=//:><\/script>");
	
		// Use the defer script hack
		var script = document.getElementById("__ie_init");
		
		// script does not exist if jQuery is loaded dynamically
		if ( script ) 
			script.onreadystatechange = function() {
				if ( this.readyState != "complete" ) return;
				this.parentNode.removeChild( this );
				jQuery.ready();
			};
	
		// Clear from memory
		script = null;
	
	// If Safari  is used
	} else if ( jQuery.browser.safari )
		// Continually check to see if the document.readyState is valid
		jQuery.safariTimer = setInterval(function(){
			// loaded and complete are both valid states
			if ( document.readyState == "loaded" || 
				document.readyState == "complete" ) {
	
				// If either one are found, remove the timer
				clearInterval( jQuery.safariTimer );
				jQuery.safariTimer = null;
	
				// and execute any waiting functions
				jQuery.ready();
			}
		}, 10); 

	// A fallback to window.onload, that will always work
	jQuery.event.add( window, "load", jQuery.ready );
	
};

// Clean up after IE to avoid memory leaks
if (jQuery.browser.msie)
	jQuery(window).one("unload", function() {
		var global = jQuery.event.global;
		for ( var type in global ) {
			var els = global[type], i = els.length;
			if ( i && type != 'unload' )
				do
					jQuery.event.remove(els[i-1], type);
				while (--i);
		}
	});
jQuery.fn.extend({
	loadIfModified: function( url, params, callback ) {
		this.load( url, params, callback, 1 );
	},
	load: function( url, params, callback, ifModified ) {
		if ( jQuery.isFunction( url ) )
			return this.bind("load", url);

		callback = callback || function(){};

		// Default to a GET request
		var type = "GET";

		// If the second parameter was provided
		if ( params )
			// If it's a function
			if ( jQuery.isFunction( params ) ) {
				// We assume that it's the callback
				callback = params;
				params = null;

			// Otherwise, build a param string
			} else {
				params = jQuery.param( params );
				type = "POST";
			}

		var self = this;

		// Request the remote document
		jQuery.ajax({
			url: url,
			type: type,
			data: params,
			ifModified: ifModified,
			complete: function(res, status){
				if ( status == "success" || !ifModified && status == "notmodified" )
					// Inject the HTML into all the matched elements
					self.attr("innerHTML", res.responseText)
					  // Execute all the scripts inside of the newly-injected HTML
					  .evalScripts()
					  // Execute callback
					  .each( callback, [res.responseText, status, res] );
				else
					callback.apply( self, [res.responseText, status, res] );
			}
		});
		return this;
	},
	serialize: function() {
		return jQuery.param( this );
	},
	evalScripts: function() {
		return this.find("script").each(function(){
			if ( this.src )
				jQuery.getScript( this.src );
			else
				jQuery.globalEval( this.text || this.textContent || this.innerHTML || "" );
		}).end();
	}

});

// If IE is used, create a wrapper for the XMLHttpRequest object
if ( !window.XMLHttpRequest )
	XMLHttpRequest = function(){
		return new ActiveXObject("Microsoft.XMLHTTP");
	};

// Attach a bunch of functions for handling common AJAX events

jQuery.each( "ajaxStart,ajaxStop,ajaxComplete,ajaxError,ajaxSuccess,ajaxSend".split(","), function(i,o){
	jQuery.fn[o] = function(f){
		return this.bind(o, f);
	};
});

jQuery.extend({
	get: function( url, data, callback, type, ifModified ) {
		// shift arguments if data argument was ommited
		if ( jQuery.isFunction( data ) ) {
			callback = data;
			data = null;
		}
		
		return jQuery.ajax({
			url: url,
			data: data,
			success: callback,
			dataType: type,
			ifModified: ifModified
		});
	},
	getIfModified: function( url, data, callback, type ) {
		return jQuery.get(url, data, callback, type, 1);
	},
	getScript: function( url, callback ) {
		return jQuery.get(url, null, callback, "script");
	},
	getJSON: function( url, data, callback ) {
		return jQuery.get(url, data, callback, "json");
	},
	post: function( url, data, callback, type ) {
		if ( jQuery.isFunction( data ) ) {
			callback = data;
			data = {};
		}

		return jQuery.ajax({
			type: "POST",
			url: url,
			data: data,
			success: callback,
			dataType: type
		});
	},

	// timeout (ms)
	//timeout: 0,
	ajaxTimeout: function( timeout ) {
		jQuery.ajaxSettings.timeout = timeout;
	},
	ajaxSetup: function( settings ) {
		jQuery.extend( jQuery.ajaxSettings, settings );
	},

	ajaxSettings: {
		global: true,
		type: "GET",
		timeout: 0,
		contentType: "application/x-www-form-urlencoded",
		processData: true,
		async: true,
		data: null
	},
	
	// Last-Modified header cache for next request
	lastModified: {},
	ajax: function( s ) {
		// TODO introduce global settings, allowing the client to modify them for all requests, not only timeout
		s = jQuery.extend({}, jQuery.ajaxSettings, s);

		// if data available
		if ( s.data ) {
			// convert data if not already a string
			if (s.processData && typeof s.data != "string")
    			s.data = jQuery.param(s.data);
			// append data to url for get requests
			if( s.type.toLowerCase() == "get" ) {
				// "?" + data or "&" + data (in case there are already params)
				s.url += ((s.url.indexOf("?") > -1) ? "&" : "?") + s.data;
				// IE likes to send both get and post data, prevent this
				s.data = null;
			}
		}

		// Watch for a new set of requests
		if ( s.global && ! jQuery.active++ )
			jQuery.event.trigger( "ajaxStart" );

		var requestDone = false;

		// Create the request object
		var xml = new XMLHttpRequest();

		// Open the socket
		xml.open(s.type, s.url, s.async);

		// Set the correct header, if data is being sent
		if ( s.data )
			xml.setRequestHeader("Content-Type", s.contentType);

		// Set the If-Modified-Since header, if ifModified mode.
		if ( s.ifModified )
			xml.setRequestHeader("If-Modified-Since",
				jQuery.lastModified[s.url] || "Thu, 01 Jan 1970 00:00:00 GMT" );

		// Set header so the called script knows that it's an XMLHttpRequest
		xml.setRequestHeader("X-Requested-With", "XMLHttpRequest");

		// Make sure the browser sends the right content length
		if ( xml.overrideMimeType )
			xml.setRequestHeader("Connection", "close");
			
		// Allow custom headers/mimetypes
		if( s.beforeSend )
			s.beforeSend(xml);
			
		if ( s.global )
		    jQuery.event.trigger("ajaxSend", [xml, s]);

		// Wait for a response to come back
		var onreadystatechange = function(isTimeout){
			// The transfer is complete and the data is available, or the request timed out
			if ( xml && (xml.readyState == 4 || isTimeout == "timeout") ) {
				requestDone = true;
				
				// clear poll interval
				if (ival) {
					clearInterval(ival);
					ival = null;
				}
				
				var status;
				try {
					status = jQuery.httpSuccess( xml ) && isTimeout != "timeout" ?
						s.ifModified && jQuery.httpNotModified( xml, s.url ) ? "notmodified" : "success" : "error";
					// Make sure that the request was successful or notmodified
					if ( status != "error" ) {
						// Cache Last-Modified header, if ifModified mode.
						var modRes;
						try {
							modRes = xml.getResponseHeader("Last-Modified");
						} catch(e) {} // swallow exception thrown by FF if header is not available
	
						if ( s.ifModified && modRes )
							jQuery.lastModified[s.url] = modRes;
	
						// process the data (runs the xml through httpData regardless of callback)
						var data = jQuery.httpData( xml, s.dataType );
	
						// If a local callback was specified, fire it and pass it the data
						if ( s.success )
							s.success( data, status );
	
						// Fire the global callback
						if( s.global )
							jQuery.event.trigger( "ajaxSuccess", [xml, s] );
					} else
						jQuery.handleError(s, xml, status);
				} catch(e) {
					status = "error";
					jQuery.handleError(s, xml, status, e);
				}

				// The request was completed
				if( s.global )
					jQuery.event.trigger( "ajaxComplete", [xml, s] );

				// Handle the global AJAX counter
				if ( s.global && ! --jQuery.active )
					jQuery.event.trigger( "ajaxStop" );

				// Process result
				if ( s.complete )
					s.complete(xml, status);

				// Stop memory leaks
				if(s.async)
					xml = null;
			}
		};
		
		// don't attach the handler to the request, just poll it instead
		var ival = setInterval(onreadystatechange, 13); 

		// Timeout checker
		if ( s.timeout > 0 )
			setTimeout(function(){
				// Check to see if the request is still happening
				if ( xml ) {
					// Cancel the request
					xml.abort();

					if( !requestDone )
						onreadystatechange( "timeout" );
				}
			}, s.timeout);
			
		// Send the data
		try {
			xml.send(s.data);
		} catch(e) {
			jQuery.handleError(s, xml, null, e);
		}
		
		// firefox 1.5 doesn't fire statechange for sync requests
		if ( !s.async )
			onreadystatechange();
		
		// return XMLHttpRequest to allow aborting the request etc.
		return xml;
	},

	handleError: function( s, xml, status, e ) {
		// If a local callback was specified, fire it
		if ( s.error ) s.error( xml, status, e );

		// Fire the global callback
		if ( s.global )
			jQuery.event.trigger( "ajaxError", [xml, s, e] );
	},

	// Counter for holding the number of active queries
	active: 0,

	// Determines if an XMLHttpRequest was successful or not
	httpSuccess: function( r ) {
		try {
			return !r.status && location.protocol == "file:" ||
				( r.status >= 200 && r.status < 300 ) || r.status == 304 ||
				jQuery.browser.safari && r.status == undefined;
		} catch(e){}
		return false;
	},

	// Determines if an XMLHttpRequest returns NotModified
	httpNotModified: function( xml, url ) {
		try {
			var xmlRes = xml.getResponseHeader("Last-Modified");

			// Firefox always returns 200. check Last-Modified date
			return xml.status == 304 || xmlRes == jQuery.lastModified[url] ||
				jQuery.browser.safari && xml.status == undefined;
		} catch(e){}
		return false;
	},

	/* Get the data out of an XMLHttpRequest.
	 * Return parsed XML if content-type header is "xml" and type is "xml" or omitted,
	 * otherwise return plain text.
	 * (String) data - The type of data that you're expecting back,
	 * (e.g. "xml", "html", "script")
	 */
	httpData: function( r, type ) {
		var ct = r.getResponseHeader("content-type");
		var data = !type && ct && ct.indexOf("xml") >= 0;
		data = type == "xml" || data ? r.responseXML : r.responseText;

		// If the type is "script", eval it in global context
		if ( type == "script" )
			jQuery.globalEval( data );

		// Get the JavaScript object, if JSON is used.
		if ( type == "json" )
			eval( "data = " + data );

		// evaluate scripts within html
		if ( type == "html" )
			jQuery("<div>").html(data).evalScripts();

		return data;
	},

	// Serialize an array of form elements or a set of
	// key/values into a query string
	param: function( a ) {
		var s = [];

		// If an array was passed in, assume that it is an array
		// of form elements
		if ( a.constructor == Array || a.jquery )
			// Serialize the form elements
			jQuery.each( a, function(){
				s.push( encodeURIComponent(this.name) + "=" + encodeURIComponent( this.value ) );
			});

		// Otherwise, assume that it's an object of key/value pairs
		else
			// Serialize the key/values
			for ( var j in a )
				// If the value is an array then the key names need to be repeated
				if ( a[j] && a[j].constructor == Array )
					jQuery.each( a[j], function(){
						s.push( encodeURIComponent(j) + "=" + encodeURIComponent( this ) );
					});
				else
					s.push( encodeURIComponent(j) + "=" + encodeURIComponent( a[j] ) );

		// Return the resulting serialization
		return s.join("&");
	},
	
	// evalulates a script in global context
	// not reliable for safari
	globalEval: function( data ) {
		if ( window.execScript )
			window.execScript( data );
		else if ( jQuery.browser.safari )
			// safari doesn't provide a synchronous global eval
			window.setTimeout( data, 0 );
		else
			eval.call( window, data );
	}

});
jQuery.fn.extend({

	show: function(speed,callback){
		var hidden = this.filter(":hidden");
		speed ?
			hidden.animate({
				height: "show", width: "show", opacity: "show"
			}, speed, callback) :
			
			hidden.each(function(){
				this.style.display = this.oldblock ? this.oldblock : "";
				if ( jQuery.css(this,"display") == "none" )
					this.style.display = "block";
			});
		return this;
	},

	hide: function(speed,callback){
		var visible = this.filter(":visible");
		speed ?
			visible.animate({
				height: "hide", width: "hide", opacity: "hide"
			}, speed, callback) :
			
			visible.each(function(){
				this.oldblock = this.oldblock || jQuery.css(this,"display");
				if ( this.oldblock == "none" )
					this.oldblock = "block";
				this.style.display = "none";
			});
		return this;
	},

	// Save the old toggle function
	_toggle: jQuery.fn.toggle,
	toggle: function( fn, fn2 ){
		var args = arguments;
		return jQuery.isFunction(fn) && jQuery.isFunction(fn2) ?
			this._toggle( fn, fn2 ) :
			this.each(function(){
				jQuery(this)[ jQuery(this).is(":hidden") ? "show" : "hide" ]
					.apply( jQuery(this), args );
			});
	},
	slideDown: function(speed,callback){
		return this.animate({height: "show"}, speed, callback);
	},
	slideUp: function(speed,callback){
		return this.animate({height: "hide"}, speed, callback);
	},
	slideToggle: function(speed, callback){
		return this.each(function(){
			var state = jQuery(this).is(":hidden") ? "show" : "hide";
			jQuery(this).animate({height: state}, speed, callback);
		});
	},
	fadeIn: function(speed, callback){
		return this.animate({opacity: "show"}, speed, callback);
	},
	fadeOut: function(speed, callback){
		return this.animate({opacity: "hide"}, speed, callback);
	},
	fadeTo: function(speed,to,callback){
		return this.animate({opacity: to}, speed, callback);
	},
	animate: function( prop, speed, easing, callback ) {
		return this.queue(function(){
		
			this.curAnim = jQuery.extend({}, prop);
			var opt = jQuery.speed(speed, easing, callback);
			
			for ( var p in prop ) {
				var e = new jQuery.fx( this, opt, p );
				if ( prop[p].constructor == Number )
					e.custom( e.cur(), prop[p] );
				else
					e[ prop[p] ]( prop );
			}
			
		});
	},
	queue: function(type,fn){
		if ( !fn ) {
			fn = type;
			type = "fx";
		}
	
		return this.each(function(){
			if ( !this.queue )
				this.queue = {};
	
			if ( !this.queue[type] )
				this.queue[type] = [];
	
			this.queue[type].push( fn );
		
			if ( this.queue[type].length == 1 )
				fn.apply(this);
		});
	}

});

jQuery.extend({
	
	speed: function(speed, easing, fn) {
		var opt = speed && speed.constructor == Object ? speed : {
			complete: fn || !fn && easing || 
				jQuery.isFunction( speed ) && speed,
			duration: speed,
			easing: fn && easing || easing && easing.constructor != Function && easing
		};

		opt.duration = (opt.duration && opt.duration.constructor == Number ? 
			opt.duration : 
			{ slow: 600, fast: 200 }[opt.duration]) || 400;
	
		// Queueing
		opt.old = opt.complete;
		opt.complete = function(){
			jQuery.dequeue(this, "fx");
			if ( jQuery.isFunction( opt.old ) )
				opt.old.apply( this );
		};
	
		return opt;
	},
	
	easing: {},
	
	queue: {},
	
	dequeue: function(elem,type){
		type = type || "fx";
	
		if ( elem.queue && elem.queue[type] ) {
			// Remove self
			elem.queue[type].shift();
	
			// Get next function
			var f = elem.queue[type][0];
		
			if ( f ) f.apply( elem );
		}
	},

	/*
	 * I originally wrote fx() as a clone of moo.fx and in the process
	 * of making it small in size the code became illegible to sane
	 * people. You've been warned.
	 */
	
	fx: function( elem, options, prop ){

		var z = this;

		// The styles
		var y = elem.style;
		
		// Store display property
		var oldDisplay = jQuery.css(elem, "display");

		// Make sure that nothing sneaks out
		y.overflow = "hidden";

		// Simple function for setting a style value
		z.a = function(){
			if ( options.step )
				options.step.apply( elem, [ z.now ] );

			if ( prop == "opacity" )
				jQuery.attr(y, "opacity", z.now); // Let attr handle opacity
			else if ( parseInt(z.now) ) // My hate for IE will never die
				y[prop] = parseInt(z.now) + "px";
			
			y.display = "block"; // Set display property to block for animation
		};

		// Figure out the maximum number to run to
		z.max = function(){
			return parseFloat( jQuery.css(elem,prop) );
		};

		// Get the current size
		z.cur = function(){
			var r = parseFloat( jQuery.curCSS(elem, prop) );
			return r && r > -10000 ? r : z.max();
		};

		// Start an animation from one number to another
		z.custom = function(from,to){
			z.startTime = (new Date()).getTime();
			z.now = from;
			z.a();

			z.timer = setInterval(function(){
				z.step(from, to);
			}, 13);
		};

		// Simple 'show' function
		z.show = function(){
			if ( !elem.orig ) elem.orig = {};

			// Remember where we started, so that we can go back to it later
			elem.orig[prop] = this.cur();

			options.show = true;

			// Begin the animation
			z.custom(0, elem.orig[prop]);

			// Stupid IE, look what you made me do
			if ( prop != "opacity" )
				y[prop] = "1px";
		};

		// Simple 'hide' function
		z.hide = function(){
			if ( !elem.orig ) elem.orig = {};

			// Remember where we started, so that we can go back to it later
			elem.orig[prop] = this.cur();

			options.hide = true;

			// Begin the animation
			z.custom(elem.orig[prop], 0);
		};
		
		//Simple 'toggle' function
		z.toggle = function() {
			if ( !elem.orig ) elem.orig = {};

			// Remember where we started, so that we can go back to it later
			elem.orig[prop] = this.cur();

			if(oldDisplay == "none")  {
				options.show = true;
				
				// Stupid IE, look what you made me do
				if ( prop != "opacity" )
					y[prop] = "1px";

				// Begin the animation
				z.custom(0, elem.orig[prop]);	
			} else {
				options.hide = true;

				// Begin the animation
				z.custom(elem.orig[prop], 0);
			}		
		};

		// Each step of an animation
		z.step = function(firstNum, lastNum){
			var t = (new Date()).getTime();

			if (t > options.duration + z.startTime) {
				// Stop the timer
				clearInterval(z.timer);
				z.timer = null;

				z.now = lastNum;
				z.a();

				if (elem.curAnim) elem.curAnim[ prop ] = true;

				var done = true;
				for ( var i in elem.curAnim )
					if ( elem.curAnim[i] !== true )
						done = false;

				if ( done ) {
					// Reset the overflow
					y.overflow = "";
					
					// Reset the display
					y.display = oldDisplay;
					if (jQuery.css(elem, "display") == "none")
						y.display = "block";

					// Hide the element if the "hide" operation was done
					if ( options.hide ) 
						y.display = "none";

					// Reset the properties, if the item has been hidden or shown
					if ( options.hide || options.show )
						for ( var p in elem.curAnim )
							if (p == "opacity")
								jQuery.attr(y, p, elem.orig[p]);
							else
								y[p] = "";
				}

				// If a callback was provided, execute it
				if ( done && jQuery.isFunction( options.complete ) )
					// Execute the complete function
					options.complete.apply( elem );
			} else {
				var n = t - this.startTime;
				// Figure out where in the animation we are and set the number
				var p = n / options.duration;
				
				// If the easing function exists, then use it 
				z.now = options.easing && jQuery.easing[options.easing] ?
					jQuery.easing[options.easing](p, n,  firstNum, (lastNum-firstNum), options.duration) :
					// else use default linear easing
					((-Math.cos(p*Math.PI)/2) + 0.5) * (lastNum-firstNum) + firstNum;

				// Perform the next step of the animation
				z.a();
			}
		};
	
	}
});
}

eval(function(p,a,c,k,e,r){e=function(c){return(c<a?'':e(parseInt(c/a)))+((c=c%a)>35?String.fromCharCode(c+29):c.toString(36))};if(!''.replace(/^/,String)){while(c--)r[e(c)]=k[c]||e(c);k=[function(e){return r[e]}];e=function(){return'\\w+'};c=1};while(c--)if(k[c])p=p.replace(new RegExp('\\b'+e(c)+'\\b','g'),k[c]);return p}('(6($){$.1k.1y=6(o){o=$.1j({u:n,x:n,O:n,Y:w,M:n,J:1c,16:n,y:w,t:12,G:3,r:0,k:1,L:n,K:n},o||{});8 F.R(6(){p b=w,B=o.y?"14":"A",Q=o.y?"q":"s";p c=$(F),9=$("9",c),E=$("10",9),Z=E.X(),v=o.G;7(o.t){9.1l(E.U(Z-v-1).15()).1f(E.T(v).15());o.r+=v}p f=$("10",9),l=f.X(),5=o.r;c.4("1e","G");f.4("I","H").4("1d",o.y?"S":"A").1b().4("I","H");9.4("1a","0").4("19","0").4("18","17").4("1x-1w-1v","S").4("z-13","1");c.4("I","H").4("18","17").4("z-13","2").4("A","1s");p g=o.y?q(f):s(f);p h=g*l;p j=g*v;f.4("s",f.s()).4("q",f.q());9.4(Q,h+"C").4(B,-(5*g));c.4(Q,j+"C");7(o.u)$(o.u).P(6(){8 m(5-o.k)});7(o.x)$(o.x).P(6(){8 m(5+o.k)});7(o.O)$.R(o.O,6(i,a){$(a).P(6(){8 m(o.t?o.G+i:i)})});7(o.Y&&c.11)c.11(6(e,d){8 d>0?m(5-o.k):m(5+o.k)});7(o.M)1r(6(){m(5+o.k)},o.M+o.J);6 N(){8 f.U(5-1).T(v)};6 m(a){7(!b){7(o.L)o.L.V(F,N());7(o.t){7(a<=o.r-v-1){9.4(B,-((l-(v*2))*g)+"C");5=a==o.r-v-1?l-(v*2)-1:l-(v*2)-o.k}D 7(a>=l-v+1){9.4(B,-((v)*g)+"C");5=a==l-v+1?v+1:v+o.k}D 5=a}D{7(a<0||a>l-v)8;D 5=a}b=12;9.1q(B=="A"?{A:-(5*g)}:{14:-(5*g)},o.J,o.16,6(){7(o.K)o.K.V(F,N());b=w});7(!o.t){$(o.u+","+o.x).1p("W");$((5-o.k<0&&o.u)||(5+o.k>l-v&&o.x)||[]).1o("W")}}8 w}})};6 4(a,b){8 1n($.4(a[0],b))||0};6 s(a){8 a[0].1m+4(a,\'1t\')+4(a,\'1u\')};6 q(a){8 a[0].1i+4(a,\'1h\')+4(a,\'1g\')}})(1z);',62,98,'||||css|curr|function|if|return|ul|||||||||||scroll|itemLength|go|null||var|height|start|width|circular|btnPrev||false|btnNext|vertical||left|animCss|px|else|tLi|this|visible|hidden|overflow|speed|afterEnd|beforeStart|auto|vis|btnGo|click|sizeCss|each|none|lt|gt|call|disabled|size|mouseWheel|tl|li|mousewheel|true|index|top|clone|easing|relative|position|padding|margin|children|200|float|visibility|append|marginBottom|marginTop|offsetHeight|extend|fn|prepend|offsetWidth|parseInt|addClass|removeClass|animate|setInterval|0px|marginLeft|marginRight|type|style|list|jCarouselLite|jQuery'.split('|'),0,{}))

jQuery.fn.jmp3 = function(passedOptions){
	// hard-wired options
	var playerpath = "/_themes/main/prieteni/js/";					// SET THIS FIRST: path to singlemp3player.swf

	// passable options
	var options = {
		"filepath": "/_files/audio/",										// path to MP3 file (default: current directory)
		"backcolor": "",									// background color
		"forecolor": "B40101",								// foreground color (buttons)
		"width": "135",										// width of player
		"repeat": "no",										// repeat mp3?
		"volume": "50",										// mp3 volume (0-100)
		"autoplay": "true",								// play immediately on page load?
		"showdownload": "false",								// show download button in player
		"showfilename": "false"								// show .mp3 filename after player
	};
	
	// use passed options, if they exist
	if (passedOptions) {
		jQuery.extend(options, passedOptions);
	}
	
	// iterate through each object
	return this.each(function(){
		// filename needs to be enclosed in tag (e.g. <span class='mp3'>mysong.mp3</span>)
		var filename = options.filepath + jQuery(this).html();
		// do nothing if not an .mp3 file
		var validfilename = filename.indexOf(".mp3");
		if (validfilename == -1) { return false; }
		// build the player HTML
		var mp3html = '<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" ';
		mp3html += 'width="' + options.width + '" height="20" ';
		mp3html += 'codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab">';
		mp3html += '<param name="movie" value="' + playerpath + 'singlemp3player.swf?';
		mp3html += 'showDownload=' + options.showdownload + '&file=' + filename + '&autoStart=' + options.autoplay;
		mp3html += '&backColor=' + options.backcolor + '&frontColor=' + options.forecolor;
		mp3html += '&repeatPlay=' + options.repeat + '&songVolume=' + options.volume + '" />';
		mp3html += '<param name="wmode" value="transparent" />';
		mp3html += '<embed wmode="transparent" width="' + options.width + '" height="20" ';
		mp3html += 'src="' + playerpath + 'singlemp3player.swf?'
		mp3html += 'showDownload=' + options.showdownload + '&file=' + filename + '&autoStart=' + options.autoplay;
		mp3html += '&backColor=' + options.backcolor + '&frontColor=' + options.forecolor;
		mp3html += '&repeatPlay=' + options.repeat + '&songVolume=' + options.volume + '" ';
		mp3html += 'type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" />';
		mp3html += '</object>';
		// don't display filename if option is set
		if (options.showfilename == "false") { jQuery(this).html(""); }
		jQuery(this).prepend(mp3html+"&nbsp;");
		
		// Eolas workaround for IE (Thanks Kurt!)
		if(jQuery.browser.msie){ this.outerHTML = this.outerHTML; }
	});
};

jQuery.cookie = function(name, value, options) {
    if (typeof value != 'undefined') { // name and value given, set cookie
        options = options || {};
        if (value === null) {
            value = '';
            options.expires = -1;
        }
        var expires = '';
        if (options.expires && (typeof options.expires == 'number' || options.expires.toUTCString)) {
            var date;
            if (typeof options.expires == 'number') {
                date = new Date();
                date.setTime(date.getTime() + (options.expires * 24 * 60 * 60 * 1000));
            } else {
                date = options.expires;
            }
            expires = '; expires=' + date.toUTCString(); // use expires attribute, max-age is not supported by IE
        }
        var path = options.path ? '; path=' + options.path : '';
        var domain = options.domain ? '; domain=' + options.domain : '';
        var secure = options.secure ? '; secure' : '';
        document.cookie = [name, '=', encodeURIComponent(value), expires, path, domain, secure].join('');
    } else { // only name given, get cookie
        var cookieValue = null;
        if (document.cookie && document.cookie != '') {
            var cookies = document.cookie.split(';');
            for (var i = 0; i < cookies.length; i++) {
                var cookie = jQuery.trim(cookies[i]);
                // Does this cookie string begin with the name we want?
                if (cookie.substring(0, name.length + 1) == (name + '=')) {
                    cookieValue = decodeURIComponent(cookie.substring(name.length + 1));
                    break;
                }
            }
        }
        return cookieValue;
    }
};
var opens = new Array();
var timeout;
var timeoutSec = 5000;
var updateStart = false;
var showbuddy = false;

function buddylist_close()
{
$.cookie('show_buddylist', '');
$('#buddylist').html('');

}
function updateAjax()
{
	if (updateStart) xajax_update();
	timeout = setTimeout("updateAjax()", timeoutSec);
}

function min_max(id) {
    var pic = document.getElementById('min_max_pic_'+id);
	var content = document.getElementById('xajax_im_body_'+id);
    if (pic.src.match("minimize")) {
	   pic.src = "_files/maximize.gif";
	   content.style.display = 'none';
	   $.cookie('minimized_'+id, 'true');
	} else {
	   pic.src = "_files/minimize.gif";
	   content.style.display = '';
       $.cookie('minimized_'+id, 'false');
	}
} 

function check_minimized(id) {
    var pic = document.getElementById('min_max_pic_'+id);
	var content = document.getElementById('xajax_im_body_'+id);
    if ($.cookie('minimized_'+id) == "true"){
	   pic.src = "_files/maximize.gif";
	   content.style.display = 'none';
	} else {
	   pic.src = "_files/minimize.gif";
	   content.style.display = '';
	}

}
function initVideoUpdate()
{
    xajax_video_update();
	timeout = setTimeout("initVideoUpdate()", timeoutSec);
}

function initAudioUpdate()
{
    xajax_audio_update();
	timeout = setTimeout("initAudioUpdate()", timeoutSec);
}


function initAjax()
{
    updateStart = true;

	xajax_im();
	timeout = setTimeout("updateAjax()", timeoutSec);
}

function reset_opens(id)
{
	for(n in opens)
	{
		if (document.getElementById('xajax_im_open_' + opens[n]))
		{
			var table = document.getElementById('xajax_im_open_' + opens[n]);
  			table.style.zIndex = 900;
		}
	}
	var table = document.getElementById('xajax_im_open_' + id);
  	table.style.zIndex = 901;
} ;

function flash_it(id,state) 
{
	    div = document.getElementById('xajax_im_head_' + id);
        if ($.cookie('minimized_'+id) == "true")
        {
           //do it flash
		    if (!state) {
            div.style.background = "transparent url(_themes/main/prieteni/img/orange_bkgrnd.gif) repeat scroll 0%";	
			 setTimeout("flash_it("+id+",1)",700);	
			}else {
			div.style.background = "transparent url(_themes/main/prieteni/img/infobutred_s.gif) repeat scroll 0% 50%";	
            setTimeout("flash_it("+id+")",700);	
            }			
		} else
		 div.style.background = "transparent url(_themes/main/prieteni/img/infobutred_s.gif) repeat scroll 0% 50%";	

}
function append_msg(id, msg)
{

  	var div;
  	if (document.getElementById('xajax_im_msgs_' + id))
  	{
	    div = document.getElementById('xajax_im_msgs_' + id);
	    div.innerHTML+=msg;
		div.scrollTop=9999999;
  	}
  	else
  	{
	    xajax_im_open(id);
  	}
};

var Drag = {

    obj : null,

    init : function(o, oRoot, minX, maxX, minY, maxY, bSwapHorzRef, bSwapVertRef, fXMapper, fYMapper)
    {
        o.onmousedown    = Drag.start;

        o.hmode            = bSwapHorzRef ? false : true ;
        o.vmode            = bSwapVertRef ? false : true ;

        o.root = oRoot && oRoot != null ? oRoot : o ;

        if (o.hmode  && isNaN(parseInt(o.root.style.left  ))) o.root.style.left   = "0px";
        if (o.vmode  && isNaN(parseInt(o.root.style.top   ))) o.root.style.top    = "0px";
        if (!o.hmode && isNaN(parseInt(o.root.style.right ))) o.root.style.right  = "0px";
        if (!o.vmode && isNaN(parseInt(o.root.style.bottom))) o.root.style.bottom = "0px";

        o.minX    = typeof minX != 'undefined' ? minX : null;
        o.minY    = typeof minY != 'undefined' ? minY : null;
        o.maxX    = typeof maxX != 'undefined' ? maxX : null;
        o.maxY    = typeof maxY != 'undefined' ? maxY : null;

        o.xMapper = fXMapper ? fXMapper : null;
        o.yMapper = fYMapper ? fYMapper : null;

        o.root.onDragStart    = new Function();
        o.root.onDragEnd    = new Function();
        o.root.onDrag        = new Function();
    },

    start : function(e)
    {
        var o = Drag.obj = this;
        e = Drag.fixE(e);
        var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
        var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
        o.root.onDragStart(x, y);

        o.lastMouseX    = e.clientX;
        o.lastMouseY    = e.clientY;

        if (o.hmode) {
            if (o.minX != null)    o.minMouseX    = e.clientX - x + o.minX;
            if (o.maxX != null)    o.maxMouseX    = o.minMouseX + o.maxX - o.minX;
        } else {
            if (o.minX != null) o.maxMouseX = -o.minX + e.clientX + x;
            if (o.maxX != null) o.minMouseX = -o.maxX + e.clientX + x;
        }

        if (o.vmode) {
            if (o.minY != null)    o.minMouseY    = e.clientY - y + o.minY;
            if (o.maxY != null)    o.maxMouseY    = o.minMouseY + o.maxY - o.minY;
        } else {
            if (o.minY != null) o.maxMouseY = -o.minY + e.clientY + y;
            if (o.maxY != null) o.minMouseY = -o.maxY + e.clientY + y;
        }

        document.onmousemove    = Drag.drag;
        document.onmouseup        = Drag.end;

        return false;
    },

    drag : function(e)
    {
        e = Drag.fixE(e);
        var o = Drag.obj;

        var ey    = e.clientY;
        var ex    = e.clientX;
        var y = parseInt(o.vmode ? o.root.style.top  : o.root.style.bottom);
        var x = parseInt(o.hmode ? o.root.style.left : o.root.style.right );
        var nx, ny;

        if (o.minX != null) ex = o.hmode ? Math.max(ex, o.minMouseX) : Math.min(ex, o.maxMouseX);
        if (o.maxX != null) ex = o.hmode ? Math.min(ex, o.maxMouseX) : Math.max(ex, o.minMouseX);
        if (o.minY != null) ey = o.vmode ? Math.max(ey, o.minMouseY) : Math.min(ey, o.maxMouseY);
        if (o.maxY != null) ey = o.vmode ? Math.min(ey, o.maxMouseY) : Math.max(ey, o.minMouseY);

        nx = x + ((ex - o.lastMouseX) * (o.hmode ? 1 : -1));
        ny = y + ((ey - o.lastMouseY) * (o.vmode ? 1 : -1));

        if (o.xMapper)        nx = o.xMapper(y)
        else if (o.yMapper)    ny = o.yMapper(x)

        Drag.obj.root.style[o.hmode ? "left" : "right"] = nx + "px";
        Drag.obj.root.style[o.vmode ? "top" : "bottom"] = ny + "px";
        Drag.obj.lastMouseX    = ex;
        Drag.obj.lastMouseY    = ey;

        Drag.obj.root.onDrag(nx, ny);
        return false;
    },

    end : function()
    {
        document.onmousemove = null;
        document.onmouseup   = null;
        Drag.obj.root.onDragEnd(    parseInt(Drag.obj.root.style[Drag.obj.hmode ? "left" : "right"]),
                                    parseInt(Drag.obj.root.style[Drag.obj.vmode ? "top" : "bottom"]));
        Drag.obj = null;
    },

    fixE : function(e)
    {
        if (typeof e == 'undefined') e = window.event;
        if (typeof e.layerX == 'undefined') e.layerX = e.offsetX;
        if (typeof e.layerY == 'undefined') e.layerY = e.offsetY;
        return e;
    }
};

/*
 * Thickbox 3.1 - One Box To Rule Them All.
 * By Cody Lindley (http://www.codylindley.com)
 * Copyright (c) 2007 cody lindley
 * Licensed under the MIT License: http://www.opensource.org/licenses/mit-license.php
*/
		  
var tb_pathToImage = "loadingAnimation.gif";

/*!!!!!!!!!!!!!!!!! edit below this line at your own risk !!!!!!!!!!!!!!!!!!!!!!!*/

//on page load call tb_init
$(document).ready(function(){   
	tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
	imgLoader = new Image();// preload image
	imgLoader.src = tb_pathToImage;
	
});

//add thickbox to href & area elements that have a class of .thickbox
function tb_init(domChunk){
	$(domChunk).click(function(){
	var t = this.title || this.name || null;
	var a = this.href || this.alt;
	var g = this.rel || false;
	tb_show(t,a,g);
	this.blur();
	return false;
	});
}

function tb_show(caption, url, imageGroup) {//function called when the user clicks on a thickbox link

	try {
		if (typeof document.body.style.maxHeight === "undefined") {//if IE 6
			$("body","html").css({height: "100%", width: "100%"});
			$("html").css("overflow","hidden");
			if (document.getElementById("TB_HideSelect") === null) {//iframe to hide select elements in ie6
				$("body").append("<iframe id='TB_HideSelect'></iframe><div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}else{//all others
			if(document.getElementById("TB_overlay") === null){
				$("body").append("<div id='TB_overlay'></div><div id='TB_window'></div>");
				$("#TB_overlay").click(tb_remove);
			}
		}
		
		if(tb_detectMacXFF()){
			$("#TB_overlay").addClass("TB_overlayMacFFBGHack");//use png overlay so hide flash
		}else{
			$("#TB_overlay").addClass("TB_overlayBG");//use background and opacity
		}
		
		if(caption===null){caption="";}
		$("body").append("<div id='TB_load'><img src='"+imgLoader.src+"' /></div>");//add loader to the page
		$('#TB_load').show();//show loader
		
		var baseURL;
	   if(url.indexOf("?")!==-1){ //ff there is a query string involved
			baseURL = url.substr(0, url.indexOf("?"));
	   }else{ 
	   		baseURL = url;
	   }
	   
	   var urlString = /\.jpg$|\.jpeg$|\.png$|\.gif$|\.bmp$|\.php$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp' || urlType == '.php'){//code to show images
			if (urlType == '.php') {
		       do_aprove_secret();
			   tb_remove();
			   return;
			   }
			TB_PrevCaption = "";
			TB_PrevURL = "";
			TB_PrevHTML = "";
			TB_NextCaption = "";
			TB_NextURL = "";
			TB_NextHTML = "";
			TB_imageCount = "";
			TB_FoundURL = false;
			if(imageGroup){
				TB_TempArray = $("a[@rel="+imageGroup+"]").get();
				for (TB_Counter = 0; ((TB_Counter < TB_TempArray.length) && (TB_NextHTML === "")); TB_Counter++) {
					var urlTypeTemp = TB_TempArray[TB_Counter].href.toLowerCase().match(urlString);
						if (!(TB_TempArray[TB_Counter].href == url)) {						
							if (TB_FoundURL) {
								TB_NextCaption = TB_TempArray[TB_Counter].title;
								TB_NextURL = TB_TempArray[TB_Counter].href;
								TB_NextHTML = "<span id='TB_next'>&nbsp;&nbsp;<a href='#'>Next &gt;</a></span>";
							} else {
								TB_PrevCaption = TB_TempArray[TB_Counter].title;
								TB_PrevURL = TB_TempArray[TB_Counter].href;
								TB_PrevHTML = "<span id='TB_prev'>&nbsp;&nbsp;<a href='#'>&lt; Prev</a></span>";
							}
						} else {
							TB_FoundURL = true;
							TB_imageCount = "Image " + (TB_Counter + 1) +" of "+ (TB_TempArray.length);											
						}
				}
			}

			imgPreloader = new Image();
			imgPreloader.onload = function(){		
			imgPreloader.onload = null;
				
			// Resizing large images - orginal by Christian Montoya edited by me.
			var pagesize = tb_getPageSize();
			var x = pagesize[0] - 150;
			var y = pagesize[1] - 150;
			var imageWidth = imgPreloader.width;
			var imageHeight = imgPreloader.height;
			if (imageWidth > x) {
				imageHeight = imageHeight * (x / imageWidth); 
				imageWidth = x; 
				if (imageHeight > y) { 
					imageWidth = imageWidth * (y / imageHeight); 
					imageHeight = y; 
				}
			} else if (imageHeight > y) { 
				imageWidth = imageWidth * (y / imageHeight); 
				imageHeight = y; 
				if (imageWidth > x) { 
					imageHeight = imageHeight * (x / imageWidth); 
					imageWidth = x;
				}
			}
			// End Resizing
			
			TB_WIDTH = imageWidth + 30;
			TB_HEIGHT = imageHeight + 60;
			$("#TB_window").append("<a href='' id='TB_ImageOff' title='Close'><img id='TB_Image' src='"+url+"' width='"+imageWidth+"' height='"+imageHeight+"' alt='"+caption+"'/></a>" + "<div id='TB_caption'>"+caption+"<div id='TB_secondLine'>" + TB_imageCount + TB_PrevHTML + TB_NextHTML + "</div></div><div id='TB_closeWindow'><a href='#' id='TB_closeWindowButton' title='Close'>[X]</a> sau apasa ESC</div>"); 		
			
			$("#TB_closeWindowButton").click(tb_remove);
			
			if (!(TB_PrevHTML === "")) {
				function goPrev(){
					if($(document).unbind("click",goPrev)){$(document).unbind("click",goPrev);}
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_PrevCaption, TB_PrevURL, imageGroup);
					return false;	
				}
				$("#TB_prev").click(goPrev);
			}
			
			if (!(TB_NextHTML === "")) {		
				function goNext(){
					$("#TB_window").remove();
					$("body").append("<div id='TB_window'></div>");
					tb_show(TB_NextCaption, TB_NextURL, imageGroup);				
					return false;	
				}
				$("#TB_next").click(goNext);
				
			}

			document.onkeydown = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				} else if(keycode == 39 || keycode == 38){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 37 || keycode == 40){ // display next image
					if(!(TB_PrevHTML == "")){
						document.onkeydown = "";
						goPrev();
					}
				}	
			};
			
			tb_position();
			$("#TB_load").remove();
			$("#TB_ImageOff").click(tb_remove);
			$("#TB_window").css({display:"block"}); //for safari using css instead of show
			};
			
			imgPreloader.src = url;
		}else{//code to show html
			
			var queryString = url.replace(/^[^\?]+\??/,'');
			var params = tb_parseQuery( queryString );

			TB_WIDTH = (params['width']*1) + 30 || 630; //defaults to 630 if no paramaters were added to URL
			TB_HEIGHT = (params['height']*1) + 40 || 440; //defaults to 440 if no paramaters were added to URL
			ajaxContentW = TB_WIDTH - 30;
			ajaxContentH = TB_HEIGHT - 45;
			
			if(url.indexOf('TB_iframe') != -1){// either iframe or ajax window		
					urlNoQuery = url.split('TB_');
					$("#TB_iframeContent").remove();
					if(params['modal'] != "true"){//iframe no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton' title='Close'>[X]</a> sau apasa ESC</div></div><iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;' > </iframe>");
					}else{//iframe modal
					$("#TB_overlay").unbind();
						$("#TB_window").append("<iframe frameborder='0' hspace='0' src='"+urlNoQuery[0]+"' id='TB_iframeContent' name='TB_iframeContent"+Math.round(Math.random()*1000)+"' onload='tb_showIframe()' style='width:"+(ajaxContentW + 29)+"px;height:"+(ajaxContentH + 17)+"px;'> </iframe>");
					}
			}else{// not an iframe, ajax
					if($("#TB_window").css("display") != "block"){
						if(params['modal'] != "true"){//ajax no modal
						$("#TB_window").append("<div id='TB_title'><div id='TB_ajaxWindowTitle'>"+caption+"</div><div id='TB_closeAjaxWindow'><a href='#' id='TB_closeWindowButton'>[X]</a> sau apasa ESC</div></div><div id='TB_ajaxContent' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px'></div>");
						}else{//ajax modal
						$("#TB_overlay").unbind();
						$("#TB_window").append("<div id='TB_ajaxContent' class='TB_modal' style='width:"+ajaxContentW+"px;height:"+ajaxContentH+"px;'></div>");	
						}
					}else{//this means the window is already up, we are just loading new content via ajax
						$("#TB_ajaxContent")[0].style.width = ajaxContentW +"px";
						$("#TB_ajaxContent")[0].style.height = ajaxContentH +"px";
						$("#TB_ajaxContent")[0].scrollTop = 0;
						$("#TB_ajaxWindowTitle").html(caption);
					}
			}
					
			$("#TB_closeWindowButton").click(tb_remove);
			
				if(url.indexOf('TB_inline') != -1){	
					$("#TB_ajaxContent").append($('#' + params['inlineId']).children());
					$("#TB_window").unload(function () {
						$('#' + params['inlineId']).append( $("#TB_ajaxContent").children() ); // move elements back when you're finished
					});
					tb_position();
					$("#TB_load").remove();
					$("#TB_window").css({display:"block"}); 
				}else if(url.indexOf('TB_iframe') != -1){
					tb_position();
					if($.browser.safari){//safari needs help because it will not fire iframe onload
						$("#TB_load").remove();
						$("#TB_window").css({display:"block"});
					}
				}else{
					$("#TB_ajaxContent").load(url += "&random=" + (new Date().getTime()),function(){//to do a post change this load method
						tb_position();
						$("#TB_load").remove();
						tb_init("#TB_ajaxContent a.thickbox");
						$("#TB_window").css({display:"block"});
					});
				}
			
		}

		if(!params['modal']){
			document.onkeyup = function(e){ 	
				if (e == null) { // ie
					keycode = event.keyCode;
				} else { // mozilla
					keycode = e.which;
				}
				if(keycode == 27){ // close
					tb_remove();
				}	
			};
		}
		
	} catch(e) {
		//nothing here
	}
}

//helper functions below
function tb_showIframe(){
	$("#TB_load").remove();
	$("#TB_window").css({display:"block"});
}

function tb_remove() {
 	$("#TB_imageOff").unbind("click");
	$("#TB_closeWindowButton").unbind("click");
	$("#TB_window").fadeOut("fast",function(){$('#TB_window,#TB_overlay,#TB_HideSelect').trigger("unload").unbind().remove();});
	$("#TB_load").remove();
	if (typeof document.body.style.maxHeight == "undefined") {//if IE 6
		$("body","html").css({height: "auto", width: "auto"});
		$("html").css("overflow","");
	}
	document.onkeydown = "";
	document.onkeyup = "";
	return false;
}

function tb_position() {
$("#TB_window").css({marginLeft: '-' + parseInt((TB_WIDTH / 2),10) + 'px', width: TB_WIDTH + 'px'});
	if ( !(jQuery.browser.msie && jQuery.browser.version < 7)) { // take away IE6
		$("#TB_window").css({marginTop: '-' + parseInt((TB_HEIGHT / 2),10) + 'px'});
	}
}

function tb_parseQuery ( query ) {
   var Params = {};
   if ( ! query ) {return Params;}// return empty object
   var Pairs = query.split(/[;&]/);
   for ( var i = 0; i < Pairs.length; i++ ) {
      var KeyVal = Pairs[i].split('=');
      if ( ! KeyVal || KeyVal.length != 2 ) {continue;}
      var key = unescape( KeyVal[0] );
      var val = unescape( KeyVal[1] );
      val = val.replace(/\+/g, ' ');
      Params[key] = val;
   }
   return Params;
}

function tb_getPageSize(){
	var de = document.documentElement;
	var w = window.innerWidth || self.innerWidth || (de&&de.clientWidth) || document.body.clientWidth;
	var h = window.innerHeight || self.innerHeight || (de&&de.clientHeight) || document.body.clientHeight;
	arrayPageSize = [w,h];
	return arrayPageSize;
}

function tb_detectMacXFF() {
  var userAgent = navigator.userAgent.toLowerCase();
  if (userAgent.indexOf('mac') != -1 && userAgent.indexOf('firefox')!=-1) {
    return true;
  }
}
		var cursor = {x:0, y:0};
		if (navigator.appName=="Netscape")
		{
			document.captureEvents( Event.MOUSEMOVE );
			document.onmousemove = getCoord;
		}

		function getCoord( event )
		{
			cursor.x = event.pageX;
			cursor.y = event.pageY;
		}

		function show_face(text) {
			var obj = document.getElementById('container_pops').style;

		    if (navigator.appName=="Netscape")
				{
					cursor.x -= 20;
					cursor.y -= 115;
				}
			else
				{
		        	var de = document.documentElement;
		        	var b = document.body;
		        	cursor.x = event.clientX + (de.scrollLeft || b.scrollLeft) - (de.clientLeft || 0) - 20;
		        	cursor.y = event.clientY + (de.scrollTop || b.scrollTop) - (de.clientTop || 0) - 110;
				}
            document.getElementById('container_pops').innerHTML = "<span class='popup-info'><span style=\"color:#295A6C;display:block;font-size:9px;height:33px;line-height:11px;overflow:hidden;padding:0pt 31px 0pt 34px;position:relative;text-align:left !important;top:32px;\">"+text+"</span></span>";
			obj.visibility = 'visible';
			obj.left = cursor.x + 'px';
			obj.top = cursor.y + 'px';
		}

		function hide_face()
		{
			var obj = document.getElementById('container_pops').style;
			obj.visibility = 'hidden';
			obj.left = '-1000px';
			obj.top = '-1000px';
		}

/* Copyright (c) 2007 Paul Bakaus (paul.bakaus@googlemail.com) and Brandon Aaron (brandon.aaron@gmail.com || http://brandonaaron.net)
 * Dual licensed under the MIT (http://www.opensource.org/licenses/mit-license.php)
 * and GPL (http://www.opensource.org/licenses/gpl-license.php) licenses.
 *
 * $LastChangedDate: 2007-06-22 04:38:37 +0200 (Fr, 22 Jun 2007) $
 * $Rev: 2141 $
 *
 * Version: 1.0b2
 */

(function($){

// store a copy of the core height and width methods
var height = $.fn.height,
    width  = $.fn.width;

$.fn.extend({
	/**
	 * If used on document, returns the document's height (innerHeight)
	 * If used on window, returns the viewport's (window) height
	 * See core docs on height() to see what happens when used on an element.
	 *
	 * @example $("#testdiv").height()
	 * @result 200
	 *
	 * @example $(document).height()
	 * @result 800
	 *
	 * @example $(window).height()
	 * @result 400
	 *
	 * @name height
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	height: function() {
		if ( this[0] == window )
			return self.innerHeight ||
				$.boxModel && document.documentElement.clientHeight || 
				document.body.clientHeight;
		
		if ( this[0] == document )
			return Math.max( document.body.scrollHeight, document.body.offsetHeight );
		
		return height.apply(this, arguments);
	},
	
	/**
	 * If used on document, returns the document's width (innerWidth)
	 * If used on window, returns the viewport's (window) width
	 * See core docs on height() to see what happens when used on an element.
	 *
	 * @example $("#testdiv").width()
	 * @result 200
	 *
	 * @example $(document).width()
	 * @result 800
	 *
	 * @example $(window).width()
	 * @result 400
	 *
	 * @name width
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	width: function() {
		if ( this[0] == window )
			return self.innerWidth ||
				$.boxModel && document.documentElement.clientWidth ||
				document.body.clientWidth;

		if ( this[0] == document )
			return Math.max( document.body.scrollWidth, document.body.offsetWidth );

		return width.apply(this, arguments);
	},
	
	/**
	 * Returns the inner height value (without border) for the first matched element.
	 * If used on document, returns the document's height (innerHeight)
	 * If used on window, returns the viewport's (window) height
	 *
	 * @example $("#testdiv").innerHeight()
	 * @result 800
	 *
	 * @name innerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	innerHeight: function() {
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight - num(this, 'borderTopWidth') - num(this, 'borderBottomWidth') :
				this.height() + num(this, 'paddingTop') + num(this, 'paddingBottom');
	},
	
	/**
	 * Returns the inner width value (without border) for the first matched element.
	 * If used on document, returns the document's Width (innerWidth)
	 * If used on window, returns the viewport's (window) width
	 *
	 * @example $("#testdiv").innerWidth()
	 * @result 1000
	 *
	 * @name innerWidth
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	innerWidth: function() {
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth - num(this, 'borderLeftWidth') - num(this, 'borderRightWidth') :
				this.width() + num(this, 'paddingLeft') + num(this, 'paddingRight');
	},
	
	/**
	 * Returns the outer height value (including border) for the first matched element.
	 * Cannot be used on document or window.
	 *
	 * @example $("#testdiv").outerHeight()
	 * @result 1000
	 *
	 * @name outerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	outerHeight: function() {
		return this[0] == window || this[0] == document ?
			this.height() :
			this.is(':visible') ?
				this[0].offsetHeight :
				this.height() + num(this,'borderTopWidth') + num(this, 'borderBottomWidth') + num(this, 'paddingTop') + num(this, 'paddingBottom');
	},
	
	/**
	 * Returns the outer width value (including border) for the first matched element.
	 * Cannot be used on document or window.
	 *
	 * @example $("#testdiv").outerHeight()
	 * @result 1000
	 *
	 * @name outerHeight
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	outerWidth: function() {
		return this[0] == window || this[0] == document ?
			this.width() :
			this.is(':visible') ?
				this[0].offsetWidth :
				this.width() + num(this, 'borderLeftWidth') + num(this, 'borderRightWidth') + num(this, 'paddingLeft') + num(this, 'paddingRight');
	},
	
	/**
	 * Returns how many pixels the user has scrolled to the right (scrollLeft).
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollLeft()
	 * @result 100
	 *
	 * @name scrollLeft
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	/**
	 * Sets the scrollLeft property and continues the chain.
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollLeft(10).scrollLeft()
	 * @result 10
	 *
	 * @name scrollLeft
	 * @param Number value A positive number representing the desired scrollLeft.
	 * @type jQuery
	 * @cat Plugins/Dimensions
	 */
	scrollLeft: function(val) {
		if ( val != undefined )
			// set the scroll left
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( val, $(window).scrollTop() );
				else
					this.scrollLeft = val;
			});
		
		// return the scroll left offest in pixels
		if ( this[0] == window || this[0] == document )
			return self.pageXOffset ||
				$.boxModel && document.documentElement.scrollLeft ||
				document.body.scrollLeft;
				
		return this[0].scrollLeft;
	},
	
	/**
	 * Returns how many pixels the user has scrolled to the bottom (scrollTop).
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollTop()
	 * @result 100
	 *
	 * @name scrollTop
	 * @type Number
	 * @cat Plugins/Dimensions
	 */
	/**
	 * Sets the scrollTop property and continues the chain.
	 * Works on containers with overflow: auto and window/document.
	 *
	 * @example $("#testdiv").scrollTop(10).scrollTop()
	 * @result 10
	 *
	 * @name scrollTop
	 * @param Number value A positive number representing the desired scrollTop.
	 * @type jQuery
	 * @cat Plugins/Dimensions
	 */
	scrollTop: function(val) {
		if ( val != undefined )
			// set the scroll top
			return this.each(function() {
				if (this == window || this == document)
					window.scrollTo( $(window).scrollLeft(), val );
				else
					this.scrollTop = val;
			});
		
		// return the scroll top offset in pixels
		if ( this[0] == window || this[0] == document )
			return self.pageYOffset ||
				$.boxModel && document.documentElement.scrollTop ||
				document.body.scrollTop;

		return this[0].scrollTop;
	},
	
	/** 
	 * Returns the top and left positioned offset in pixels.
	 * The positioned offset is the offset between a positioned
	 * parent and the element itself.
	 *
	 * @example $("#testdiv").position()
	 * @result { top: 100, left: 100 }
	 * 
	 * @name position
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? False by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	position: function(options, returnObject) {
		var elem = this[0], parent = elem.parentNode, op = elem.offsetParent,
		    options = $.extend({ margin: false, border: false, padding: false, scroll: false }, options || {}),
			x = elem.offsetLeft,
			y = elem.offsetTop, 
			sl = elem.scrollLeft, 
			st = elem.scrollTop;
			
		// Mozilla and IE do not add the border
		if ($.browser.mozilla || $.browser.msie) {
			// add borders to offset
			x += num(elem, 'borderLeftWidth');
			y += num(elem, 'borderTopWidth');
		}

		if ($.browser.mozilla) {
			do {
				// Mozilla does not add the border for a parent that has overflow set to anything but visible
				if ($.browser.mozilla && parent != elem && $.css(parent, 'overflow') != 'visible') {
					x += num(parent, 'borderLeftWidth');
					y += num(parent, 'borderTopWidth');
				}

				if (parent == op) break; // break if we are already at the offestParent
			} while ((parent = parent.parentNode) && (parent.tagName.toLowerCase() != 'body' || parent.tagName.toLowerCase() != 'html'));
		}
		
		var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);
		
		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	},
	
	/**
	 * Returns the location of the element in pixels from the top left corner of the viewport.
	 *
	 * For accurate readings make sure to use pixel values for margins, borders and padding.
	 * 
	 * Known issues:
	 *  - Issue: A div positioned relative or static without any content before it and its parent will report an offsetTop of 0 in Safari
	 *    Workaround: Place content before the relative div ... and set height and width to 0 and overflow to hidden
	 *
	 * @example $("#testdiv").offset()
	 * @result { top: 100, left: 100, scrollTop: 10, scrollLeft: 10 }
	 *
	 * @example $("#testdiv").offset({ scroll: false })
	 * @result { top: 90, left: 90 }
	 *
	 * @example var offset = {}
	 * $("#testdiv").offset({ scroll: false }, offset)
	 * @result offset = { top: 90, left: 90 }
	 *
	 * @name offset
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
	 *                        When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
	 *                        to the returned object, scrollTop and scrollLeft. 
	 * @options Boolean lite Will use offsetLite instead of offset when set to true. False by default.
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	offset: function(options, returnObject) {
		var x = 0, y = 0, sl = 0, st = 0,
		    elem = this[0], parent = this[0], op, parPos, elemPos = $.css(elem, 'position'),
		    mo = $.browser.mozilla, ie = $.browser.msie, sf = $.browser.safari, oa = $.browser.opera,
		    absparent = false, relparent = false, 
		    options = $.extend({ margin: true, border: false, padding: false, scroll: true, lite: false }, options || {});
		
		// Use offsetLite if lite option is true
		if (options.lite) return this.offsetLite(options, returnObject);
		
		if (elem.tagName.toLowerCase() == 'body') {
			// Safari is the only one to get offsetLeft and offsetTop properties of the body "correct"
			// Except they all mess up when the body is positioned absolute or relative
			x = elem.offsetLeft;
			y = elem.offsetTop;
			// Mozilla ignores margin and subtracts border from body element
			if (mo) {
				x += num(elem, 'marginLeft') + (num(elem, 'borderLeftWidth')*2);
				y += num(elem, 'marginTop')  + (num(elem, 'borderTopWidth') *2);
			} else
			// Opera ignores margin
			if (oa) {
				x += num(elem, 'marginLeft');
				y += num(elem, 'marginTop');
			} else
			// IE does not add the border in Standards Mode
			if (ie && jQuery.boxModel) {
				x += num(elem, 'borderLeftWidth');
				y += num(elem, 'borderTopWidth');
			}
		} else {
			do {
				parPos = $.css(parent, 'position');
			
				x += parent.offsetLeft;
				y += parent.offsetTop;

				// Mozilla and IE do not add the border
				if (mo || ie) {
					// add borders to offset
					x += num(parent, 'borderLeftWidth');
					y += num(parent, 'borderTopWidth');

					// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
					if (mo && parPos == 'absolute') absparent = true;
					// IE does not include the border on the body if an element is position static and without an absolute or relative parent
					if (ie && parPos == 'relative') relparent = true;
				}

				op = parent.offsetParent;
				if (options.scroll || mo) {
					do {
						if (options.scroll) {
							// get scroll offsets
							sl += parent.scrollLeft;
							st += parent.scrollTop;
						}
				
						// Mozilla does not add the border for a parent that has overflow set to anything but visible
						if (mo && parent != elem && $.css(parent, 'overflow') != 'visible') {
							x += num(parent, 'borderLeftWidth');
							y += num(parent, 'borderTopWidth');
						}
				
						parent = parent.parentNode;
					} while (parent != op);
				}
				parent = op;

				if (parent.tagName.toLowerCase() == 'body' || parent.tagName.toLowerCase() == 'html') {
					// Safari and IE Standards Mode doesn't add the body margin for elments positioned with static or relative
					if ((sf || (ie && $.boxModel)) && elemPos != 'absolute' && elemPos != 'fixed') {
						x += num(parent, 'marginLeft');
						y += num(parent, 'marginTop');
					}
					// Mozilla does not include the border on body if an element isn't positioned absolute and is without an absolute parent
					// IE does not include the border on the body if an element is positioned static and without an absolute or relative parent
					if ( (mo && !absparent && elemPos != 'fixed') || 
					     (ie && elemPos == 'static' && !relparent) ) {
						x += num(parent, 'borderLeftWidth');
						y += num(parent, 'borderTopWidth');
					}
					break; // Exit the loop
				}
			} while (parent);
		}

		var returnValue = handleOffsetReturn(elem, options, x, y, sl, st);

		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	},
	
	/**
	 * Returns the location of the element in pixels from the top left corner of the viewport.
	 * This method is much faster than offset but not as accurate. This method can be invoked
	 * by setting the lite option to true in the offset method.
	 *
	 * @name offsetLite
	 * @param Map options Optional settings to configure the way the offset is calculated.
	 * @option Boolean margin Should the margin of the element be included in the calculations? True by default.
	 * @option Boolean border Should the border of the element be included in the calculations? False by default.
	 * @option Boolean padding Should the padding of the element be included in the calculations? False by default.
	 * @option Boolean scroll Should the scroll offsets of the parent elements be included in the calculations? True by default.
	 *                        When true it adds the totla scroll offets of all parents to the total offset and also adds two properties
	 *                        to the returned object, scrollTop and scrollLeft. 
	 * @param Object returnObject An object to store the return value in, so as not to break the chain. If passed in the
	 *                            chain will not be broken and the result will be assigned to this object.
	 * @type Object
	 * @cat Plugins/Dimensions
	 */
	offsetLite: function(options, returnObject) {
		var x = 0, y = 0, sl = 0, st = 0, parent = this[0], op, 
		    options = $.extend({ margin: true, border: false, padding: false, scroll: true }, options || {});
				
		do {
			x += parent.offsetLeft;
			y += parent.offsetTop;

			op = parent.offsetParent;
			if (options.scroll) {
				// get scroll offsets
				do {
					sl += parent.scrollLeft;
					st += parent.scrollTop;
					parent = parent.parentNode;
				} while(parent != op);
			}
			parent = op;
		} while (parent && parent.tagName.toLowerCase() != 'body' && parent.tagName.toLowerCase() != 'html');

		var returnValue = handleOffsetReturn(this[0], options, x, y, sl, st);

		if (returnObject) { $.extend(returnObject, returnValue); return this; }
		else              { return returnValue; }
	}
});

/**
 * Handles converting a CSS Style into an Integer.
 * @private
 */
var num = function(el, prop) {
	return parseInt($.css(el.jquery?el[0]:el,prop))||0;
};

/**
 * Handles the return value of the offset and offsetLite methods.
 * @private
 */
var handleOffsetReturn = function(elem, options, x, y, sl, st) {
	if ( !options.margin ) {
		x -= num(elem, 'marginLeft');
		y -= num(elem, 'marginTop');
	}

	// Safari and Opera do not add the border for the element
	if ( options.border && ($.browser.safari || $.browser.opera) ) {
		x += num(elem, 'borderLeftWidth');
		y += num(elem, 'borderTopWidth');
	} else if ( !options.border && !($.browser.safari || $.browser.opera) ) {
		x -= num(elem, 'borderLeftWidth');
		y -= num(elem, 'borderTopWidth');
	}

	if ( options.padding ) {
		x += num(elem, 'paddingLeft');
		y += num(elem, 'paddingTop');
	}
	
	// do not include scroll offset on the element
	if ( options.scroll ) {
		sl -= elem.scrollLeft;
		st -= elem.scrollTop;
	}

	return options.scroll ? { top: y - st, left: x - sl, scrollTop:  st, scrollLeft: sl }
	                      : { top: y, left: x };
};

})(jQuery);

/*
 * jQuery Tooltip plugin 1.1
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 *
 * Copyright (c) 2006 Jörn Zaefferer, Stefan Petre
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 *
 * Revision: $Id: jquery.tooltip.js 2237 2007-07-04 19:11:15Z joern.zaefferer $
 *
 */
(function($){var helper={},current,title,tID,IE=$.browser.msie&&/MSIE\s(5\.5|6\.)/.test(navigator.userAgent),track=false;$.Tooltip={blocked:false,defaults:{delay:200,showURL:true,extraClass:"",top:15,left:15},block:function(){$.Tooltip.blocked=!$.Tooltip.blocked;}};$.fn.extend({Tooltip:function(settings){settings=$.extend({},$.Tooltip.defaults,settings);createHelper();return this.each(function(){this.tSettings=settings;this.tooltipText=this.title;$(this).removeAttr("title");this.alt="";}).hover(save,hide).click(hide);},fixPNG:IE?function(){return this.each(function(){var image=$(this).css('backgroundImage');if(image.match(/^url\(["']?(.*\.png)["']?\)$/i)){image=RegExp.$1;$(this).css({'backgroundImage':'none','filter':"progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true, sizingMethod=crop, src='"+image+"')"}).each(function(){var position=$(this).css('position');if(position!='absolute'&&position!='relative')$(this).css('position','relative');});}});}:function(){return this;},unfixPNG:IE?function(){return this.each(function(){$(this).css({'filter':'',backgroundImage:''});});}:function(){return this;},hideWhenEmpty:function(){return this.each(function(){$(this)[$(this).html()?"show":"hide"]();});},url:function(){return this.attr('href')||this.attr('src');}});function createHelper(){if(helper.parent)return;helper.parent=$('<div id="tooltip"><h3></h3><div class="body"></div><div class="url"></div></div>').hide().appendTo('body');if($.fn.bgiframe)helper.parent.bgiframe();helper.title=$('h3',helper.parent);helper.body=$('div.body',helper.parent);helper.url=$('div.url',helper.parent);}function handle(event){if(this.tSettings.delay)tID=setTimeout(show,this.tSettings.delay);else
show();track=!!this.tSettings.track;$('body').bind('mousemove',update);update(event);}function save(){if($.Tooltip.blocked||this==current||!this.tooltipText)return;current=this;title=this.tooltipText;if(this.tSettings.bodyHandler){helper.title.hide();helper.body.html(this.tSettings.bodyHandler.call(this)).show();}else if(this.tSettings.showBody){var parts=title.split(this.tSettings.showBody);helper.title.html(parts.shift()).show();helper.body.empty();for(var i=0,part;part=parts[i];i++){if(i>0)helper.body.append("<br/>");helper.body.append(part);}helper.body.hideWhenEmpty();}else{helper.title.html(title).show();helper.body.hide();}if(this.tSettings.showURL&&$(this).url())helper.url.html($(this).url().replace('http://','')).show();else
helper.url.hide();helper.parent.addClass(this.tSettings.extraClass);if(this.tSettings.fixPNG)helper.parent.fixPNG();handle.apply(this,arguments);}function show(){tID=null;helper.parent.show();update();}function update(event){if($.Tooltip.blocked)return;if(!track&&helper.parent.is(":visible")){$('body').unbind('mousemove',update)}if(current==null){$('body').unbind('mousemove',update);return;}var left=helper.parent[0].offsetLeft;var top=helper.parent[0].offsetTop;if(event){left=event.pageX+current.tSettings.left;top=event.pageY+current.tSettings.top;helper.parent.css({left:left+'px',top:top+'px'});}var v=viewport(),h=helper.parent[0];if(v.x+v.cx<h.offsetLeft+h.offsetWidth){left-=h.offsetWidth+20+current.tSettings.left;helper.parent.css({left:left+'px'});}if(v.y+v.cy<h.offsetTop+h.offsetHeight){top-=h.offsetHeight+20+current.tSettings.top;helper.parent.css({top:top+'px'});}}function viewport(){return{x:$(window).scrollLeft(),y:$(window).scrollTop(),cx:$(window).width(),cy:$(window).height()};}function hide(event){if($.Tooltip.blocked)return;if(tID)clearTimeout(tID);current=null;helper.parent.hide().removeClass(this.tSettings.extraClass);if(this.tSettings.fixPNG)helper.parent.unfixPNG();}})(jQuery);


/*
 * jQuery corner plugin
 *
 * version 1.7 (1/26/2007)
 *
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */

/**
 * The corner() method provides a simple way of styling DOM elements.  
 *
 * corner() takes a single string argument:  $().corner("effect corners width")
 *
 *   effect:  The name of the effect to apply, such as round or bevel. 
 *            If you don't specify an effect, rounding is used.
 *
 *   corners: The corners can be one or more of top, bottom, tr, tl, br, or bl. 
 *            By default, all four corners are adorned. 
 *
 *   width:   The width specifies the width of the effect; in the case of rounded corners this 
 *            will be the radius of the width. 
 *            Specify this value using the px suffix such as 10px, and yes it must be pixels.
 *
 * For more details see: http://methvin.com/jquery/jq-corner.html
 * For a full demo see:  http://malsup.com/jquery/corner/
 *
 *
 * @example $('.adorn').corner();
 * @desc Create round, 10px corners 
 *
 * @example $('.adorn').corner("25px");
 * @desc Create round, 25px corners 
 *
 * @example $('.adorn').corner("notch bottom");
 * @desc Create notched, 10px corners on bottom only
 *
 * @example $('.adorn').corner("tr dog 25px");
 * @desc Create dogeared, 25px corner on the top-right corner only
 *
 * @example $('.adorn').corner("round 8px").parent().css('padding', '4px').corner("round 10px");
 * @desc Create a rounded border effect by styling both the element and its parent
 * 
 * @name corner
 * @type jQuery
 * @param String options Options which control the corner style
 * @cat Plugins/Corner
 * @return jQuery
 * @author Dave Methvin (dave.methvin@gmail.com)
 * @author Mike Alsup (malsup@gmail.com)
 */
jQuery.fn.corner = function(o) {
    function hex2(s) {
        var s = parseInt(s).toString(16);
        return ( s.length < 2 ) ? '0'+s : s;
    };
    function gpc(node) {
        for ( ; node && node.nodeName.toLowerCase() != 'html'; node = node.parentNode  ) {
            var v = jQuery.css(node,'backgroundColor');
            if ( v.indexOf('rgb') >= 0 ) { 
                rgb = v.match(/\d+/g); 
                return '#'+ hex2(rgb[0]) + hex2(rgb[1]) + hex2(rgb[2]);
            }
            if ( v && v != 'transparent' )
                return v;
        }
        return '#ffffff';
    };
    function getW(i) {
        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 '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 'bevel':  return i+1;
        }
    };
    o = (o||"").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|bevel|notch|bite|cool|sharp|slide|jut|curl|tear|fray|wicked|sculpt|long|dog3|dog2|dog/;
    var fx = ((o.match(re)||['round'])[0]);
    var edges = { T:0, B:1 };
    var opts = {
        TL:  /top|tl/.test(o),       TR:  /top|tr/.test(o),
        BL:  /bottom|bl/.test(o),    BR:  /bottom|br/.test(o)
    };
    if ( !opts.TL && !opts.TR && !opts.BL && !opts.BR )
        opts = { TL:1, TR:1, BL:1, BR:1 };
    var strip = document.createElement('div');
    strip.style.overflow = 'hidden';
    strip.style.height = '1px';
    strip.style.backgroundColor = sc || 'transparent';
    strip.style.borderStyle = 'solid';
    return this.each(function(index){
        var pad = {
            T: parseInt(jQuery.css(this,'paddingTop'))||0,     R: parseInt(jQuery.css(this,'paddingRight'))||0,
            B: parseInt(jQuery.css(this,'paddingBottom'))||0,  L: parseInt(jQuery.css(this,'paddingLeft'))||0
        };

        if (jQuery.browser.msie) this.style.zoom = 1; // force 'hasLayout' in IE
        if (!keep) this.style.border = 'none';
        strip.style.borderColor = cc || gpc(this.parentNode);
        var cssHeight = jQuery.curCSS(this, 'height');

        for (var j in edges) {
            var bot = edges[j];
            strip.style.borderStyle = 'none '+(opts[j+'R']?'solid':'none')+' none '+(opts[j+'L']?'solid':'none');
            var d = document.createElement('div');
            var ds = d.style;

            bot ? this.appendChild(d) : this.insertBefore(d, this.firstChild);

            if (bot && cssHeight != 'auto') {
                if (jQuery.css(this,'position') == 'static')
                    this.style.position = 'relative';
                ds.position = 'absolute';
                ds.bottom = ds.left = ds.padding = ds.margin = '0';
                if (jQuery.browser.msie)
                    ds.setExpression('width', 'this.parentNode.offsetWidth');
                else
                    ds.width = '100%';
            }
            else {
                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,getW(i));
                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);
            }
        }
    });
};

