	/************************************************************************************************************
	(C) www.dhtmlgoodies.com, April 2006
	
	This is a script from www.dhtmlgoodies.com. You will find this and a lot of other scripts at our website.	
	
	Terms of use:
	You are free to use this script as long as the copyright message is kept intact. However, you may not
	redistribute, sell or repost it without our permission.
	
	Thank you!
	
	www.dhtmlgoodies.com
	Alf Magne Kalleland
	
	************************************************************************************************************/	

	var ajaxBox_offsetX = 0;
	var ajaxBox_offsetY = 0;	
	var minimumLettersBeforeLookup = 1;	// Number of letters entered before a lookup is performed.

	var ajax_list_externalFile = '/consumer/ajax/AjaxListLocations.aspx';
	var ajax_list_externalFileTreatment = '/consumer/ajax/AjaxListTreatments.aspx';
	
	var ajax_list_objects = new Array();
	var ajax_list_cachedLists = new Array();
	
	var autocomplete_cachedLists = new Array();
	var autocomplete_activeInput = false;
	var autocomplete_activeItem;
	var autocomplete_optionDivFirstItem = false;
	var autocomplete_currentLetters = new Array();
	var reva_optionDiv = false;	
	var reva_noresultDiv = false;

	var autocomplete_MSIE = false;
	if (navigator.userAgent.indexOf('MSIE') >= 0 && navigator.userAgent.indexOf('Opera') < 0) {
		autocomplete_MSIE = true;		
	}
	
	var currentListIndex = 0;
	
	function reva_getTopPos(inputObj)
	{		
	  var returnValue = inputObj.offsetTop;
	  while((inputObj = inputObj.offsetParent) != null){
	  	returnValue += inputObj.offsetTop;// +1;//(autocomplete_MSIE ? 0 : 1);
	  }
	  return returnValue;
	}
	function autocomplete_cancelEvent()
	{
		return false;
	}
	
	function reva_getLeftPos(inputObj)
	{
	  var returnValue = inputObj.offsetLeft;
	  while((inputObj = inputObj.offsetParent) != null)returnValue += inputObj.offsetLeft+1;//(autocomplete_MSIE ? 0 : 1);
	  
	  return returnValue;
	}
	
	function reva_options_hide()
	{
		if(reva_optionDiv)reva_optionDiv.style.display='none';	
		if(reva_noresultDiv)reva_noresultDiv.style.display = 'none';
	}
	
	function reva_option_setValue(e,inputObj) {

        if (!inputObj) inputObj = this;
        var tmpValue = inputObj.innerHTML;

        var temp2 = new Array();
        temp2 = inputObj.id.split(':');

        if (temp2.length == 1) {
            tmpValue = inputObj.id;
        }
        else {
            if (autocomplete_MSIE) {
                tmpValue = inputObj.innerText;
            }
            else {
                tmpValue = inputObj.textContent;
            }   
        }
        
        
        if (!tmpValue) tmpValue = inputObj.innerHTML;
        autocomplete_activeInput.value = tmpValue;
        if (document.getElementById(autocomplete_activeInput.name + '_hidden')) {
            document.getElementById(autocomplete_activeInput.name + '_hidden').value = inputObj.id;

            if (location.pathname == "/Moderator/SupplierSetupGeneral.aspx") {
                var temp = new Array();
                temp = inputObj.id.split('!');

                document.getElementById('TextBoxLocationID').value = temp[0];

            }
        }
        reva_options_hide();
	}
	
	function reva_options_rollOverActiveItem(item,fromKeyBoard)
	{
	    if (autocomplete_activeItem) autocomplete_activeItem.className = 'optionDiv';
	    
        item.className = 'optionDivSelected';
		
		autocomplete_activeItem = item;
		
		if(fromKeyBoard){
			if(autocomplete_activeItem.offsetTop>reva_optionDiv.offsetHeight){
				reva_optionDiv.scrollTop = autocomplete_activeItem.offsetTop - reva_optionDiv.offsetHeight + autocomplete_activeItem.offsetHeight + 2 ;
			}
			if(autocomplete_activeItem.offsetTop<reva_optionDiv.scrollTop)
			{
				reva_optionDiv.scrollTop = 0;	
			}
		}
	}
	
	function reva_option_list_buildList(letters,paramToExternalFile)
	{	
		reva_optionDiv.innerHTML = '';
		autocomplete_activeItem = false;
		if(autocomplete_cachedLists[paramToExternalFile][letters.toLowerCase()].length<=1){
			reva_options_hide();
			return;			
		}
		
		
		
		autocomplete_optionDivFirstItem = false;
		var optionsAdded = false;
		for(var no=0;no<autocomplete_cachedLists[paramToExternalFile][letters.toLowerCase()].length;no++){
			if(autocomplete_cachedLists[paramToExternalFile][letters.toLowerCase()][no].length==0)continue;
			optionsAdded = true;
			var div = document.createElement('DIV');
			var items = autocomplete_cachedLists[paramToExternalFile][letters.toLowerCase()][no].split(/###/gi);
			
			if(autocomplete_cachedLists[paramToExternalFile][letters.toLowerCase()].length==1 && autocomplete_activeInput.value == items[0]){
				reva_options_hide();
				return;						
			}
			
			
			div.innerHTML = items[items.length-1];
			div.id = items[0];
			div.className = 'optionDiv';
			div.onmouseover = function() { reva_options_rollOverActiveItem(this, false) }
						
			//div.onclick = reva_option_setValue;
			div.onclick = function(){
					reva_option_setValue(false,autocomplete_activeItem);
					try{document.getElementById("searchLink").focus();
					}catch(e){
					try {document.getElementById("mainSearchBox_ButtonFind").focus();} catch (ee) {	}
					}
				};
			if(!autocomplete_optionDivFirstItem)
				autocomplete_optionDivFirstItem = div;
				
			reva_optionDiv.appendChild(div);
		}	
		if(optionsAdded){
			reva_optionDiv.style.display='block';			
			reva_options_rollOverActiveItem(autocomplete_optionDivFirstItem,true);
		}
					
	}
	
	
	function reva_option_resize(inputObj)
	{
		reva_optionDiv.style.top = (reva_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY) + 'px';
		reva_optionDiv.style.left = (reva_getLeftPos(inputObj) + ajaxBox_offsetX) + 'px';
		
	}
	
	function reva_showOptions(inputObj,paramToExternalFile,e) {

	    /*if(e.keyCode==13 || e.keyCode==9)
		{
			alert("t");
			if(inputObj.value != '')
			try{
				alert("it");
			document.getElementById("searchLink").focus();
			}catch(e)
			{
				try{
					alert("iit");
					document.getElementById("buttonAddTreatment").focus();
					//AddTreatment();
					}catch(e)
					{}
			}
			alert("ee");
			return;
			alert("e");
		}*/
		
		if(autocomplete_currentLetters[inputObj.name]==inputObj.value)return;
		if(!autocomplete_cachedLists[paramToExternalFile])autocomplete_cachedLists[paramToExternalFile] = new Array();
		autocomplete_currentLetters[inputObj.name] = inputObj.value;
		if(!reva_optionDiv){
			reva_optionDiv = document.createElement('DIV');
			reva_optionDiv.id = 'reva_listOfOptions';	
			document.body.appendChild(reva_optionDiv);
			
			
			var allInputs = document.getElementsByTagName('INPUT');
			for(var no=0;no<allInputs.length;no++){
				if(!allInputs[no].onkeyup)allInputs[no].onfocus = reva_options_hide;
			}			
			var allSelects = document.getElementsByTagName('SELECT');
			for(var no=0;no<allSelects.length;no++){
				allSelects[no].onfocus = reva_options_hide;
			}

			var oldonkeydown=document.body.onkeydown;
			if(typeof oldonkeydown!='function'){
				document.body.onkeydown=reva_option_keyNavigation;
			}else{
				document.body.onkeydown=function(){
					oldonkeydown();
				reva_option_keyNavigation() ;}
			}
			var oldonresize=document.body.onresize;
			if(typeof oldonresize!='function'){
				document.body.onresize=function() {reva_option_resize(inputObj); };
			}else{
				document.body.onresize=function(){oldonresize();
				reva_option_resize(inputObj) ;}
			}
				
		}
		
		if(inputObj.value.length<minimumLettersBeforeLookup){
			reva_options_hide();			
			if(reva_noresultDiv)
				reva_noresultDiv.style.display = 'none';
				
			return;
        }
        
        if (inputObj.value.length <= minimumLettersBeforeLookup) {
		    ajax_list_objects = new Array();
		}


		reva_optionDiv.style.width = '290px';
		reva_optionDiv.style.top = (reva_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY + 5) + 'px';
		reva_optionDiv.style.left = (reva_getLeftPos(inputObj) + ajaxBox_offsetX - 12) + 'px';
		
		
		//create the no result div and iframe
		if ((paramToExternalFile == 'getTreatmentsByLetters' || paramToExternalFile == 'getTreatments2ByLetters') && !reva_noresultDiv)
		{
			reva_noresultDiv = document.createElement('DIV');
			reva_noresultDiv.id = 'reva_noResults';	
			reva_noresultDiv.innerHTML = "<span>You are looking for clinics and doctors</span>Please type the name of clinic/doctor or choose from the list below.";
			reva_noresultDiv.style.top = reva_optionDiv.style.top;//(reva_getTopPos(inputObj) + inputObj.offsetHeight + ajaxBox_offsetY + 3) + 'px';
			reva_noresultDiv.style.left = reva_optionDiv.style.left;//(reva_getLeftPos(inputObj) + ajaxBox_offsetX - 3) + 'px';
			document.body.appendChild(reva_noresultDiv);					
			
		}
		//hiding the no match div or iframe		
		if(reva_noresultDiv)
			reva_noresultDiv.style.display = 'none';
		
		autocomplete_activeInput = inputObj;
		reva_optionDiv.onselectstart =  autocomplete_cancelEvent;
		currentListIndex++;

			var tmpIndex=currentListIndex/1;
			reva_optionDiv.innerHTML = '';			
			
				    
			    if (paramToExternalFile == 'getTreatmentsByLetters') {

			        var ajaxIndex = ajax_list_objects.length;

			        if (inputObj.value.length >= 2) {
			            ajax_list_objects[ajaxIndex] = new sack();

			            var url = ajax_list_externalFileTreatment + '?letters=' + inputObj.value;

			            ajax_list_objects[ajaxIndex].requestFile = url; // Specifying which file to get
			            ajax_list_objects[ajaxIndex].onCompletion = function() {
			                ajax_option_list_showContent(ajaxIndex, inputObj, paramToExternalFile, tmpIndex);
			            };
			            // Specify function that will be executed after file has been found
			            ajax_list_objects[ajaxIndex].runAJAX(); 	// Execute AJAX function

			            

			        }
			    }
				else if (paramToExternalFile == 'getTreatments2ByLetters')
		        {
			        var tempList = '';
    			    if (inputObj.value != '')
			        {
			            for(_tempSelection in AutoCompleteTreatmentData)
			            {
			                if (inputObj.value.toLowerCase() == AutoCompleteTreatmentData[_tempSelection].text.substring(0,inputObj.value.length).toLowerCase())
			                {
			                    tempList += AutoCompleteTreatmentData[_tempSelection].value + "###" + AutoCompleteTreatmentData[_tempSelection].displaytext + '|';
			                }
			            }
			            
			            if (tempList == '')
			            {			               
						   if(reva_noresultDiv)
						   {
								reva_noresultDiv.innerHTML = "<span>We dont know that treatment</span>Enter a treatment e.g. 'Implants' or type 'Not Sure'.";
								reva_noresultDiv.style.display = 'block';
								
							}
							try{
								gvAjaxManager.logRequest('autocomplete=1&cid='+providersListParams.cid+'&letters='+inputObj.value);
							}catch(e)
							{} 
							return;
			            }
			                			        
			            autocomplete_cachedLists[paramToExternalFile][inputObj.value.toLowerCase()] = tempList.split('|');
		                reva_option_list_buildList(inputObj.value,paramToExternalFile);
			        }
			    }
			    else
			    {
			        var ajaxIndex = ajax_list_objects.length;
			        
    			    if (inputObj.value.length  == 2)
			        {   
			            ajax_list_objects[ajaxIndex] = new sack();

			            var ClinicTypeID = 0;

			            if (document.getElementById('treatment_hidden').value != "") {
			                ClinicTypeID = document.getElementById('treatment_hidden').value.split(':')[2];
			            }

			            var url = ajax_list_externalFile + '?cid=' + ClinicTypeID + '&dcid=' + providersListParams.dcid + '&fcid=' + providersListParams.fcid + '&letters=' + inputObj.value;
			            
	                    ajax_list_objects[ajaxIndex].requestFile = url;	// Specifying which file to get
	                    ajax_list_objects[ajaxIndex].onCompletion = function(){ 
	                                                            ajax_option_list_showContent(ajaxIndex,inputObj,paramToExternalFile,tmpIndex); 
	                                                        };	
	                                                        // Specify function that will be executed after file has been found
	                    ajax_list_objects[ajaxIndex].runAJAX();		// Execute AJAX function
	                
			        }
			        else if (inputObj.value.length  >= 2)
			        {
			            ajax_option_list_showContent(ajaxIndex,inputObj,paramToExternalFile,tmpIndex);
			        }
			        
			    }
		//}
	}
	
	function ajax_option_list_showContent(ajaxIndex, inputObj, paramToExternalFile, whichIndex)
	{
	    var counter = 0;
	    var CheckIfExistUndefined = 0;
     
        while (counter <= ajaxIndex -1)
        {
            if (ajax_list_objects[counter].responseStatus[1] != "OK")
            {
                CheckIfExistUndefined = 1;
            }
            counter = counter + 1;
        }
                
        if (CheckIfExistUndefined == 1)
        {
	        window.setTimeout(function () 
                                {
                                    ajax_option_list_showContent(ajaxIndex, inputObj, paramToExternalFile, whichIndex);
                                },300);
        }
        else
        {
            
	        if(whichIndex!=currentListIndex)return;

	        var tempList = '';

	        var reva_Match = false;

	        if (inputObj.value.length  >= 2 && ajax_list_objects != null)
	        {
                while (ajax_list_objects[ajaxIndex] == undefined && ajaxIndex >= 0)
                {
                    ajaxIndex = ajaxIndex - 1;
                }

                while (tempList == '' && ajaxIndex >= 0) {

                    if (ajax_list_objects[ajaxIndex].requestFile.indexOf("AjaxListTreatments") > 0 && paramToExternalFile == "getTreatmentsByLetters")
                    {
                        AutoCompleteCountryData = ajax_list_objects[ajaxIndex].response;
                        for (_tempSelection in AutoCompleteCountryData) {

                            if (AutoCompleteCountryData[_tempSelection].text.toLowerCase().indexOf(inputObj.value.toLowerCase()) >= 0) {
                                reva_Match = true;
                            }
                            tempList += AutoCompleteCountryData[_tempSelection].value + "###" + AutoCompleteCountryData[_tempSelection].displaytext + '|';
                        }
                    }

                    if (ajax_list_objects[ajaxIndex].requestFile.indexOf("AjaxListLocations") > 0 && paramToExternalFile == "getCountriesByLetters") 
                    {
                        AutoCompleteCountryData = ajax_list_objects[ajaxIndex].response;
                        for (_tempSelection in AutoCompleteCountryData) 
                        {
                            if (inputObj.value.toLowerCase() == AutoCompleteCountryData[_tempSelection].text.substring(0, inputObj.value.length).toLowerCase()) {
                            
                                tempList += AutoCompleteCountryData[_tempSelection].value + "###" + (AutoCompleteCountryData[_tempSelection].shortcode == "" ? "" : "<img src='/images/countries/" + AutoCompleteCountryData[_tempSelection].shortcode + ".png'> ") + '<b>' + AutoCompleteCountryData[_tempSelection].displaytext.substring(0, inputObj.value.length) + '</b>' + AutoCompleteCountryData[_tempSelection].displaytext.substring(inputObj.value.length) + '|';
                            }
                        }
                    }
                    
                    if (tempList == '') {

                        ajaxIndex = ajaxIndex - 1;
                        reva_Match = false;
                    }
                }

                if (paramToExternalFile == "getTreatmentsByLetters") {
                    if (reva_Match == false) {
                        tempList = inputObj.value + '###Search clinic or staff names for "<b>' + inputObj.value + '</b>"|' + tempList;
                    }
                    else {
                        tempList += inputObj.value + '###Search clinic or staff names for "<b>' + inputObj.value + '</b>"|';                    
                    }
                }
                
                if (tempList != '')
                {
                    autocomplete_cachedLists[paramToExternalFile][inputObj.value.toLowerCase()] = tempList.split('|');
	                reva_option_list_buildList(inputObj.value,paramToExternalFile);
	            }
	            else
	            {
	                if (reva_noresultDiv && paramToExternalFile == "getTreatmentsByLetters") 
	                {
	                    reva_noresultDiv.innerHTML = "<span>We dont know that treatment</span>Enter a treatment e.g. 'Implants' or type 'Not Sure'.";
	                    reva_noresultDiv.style.display = 'block';
	                }
	            }
            }
        }
	}
		
	function reva_option_keyNavigation(e)
	{
		
		if(document.all)e = event;
		if(!reva_optionDiv)
		{
			//alert("here2");
			return;
		}
		
		if(reva_optionDiv.style.display=='none')		
			return;
			
		if(e.keyCode==38){	// Up arrow
			if(!autocomplete_activeItem)return;
			if(autocomplete_activeItem && !autocomplete_activeItem.previousSibling)return;
			reva_options_rollOverActiveItem(autocomplete_activeItem.previousSibling,true);
		}
		
		if(e.keyCode==40){	// Down arrow
			if(!autocomplete_activeItem){
				reva_options_rollOverActiveItem(autocomplete_optionDivFirstItem,true);
			}else{
				if(!autocomplete_activeItem.nextSibling)return;
				reva_options_rollOverActiveItem(autocomplete_activeItem.nextSibling,true);
			}
		}
		if (e.keyCode == 13 || e.keyCode == 9) {	// Enter key or tab key
		    //if (autocomplete_activeItem && autocomplete_activeItem.className == 'optionDivSelected' && autocomplete_activeItem.id != 'reva_noResults') {
		    //    //reva_option_setValue(false, autocomplete_activeItem);
		    //}
			
			//if the no result div is displayed then must be search for supplier/staff name otherwise act as normal
		    if (!reva_noresultDiv || reva_noresultDiv.style.display == 'none') {
			    		            
			    if (autocomplete_activeItem && autocomplete_activeItem.className == 'optionDivSelected') 
				{					
						reva_option_setValue(false, autocomplete_activeItem);
				}
			}else
			{//better hide noresultdiv since this is a supplier/staff search since the other function won't
				reva_noresultDiv.style.display = 'none';
				reva_options_hide();
			}
			
		    if (e.keyCode == 13) {
		        try {
					
		            //if we are on the search page do the search
		            //document.getElementById("searchLink").focus();
		            //document.getElementById("searchLink").click();//won't work on a tag need to change to button
					$('input.button_search').click();										
					
		            //gvSearchFilter.doSearch();
		        } catch (e) {
		            try {
		                //ok we were not on the search page maybe index page try set focus
		                document.getElementById("mainSearchBox_ButtonFind").focus();
		                document.getElementById("mainSearchBox_ButtonFind").click();
		            }
		            catch (ee) {
		                try {
		                    //right not on either so maybe consultation form
		                    document.getElementById("buttonAddTreatment").focus();
		                    AddTreatment();
		                }
		                catch (eee) {
		                }
		            }
		        }
				
		        return false;
		    } else
		        return true;
		}
		
		if(e.keyCode==27){	// Escape key
			reva_options_hide();			
		}
	}
	
	
	document.documentElement.onclick = autoHideList;
	
	function autoHideList(e)
	{
		if(document.all)e = event;
		
		if (e.target) source = e.target;
			else if (e.srcElement) source = e.srcElement;
			if (source.nodeType == 3) // defeat Safari bug
				source = source.parentNode;		
		if(source.tagName.toLowerCase()!='input' && source.tagName.toLowerCase()!='textarea')reva_options_hide();
		
	}
	
	
	
/* Simple AJAX Code-Kit (SACK) v1.6.1 */
/* ©2005 Gregory Wild-Smith */
/* www.twilightuniverse.com */
/* Software licenced under a modified X11 licence,
   see documentation or authors website for more details */

function sack(file) {
	this.xmlhttp = null;

	this.resetData = function() {
		this.method = "POST";
  		this.queryStringSeparator = "?";
		this.argumentSeparator = "&";
		this.URLString = "";
		this.encodeURIString = true;
  		this.execute = false;
  		this.element = null;
		this.elementObj = null;
		this.requestFile = file;
		this.vars = new Object();
		this.responseStatus = new Array(2);
  	};

	this.resetFunctions = function() {
  		this.onLoading = function() { };
  		this.onLoaded = function() { };
  		this.onInteractive = function() { };
  		this.onCompletion = function() { };
  		this.onError = function() { };
		this.onFail = function() { };
	};

	this.reset = function() {
		this.resetFunctions();
		this.resetData();
	};

	this.createAJAX = function() {
		try {
			this.xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
		} catch (e1) {
			try {
				this.xmlhttp = new ActiveXObject("Microsoft.XMLHTTP");
			} catch (e2) {
				this.xmlhttp = null;
			}
		}

		if (! this.xmlhttp) {
			if (typeof XMLHttpRequest != "undefined") {
				this.xmlhttp = new XMLHttpRequest();
			} else {
				this.failed = true;
			}
		}
	};

	this.setVar = function(name, value){
		this.vars[name] = Array(value, false);
	};

	this.encVar = function(name, value, returnvars) {
		if (true == returnvars) {
			return Array(encodeURIComponent(name), encodeURIComponent(value));
		} else {
			this.vars[encodeURIComponent(name)] = Array(encodeURIComponent(value), true);
		}
	}

	this.processURLString = function(string, encode) {
		encoded = encodeURIComponent(this.argumentSeparator);
		regexp = new RegExp(this.argumentSeparator + "|" + encoded);
		varArray = string.split(regexp);
		for (i = 0; i < varArray.length; i++){
			urlVars = varArray[i].split("=");
			if (true == encode){
				this.encVar(urlVars[0], urlVars[1]);
			} else {
				this.setVar(urlVars[0], urlVars[1]);
			}
		}
	}

	this.createURLString = function(urlstring) {
		if (this.encodeURIString && this.URLString.length) {
			this.processURLString(this.URLString, true);
		}

		if (urlstring) {
			if (this.URLString.length) {
				this.URLString += this.argumentSeparator + urlstring;
			} else {
				this.URLString = urlstring;
			}
		}

		// prevents caching of URLString
		this.setVar("rndval", new Date().getTime());

		urlstringtemp = new Array();
		for (key in this.vars) {
			if (false == this.vars[key][1] && true == this.encodeURIString) {
				encoded = this.encVar(key, this.vars[key][0], true);
				delete this.vars[key];
				this.vars[encoded[0]] = Array(encoded[1], true);
				key = encoded[0];
			}

			urlstringtemp[urlstringtemp.length] = key + "=" + this.vars[key][0];
		}
		if (urlstring){
			this.URLString += this.argumentSeparator + urlstringtemp.join(this.argumentSeparator);
		} else {
			this.URLString += urlstringtemp.join(this.argumentSeparator);
		}
	}

	this.runResponse = function() {
		eval(this.response);
	}

	this.runAJAX = function(urlstring) {
		if (this.failed) {
			this.onFail();
		} else {
			this.createURLString(urlstring);
			if (this.element) {
				this.elementObj = document.getElementById(this.element);
			}
			if (this.xmlhttp) {
				var self = this;
				if (this.method == "GET") {
					totalurlstring = this.requestFile + this.queryStringSeparator + this.URLString;
					this.xmlhttp.open(this.method, totalurlstring, true);
				} else {
					this.xmlhttp.open(this.method, this.requestFile, true);
					try {
						this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded")
					} catch (e) { }
				}

				this.xmlhttp.onreadystatechange = function() {
					switch (self.xmlhttp.readyState) {
						case 1:
							self.onLoading();
							break;
						case 2:
							self.onLoaded();
							break;
						case 3:
							self.onInteractive();
							break;
						case 4:
							self.response = new Function("return "+self.xmlhttp.responseText)(); //self.xmlhttp.responseText;
							self.responseXML = self.xmlhttp.responseXML;
							self.responseStatus[0] = self.xmlhttp.status;
							self.responseStatus[1] = self.xmlhttp.statusText;

							if (self.execute) {
								self.runResponse();
							}

							if (self.elementObj) {
								elemNodeName = self.elementObj.nodeName;
								elemNodeName.toLowerCase();
								if (elemNodeName == "input"
								|| elemNodeName == "select"
								|| elemNodeName == "option"
								|| elemNodeName == "textarea") {
									self.elementObj.value = self.response;
								} else {
									self.elementObj.innerHTML = self.response;
								}
							}
							if (self.responseStatus[0] == "200") {
								self.onCompletion();
							} else {
								self.onError();
							}

							self.URLString = "";
							break;
					}
				};

				this.xmlhttp.send(this.URLString);
			}
		}
	};

	this.reset();
	this.createAJAX();
}
/*
 * jQuery history plugin
 *
 * Copyright (c) 2006 Taku Sano (Mikage Sawatari)
 * Licensed under the MIT License:
 *   http://www.opensource.org/licenses/mit-license.php
 *
 * Modified by Lincoln Cooper to add Safari support and only call the callback once during initialization
 * for msie when no initial hash supplied.
 */


jQuery.extend({
	historyCurrentHash: undefined,
	
	historyCallback: undefined,
	
	historyInit: function(callback){	   
		jQuery.historyCallback = callback;
		var current_hash = location.hash;		
		
		jQuery.historyCurrentHash = current_hash;
		if(jQuery.browser.msie) {
			// To stop the callback firing twice during initilization if no hash present
			if (jQuery.historyCurrentHash == '') {
			jQuery.historyCurrentHash = '#';
		}
		
			// add hidden iframe for IE
			$("body").prepend('<iframe id="jQuery_history" style="display: none;"></iframe>');
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			iframe.location.hash = current_hash;
		}
		else if ($.browser.safari) {
			// etablish back/forward stacks
			jQuery.historyBackStack = [];
			jQuery.historyBackStack.length = history.length;
			jQuery.historyForwardStack = [];
			
			jQuery.isFirst = true;
		}
		jQuery.historyCallback(current_hash.replace(/^#/, ''));
		setInterval(jQuery.historyCheck, 100);
	},
	
	historyAddHistory: function(hash) {		
		// This makes the looping function do something
		jQuery.historyBackStack.push(hash);
		
		jQuery.historyForwardStack.length = 0; // clear forwardStack (true click occured)
		this.isFirst = true;
	},
	
	historyCheck: function(){				
		if(jQuery.browser.msie) {
			// On IE, check for location.hash of iframe
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentDocument || ihistory.contentWindow.document;
			var current_hash = iframe.location.hash;
			if(current_hash != jQuery.historyCurrentHash) {
			
				location.hash = current_hash;
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
				
			}
		} else if ($.browser.safari) {
			if (!jQuery.dontCheck) {
				var historyDelta = history.length - jQuery.historyBackStack.length;
				
				if (historyDelta) { // back or forward button has been pushed
					jQuery.isFirst = false;
					if (historyDelta < 0) { // back button has been pushed
						// move items to forward stack
						for (var i = 0; i < Math.abs(historyDelta); i++) jQuery.historyForwardStack.unshift(jQuery.historyBackStack.pop());
					} else { // forward button has been pushed
						// move items to back stack
						for (var i = 0; i < historyDelta; i++) jQuery.historyBackStack.push(jQuery.historyForwardStack.shift());
					}
					var cachedHash = jQuery.historyBackStack[jQuery.historyBackStack.length - 1];
					if (cachedHash != undefined) {
						jQuery.historyCurrentHash = location.hash;
						jQuery.historyCallback(cachedHash);
					}
				} else if (jQuery.historyBackStack[jQuery.historyBackStack.length - 1] == undefined && !jQuery.isFirst) {
					// back button has been pushed to beginning and URL already pointed to hash (e.g. a bookmark)
					// document.URL doesn't change in Safari
					if (document.URL.indexOf('#') >= 0) {
						jQuery.historyCallback(document.URL.split('#')[1]);
					} else {
						var current_hash = location.hash;
						jQuery.historyCallback('');
					}
					jQuery.isFirst = true;
				}
			}
		} else {
			// otherwise, check for location.hash
			var current_hash = location.hash;
			if(current_hash != jQuery.historyCurrentHash) {
				jQuery.historyCurrentHash = current_hash;
				jQuery.historyCallback(current_hash.replace(/^#/, ''));
			}
		}
	},
	historyLoad: function(hash){				
		var newhash;
		hash = hash.replace(/%2C/g,',');
		if (jQuery.browser.safari) {
			newhash = hash;
		}
		else {
			newhash = '#' + hash;
			location.hash = newhash;
		}
		jQuery.historyCurrentHash = newhash;
		
		if(jQuery.browser.msie) {
			var ihistory = $("#jQuery_history")[0];
			var iframe = ihistory.contentWindow.document;
			iframe.open();
			iframe.close();
			iframe.location.hash = newhash;
			jQuery.historyCallback(hash);
		}
		else if (jQuery.browser.safari) {
			jQuery.dontCheck = true;
			// Manually keep track of the history values for Safari
			this.historyAddHistory(hash);
			
			// Wait a while before allowing checking so that Safari has time to update the "history" object
			// correctly (otherwise the check loop would detect a false change in hash).
			var fn = function() {jQuery.dontCheck = false;};
			window.setTimeout(fn, 200);
			jQuery.historyCallback(hash);
			// N.B. "location.hash=" must be the last line of code for Safari as execution stops afterwards.
			//      By explicitly using the "location.hash" command (instead of using a variable set to "location.hash") the
			//      URL in the browser and the "history" object are both updated correctly.
			location.hash = newhash;
		}
		else {
		  jQuery.historyCallback(hash);
		}
	}
});


/*
 * by Petko D. Petkov; pdp (architect)
 * http://www.gnucitizen.org
 * http://www.gnucitizen.org/projects/jquery-include/
 */
jQuery.extend({
	/*
	 * included scripts
	 */
	includedScripts: {},

	/*
	 * include timer
	 */
	includeTimer: null,

	/*
	 * include
	 */
	include: function (url, onload) {
		if (jQuery.includedScripts[url] != undefined) {
			if (typeof onload == 'function') {
				onload();
			}
			return;
		} 

		jQuery.isReady = false;

		if (jQuery.readyList == null) {
			jQuery.readyList = [];
		}

		var script = document.createElement('script');

		script.type = 'text/javascript';
		script.onload = function () {
			jQuery.includedScripts[url] = true;

			if (typeof onload == 'function') {
				onload.apply(jQuery(script), arguments);
			}
		};
		script.onreadystatechange = function () {
			if (script.readyState == 'complete') {
				jQuery.includedScripts[url] = true;

				if (typeof onload == 'function') {
					onload.apply(jQuery(script), arguments);
				}
			}
		};
		script.src = url;

		jQuery.includedScripts[url] = false;
		document.getElementsByTagName('head')[0].appendChild(script);

		if (!jQuery.includeTimer) {
			jQuery.includeTimer = window.setInterval(function () {
				jQuery.ready();
			}, 10);
		}
	}
});

/*
 * replacement of jQuery.ready
 */
jQuery.extend({
	/*
	 * hijack jQuery.ready
	 */
	_ready: jQuery.ready,

	/*
	 * jQuery.ready replacement
	 */
	ready: function () {
		isReady = true;

		for (var script in jQuery.includedScripts) {
			if (jQuery.includedScripts[script] == false) {
				isReady = false;
				break;
			}
		}

		if (isReady) {
			window.clearInterval(jQuery.includeTimer);
			jQuery._ready.apply(jQuery, arguments);
		}
	}
});
/*
 * jQuery UI 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI
 */
;jQuery.ui || (function($) {

var _remove = $.fn.remove,
	isFF2 = $.browser.mozilla && (parseFloat($.browser.version) < 1.9);

//Helper functions and ui object
$.ui = {
	version: "1.7.1",

	// $.ui.plugin is deprecated.  Use the proxy pattern instead.
	plugin: {
		add: function(module, option, set) {
			var proto = $.ui[module].prototype;
			for(var i in set) {
				proto.plugins[i] = proto.plugins[i] || [];
				proto.plugins[i].push([option, set[i]]);
			}
		},
		call: function(instance, name, args) {
			var set = instance.plugins[name];
			if(!set || !instance.element[0].parentNode) { return; }

			for (var i = 0; i < set.length; i++) {
				if (instance.options[set[i][0]]) {
					set[i][1].apply(instance.element, args);
				}
			}
		}
	},

	contains: function(a, b) {
		return document.compareDocumentPosition
			? a.compareDocumentPosition(b) & 16
			: a !== b && a.contains(b);
	},

	hasScroll: function(el, a) {

		//If overflow is hidden, the element might have extra content, but the user wants to hide it
		if ($(el).css('overflow') == 'hidden') { return false; }

		var scroll = (a && a == 'left') ? 'scrollLeft' : 'scrollTop',
			has = false;

		if (el[scroll] > 0) { return true; }

		// TODO: determine which cases actually cause this to happen
		// if the element doesn't have the scroll set, see if it's possible to
		// set the scroll
		el[scroll] = 1;
		has = (el[scroll] > 0);
		el[scroll] = 0;
		return has;
	},

	isOverAxis: function(x, reference, size) {
		//Determines when x coordinate is over "b" element axis
		return (x > reference) && (x < (reference + size));
	},

	isOver: function(y, x, top, left, height, width) {
		//Determines when x, y coordinates is over "b" element
		return $.ui.isOverAxis(y, top, height) && $.ui.isOverAxis(x, left, width);
	},

	keyCode: {
		BACKSPACE: 8,
		CAPS_LOCK: 20,
		COMMA: 188,
		CONTROL: 17,
		DELETE: 46,
		DOWN: 40,
		END: 35,
		ENTER: 13,
		ESCAPE: 27,
		HOME: 36,
		INSERT: 45,
		LEFT: 37,
		NUMPAD_ADD: 107,
		NUMPAD_DECIMAL: 110,
		NUMPAD_DIVIDE: 111,
		NUMPAD_ENTER: 108,
		NUMPAD_MULTIPLY: 106,
		NUMPAD_SUBTRACT: 109,
		PAGE_DOWN: 34,
		PAGE_UP: 33,
		PERIOD: 190,
		RIGHT: 39,
		SHIFT: 16,
		SPACE: 32,
		TAB: 9,
		UP: 38
	}
};

// WAI-ARIA normalization
if (isFF2) {
	var attr = $.attr,
		removeAttr = $.fn.removeAttr,
		ariaNS = "http://www.w3.org/2005/07/aaa",
		ariaState = /^aria-/,
		ariaRole = /^wairole:/;

	$.attr = function(elem, name, value) {
		var set = value !== undefined;

		return (name == 'role'
			? (set
				? attr.call(this, elem, name, "wairole:" + value)
				: (attr.apply(this, arguments) || "").replace(ariaRole, ""))
			: (ariaState.test(name)
				? (set
					? elem.setAttributeNS(ariaNS,
						name.replace(ariaState, "aaa:"), value)
					: attr.call(this, elem, name.replace(ariaState, "aaa:")))
				: attr.apply(this, arguments)));
	};

	$.fn.removeAttr = function(name) {
		return (ariaState.test(name)
			? this.each(function() {
				this.removeAttributeNS(ariaNS, name.replace(ariaState, ""));
			}) : removeAttr.call(this, name));
	};
}

//jQuery plugins
$.fn.extend({
	remove: function() {
		// Safari has a native remove event which actually removes DOM elements,
		// so we have to use triggerHandler instead of trigger (#3037).
		$("*", this).add(this).each(function() {
			$(this).triggerHandler("remove");
		});
		return _remove.apply(this, arguments );
	},

	enableSelection: function() {
		return this
			.attr('unselectable', 'off')
			.css('MozUserSelect', '')
			.unbind('selectstart.ui');
	},

	disableSelection: function() {
		return this
			.attr('unselectable', 'on')
			.css('MozUserSelect', 'none')
			.bind('selectstart.ui', function() { return false; });
	},

	scrollParent: function() {
		var scrollParent;
		if(($.browser.msie && (/(static|relative)/).test(this.css('position'))) || (/absolute/).test(this.css('position'))) {
			scrollParent = this.parents().filter(function() {
				return (/(relative|absolute|fixed)/).test($.curCSS(this,'position',1)) && (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		} else {
			scrollParent = this.parents().filter(function() {
				return (/(auto|scroll)/).test($.curCSS(this,'overflow',1)+$.curCSS(this,'overflow-y',1)+$.curCSS(this,'overflow-x',1));
			}).eq(0);
		}

		return (/fixed/).test(this.css('position')) || !scrollParent.length ? $(document) : scrollParent;
	}
});


//Additional selectors
$.extend($.expr[':'], {
	data: function(elem, i, match) {
		return !!$.data(elem, match[3]);
	},

	focusable: function(element) {
		var nodeName = element.nodeName.toLowerCase(),
			tabIndex = $.attr(element, 'tabindex');
		return (/input|select|textarea|button|object/.test(nodeName)
			? !element.disabled
			: 'a' == nodeName || 'area' == nodeName
				? element.href || !isNaN(tabIndex)
				: !isNaN(tabIndex))
			// the element and all of its ancestors must be visible
			// the browser may report that the area is hidden
			&& !$(element)['area' == nodeName ? 'parents' : 'closest'](':hidden').length;
	},

	tabbable: function(element) {
		var tabIndex = $.attr(element, 'tabindex');
		return (isNaN(tabIndex) || tabIndex >= 0) && $(element).is(':focusable');
	}
});


// $.widget is a factory to create jQuery plugins
// taking some boilerplate code out of the plugin code
function getter(namespace, plugin, method, args) {
	function getMethods(type) {
		var methods = $[namespace][plugin][type] || [];
		return (typeof methods == 'string' ? methods.split(/,?\s+/) : methods);
	}

	var methods = getMethods('getter');
	if (args.length == 1 && typeof args[0] == 'string') {
		methods = methods.concat(getMethods('getterSetter'));
	}
	return ($.inArray(method, methods) != -1);
}

$.widget = function(name, prototype) {
	var namespace = name.split(".")[0];
	name = name.split(".")[1];

	// create plugin method
	$.fn[name] = function(options) {
		var isMethodCall = (typeof options == 'string'),
			args = Array.prototype.slice.call(arguments, 1);

		// prevent calls to internal methods
		if (isMethodCall && options.substring(0, 1) == '_') {
			return this;
		}

		// handle getter methods
		if (isMethodCall && getter(namespace, name, options, args)) {
			var instance = $.data(this[0], name);
			return (instance ? instance[options].apply(instance, args)
				: undefined);
		}

		// handle initialization and non-getter methods
		return this.each(function() {
			var instance = $.data(this, name);

			// constructor
			(!instance && !isMethodCall &&
				$.data(this, name, new $[namespace][name](this, options))._init());

			// method call
			(instance && isMethodCall && $.isFunction(instance[options]) &&
				instance[options].apply(instance, args));
		});
	};

	// create widget constructor
	$[namespace] = $[namespace] || {};
	$[namespace][name] = function(element, options) {
		var self = this;

		this.namespace = namespace;
		this.widgetName = name;
		this.widgetEventPrefix = $[namespace][name].eventPrefix || name;
		this.widgetBaseClass = namespace + '-' + name;

		this.options = $.extend({},
			$.widget.defaults,
			$[namespace][name].defaults,
			$.metadata && $.metadata.get(element)[name],
			options);

		this.element = $(element)
			.bind('setData.' + name, function(event, key, value) {
				if (event.target == element) {
					return self._setData(key, value);
				}
			})
			.bind('getData.' + name, function(event, key) {
				if (event.target == element) {
					return self._getData(key);
				}
			})
			.bind('remove', function() {
				return self.destroy();
			});
	};

	// add widget prototype
	$[namespace][name].prototype = $.extend({}, $.widget.prototype, prototype);

	// TODO: merge getter and getterSetter properties from widget prototype
	// and plugin prototype
	$[namespace][name].getterSetter = 'option';
};

$.widget.prototype = {
	_init: function() {},
	destroy: function() {
		this.element.removeData(this.widgetName)
			.removeClass(this.widgetBaseClass + '-disabled' + ' ' + this.namespace + '-state-disabled')
			.removeAttr('aria-disabled');
	},

	option: function(key, value) {
		var options = key,
			self = this;

		if (typeof key == "string") {
			if (value === undefined) {
				return this._getData(key);
			}
			options = {};
			options[key] = value;
		}

		$.each(options, function(key, value) {
			self._setData(key, value);
		});
	},
	_getData: function(key) {
		return this.options[key];
	},
	_setData: function(key, value) {
		this.options[key] = value;

		if (key == 'disabled') {
			this.element
				[value ? 'addClass' : 'removeClass'](
					this.widgetBaseClass + '-disabled' + ' ' +
					this.namespace + '-state-disabled')
				.attr("aria-disabled", value);
		}
	},

	enable: function() {
		this._setData('disabled', false);
	},
	disable: function() {
		this._setData('disabled', true);
	},

	_trigger: function(type, event, data) {
		var callback = this.options[type],
			eventName = (type == this.widgetEventPrefix
				? type : this.widgetEventPrefix + type);

		event = $.Event(event);
		event.type = eventName;

		// copy original event properties over to the new event
		// this would happen if we could call $.event.fix instead of $.Event
		// but we don't have a way to force an event to be fixed multiple times
		if (event.originalEvent) {
			for (var i = $.event.props.length, prop; i;) {
				prop = $.event.props[--i];
				event[prop] = event.originalEvent[prop];
			}
		}

		this.element.trigger(event, data);

		return !($.isFunction(callback) && callback.call(this.element[0], event, data) === false
			|| event.isDefaultPrevented());
	}
};

$.widget.defaults = {
	disabled: false
};


/** Mouse Interaction Plugin **/

$.ui.mouse = {
	_mouseInit: function() {
		var self = this;

		this.element
			.bind('mousedown.'+this.widgetName, function(event) {
				return self._mouseDown(event);
			})
			.bind('click.'+this.widgetName, function(event) {
				if(self._preventClickEvent) {
					self._preventClickEvent = false;
					event.stopImmediatePropagation();
					return false;
				}
			});

		// Prevent text selection in IE
		if ($.browser.msie) {
			this._mouseUnselectable = this.element.attr('unselectable');
			this.element.attr('unselectable', 'on');
		}

		this.started = false;
	},

	// TODO: make sure destroying one instance of mouse doesn't mess with
	// other instances of mouse
	_mouseDestroy: function() {
		this.element.unbind('.'+this.widgetName);

		// Restore text selection in IE
		($.browser.msie
			&& this.element.attr('unselectable', this._mouseUnselectable));
	},

	_mouseDown: function(event) {
		// don't let more than one widget handle mouseStart
		// TODO: figure out why we have to use originalEvent
		event.originalEvent = event.originalEvent || {};
		if (event.originalEvent.mouseHandled) { return; }

		// we may have missed mouseup (out of window)
		(this._mouseStarted && this._mouseUp(event));

		this._mouseDownEvent = event;

		var self = this,
			btnIsLeft = (event.which == 1),
			elIsCancel = (typeof this.options.cancel == "string" ? $(event.target).parents().add(event.target).filter(this.options.cancel).length : false);
		if (!btnIsLeft || elIsCancel || !this._mouseCapture(event)) {
			return true;
		}

		this.mouseDelayMet = !this.options.delay;
		if (!this.mouseDelayMet) {
			this._mouseDelayTimer = setTimeout(function() {
				self.mouseDelayMet = true;
			}, this.options.delay);
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted = (this._mouseStart(event) !== false);
			if (!this._mouseStarted) {
				event.preventDefault();
				return true;
			}
		}

		// these delegates are required to keep context
		this._mouseMoveDelegate = function(event) {
			return self._mouseMove(event);
		};
		this._mouseUpDelegate = function(event) {
			return self._mouseUp(event);
		};
		$(document)
			.bind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.bind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		// preventDefault() is used to prevent the selection of text here -
		// however, in Safari, this causes select boxes not to be selectable
		// anymore, so this fix is needed
		($.browser.safari || event.preventDefault());

		event.originalEvent.mouseHandled = true;
		return true;
	},

	_mouseMove: function(event) {
		// IE mouseup check - mouseup happened when mouse was out of window
		if ($.browser.msie && !event.button) {
			return this._mouseUp(event);
		}

		if (this._mouseStarted) {
			this._mouseDrag(event);
			return event.preventDefault();
		}

		if (this._mouseDistanceMet(event) && this._mouseDelayMet(event)) {
			this._mouseStarted =
				(this._mouseStart(this._mouseDownEvent, event) !== false);
			(this._mouseStarted ? this._mouseDrag(event) : this._mouseUp(event));
		}

		return !this._mouseStarted;
	},

	_mouseUp: function(event) {
		$(document)
			.unbind('mousemove.'+this.widgetName, this._mouseMoveDelegate)
			.unbind('mouseup.'+this.widgetName, this._mouseUpDelegate);

		if (this._mouseStarted) {
			this._mouseStarted = false;
			this._preventClickEvent = (event.target == this._mouseDownEvent.target);
			this._mouseStop(event);
		}

		return false;
	},

	_mouseDistanceMet: function(event) {
		return (Math.max(
				Math.abs(this._mouseDownEvent.pageX - event.pageX),
				Math.abs(this._mouseDownEvent.pageY - event.pageY)
			) >= this.options.distance
		);
	},

	_mouseDelayMet: function(event) {
		return this.mouseDelayMet;
	},

	// These are placeholder methods, to be overriden by extending plugin
	_mouseStart: function(event) {},
	_mouseDrag: function(event) {},
	_mouseStop: function(event) {},
	_mouseCapture: function(event) { return true; }
};

$.ui.mouse.defaults = {
	cancel: null,
	distance: 1,
	delay: 0
};

})(jQuery);
/*
 * jQuery UI Tabs 1.7.1
 *
 * Copyright (c) 2009 AUTHORS.txt (http://jqueryui.com/about)
 * Dual licensed under the MIT (MIT-LICENSE.txt)
 * and GPL (GPL-LICENSE.txt) licenses.
 *
 * http://docs.jquery.com/UI/Tabs
 *
 * Depends:
 *	ui.core.js
 */
(function($) {

$.widget("ui.tabs", {

	_init: function() {
		if (this.options.deselectable !== undefined) {
			this.options.collapsible = this.options.deselectable;
		}
		this._tabify(true);
	},

	_setData: function(key, value) {
		if (key == 'selected') {
			if (this.options.collapsible && value == this.options.selected) {
				return;
			}
			this.select(value);
		}
		else {
			this.options[key] = value;
			if (key == 'deselectable') {
				this.options.collapsible = value;
			}
			this._tabify();
		}
	},

	_tabId: function(a) {
		return a.title && a.title.replace(/\s/g, '_').replace(/[^A-Za-z0-9\-_:\.]/g, '') ||
			this.options.idPrefix + $.data(a);
	},

	_sanitizeSelector: function(hash) {
		return hash.replace(/:/g, '\\:'); // we need this because an id may contain a ":"
	},

	_cookie: function() {
		var cookie = this.cookie || (this.cookie = this.options.cookie.name || 'ui-tabs-' + $.data(this.list[0]));
		return $.cookie.apply(null, [cookie].concat($.makeArray(arguments)));
	},

	_ui: function(tab, panel) {
		return {
			tab: tab,
			panel: panel,
			index: this.anchors.index(tab)
		};
	},

	_cleanup: function() {
		// restore all former loading tabs labels
		this.lis.filter('.ui-state-processing').removeClass('ui-state-processing')
				.find('span:data(label.tabs)')
				.each(function() {
					var el = $(this);
					el.html(el.data('label.tabs')).removeData('label.tabs');
				});
	},

	_tabify: function(init) {

		this.list = this.element.children('ul');
		//this.list = $('.ui-tabs-nav', this.element);
		this.lis = $('li:has(a[href])', this.list);
		this.anchors = this.lis.map(function() { return $('a', this)[0]; });
		this.panels = $([]);

		var self = this, o = this.options;

		var fragmentId = /^#.+/; // Safari 2 reports '#' for an empty hash
		this.anchors.each(function(i, a) {
			var href = $(a).attr('href');

			// For dynamically created HTML that contains a hash as href IE < 8 expands
			// such href to the full page url with hash and then misinterprets tab as ajax.
			// Same consideration applies for an added tab with a fragment identifier
			// since a[href=#fragment-identifier] does unexpectedly not match.
			// Thus normalize href attribute...
			var hrefBase = href.split('#')[0], baseEl;
			if (hrefBase && (hrefBase === location.toString().split('#')[0] ||
					(baseEl = $('base')[0]) && hrefBase === baseEl.href)) {
				href = a.hash;
				a.href = href;
			}

			// inline tab
			if (fragmentId.test(href)) {
				self.panels = self.panels.add(self._sanitizeSelector(href));
			}

			// remote tab
			else if (href != '#') { // prevent loading the page itself if href is just "#"
				$.data(a, 'href.tabs', href); // required for restore on destroy

				// TODO until #3808 is fixed strip fragment identifier from url
				// (IE fails to load from such url)
				$.data(a, 'load.tabs', href.replace(/#.*$/, '')); // mutable data

				var id = self._tabId(a);
				a.href = '#' + id;
				var $panel = $('#' + id);
				if (!$panel.length) {
					$panel = $(o.panelTemplate).attr('id', id).addClass('ui-tabs-panel ui-widget-content ui-corner-bottom')
						.insertAfter(self.panels[i - 1] || self.list);
					$panel.data('destroy.tabs', true);
				}
				self.panels = self.panels.add($panel);
			}

			// invalid tab href
			else {
				o.disabled.push(i);
			}
		});

		// initialization from scratch
		if (init) {

			// attach necessary classes for styling
			this.element.addClass('ui-tabs ui-widget ui-widget-content ui-corner-all');
			this.list.addClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');
			this.lis.addClass('ui-state-default ui-corner-top');
			this.panels.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom');

			// Selected tab
			// use "selected" option or try to retrieve:
			// 1. from fragment identifier in url
			// 2. from cookie
			// 3. from selected class attribute on <li>
			if (o.selected === undefined) {
				if (location.hash) {
					this.anchors.each(function(i, a) {
						if (a.hash == location.hash) {
							o.selected = i;
							return false; // break
						}
					});
				}
				if (typeof o.selected != 'number' && o.cookie) {
					o.selected = parseInt(self._cookie(), 10);
				}
				if (typeof o.selected != 'number' && this.lis.filter('.ui-tabs-selected').length) {
					o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
				}
				o.selected = o.selected || 0;
			}
			else if (o.selected === null) { // usage of null is deprecated, TODO remove in next release
				o.selected = -1;
			}

			// sanity check - default to first tab...
			o.selected = ((o.selected >= 0 && this.anchors[o.selected]) || o.selected < 0) ? o.selected : 0;

			// Take disabling tabs via class attribute from HTML
			// into account and update option properly.
			// A selected tab cannot become disabled.
			o.disabled = $.unique(o.disabled.concat(
				$.map(this.lis.filter('.ui-state-disabled'),
					function(n, i) { return self.lis.index(n); } )
			)).sort();

			if ($.inArray(o.selected, o.disabled) != -1) {
				o.disabled.splice($.inArray(o.selected, o.disabled), 1);
			}

			// highlight selected tab
			this.panels.addClass('ui-tabs-hide');
			this.lis.removeClass('ui-tabs-selected ui-state-active');
			if (o.selected >= 0 && this.anchors.length) { // check for length avoids error when initializing empty list
				this.panels.eq(o.selected).removeClass('ui-tabs-hide');
				this.lis.eq(o.selected).addClass('ui-tabs-selected ui-state-active');

				// seems to be expected behavior that the show callback is fired
				self.element.queue("tabs", function() {
					self._trigger('show', null, self._ui(self.anchors[o.selected], self.panels[o.selected]));
				});
				
				this.load(o.selected);
			}

			// clean up to avoid memory leaks in certain versions of IE 6
			$(window).bind('unload', function() {
				self.lis.add(self.anchors).unbind('.tabs');
				self.lis = self.anchors = self.panels = null;
			});

		}
		// update selected after add/remove
		else {
			o.selected = this.lis.index(this.lis.filter('.ui-tabs-selected'));
		}

		// update collapsible
		this.element[o.collapsible ? 'addClass' : 'removeClass']('ui-tabs-collapsible');

		// set or update cookie after init and add/remove respectively
		if (o.cookie) {
			this._cookie(o.selected, o.cookie);
		}

		// disable tabs
		for (var i = 0, li; (li = this.lis[i]); i++) {
			$(li)[$.inArray(i, o.disabled) != -1 &&
				!$(li).hasClass('ui-tabs-selected') ? 'addClass' : 'removeClass']('ui-state-disabled');
		}

		// reset cache if switching from cached to not cached
		if (o.cache === false) {
			this.anchors.removeData('cache.tabs');
		}

		// remove all handlers before, tabify may run on existing tabs after add or option change
		this.lis.add(this.anchors).unbind('.tabs');

		if (o.event != 'mouseover') {
			var addState = function(state, el) {
				if (el.is(':not(.ui-state-disabled)')) {
					el.addClass('ui-state-' + state);
				}
			};
			var removeState = function(state, el) {
				el.removeClass('ui-state-' + state);
			};
			this.lis.bind('mouseover.tabs', function() {
				addState('hover', $(this));
			});
			this.lis.bind('mouseout.tabs', function() {
				removeState('hover', $(this));
			});
			this.anchors.bind('focus.tabs', function() {
				addState('focus', $(this).closest('li'));
			});
			this.anchors.bind('blur.tabs', function() {
				removeState('focus', $(this).closest('li'));
			});
		}

		// set up animations
		var hideFx, showFx;
		if (o.fx) {
			if ($.isArray(o.fx)) {
				hideFx = o.fx[0];
				showFx = o.fx[1];
			}
			else {
				hideFx = showFx = o.fx;
			}
		}

		// Reset certain styles left over from animation
		// and prevent IE's ClearType bug...
		function resetStyle($el, fx) {
			$el.css({ display: '' });
			if ($.browser.msie && fx.opacity) {
				$el[0].style.removeAttribute('filter');
			}
		}

		// Show a tab...
		var showTab = showFx ?
			function(clicked, $show) {
				$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
				$show.hide().removeClass('ui-tabs-hide') // avoid flicker that way
					.animate(showFx, showFx.duration || 'normal', function() {
						resetStyle($show, showFx);
						self._trigger('show', null, self._ui(clicked, $show[0]));
					});
			} :
			function(clicked, $show) {
				$(clicked).closest('li').removeClass('ui-state-default').addClass('ui-tabs-selected ui-state-active');
				$show.removeClass('ui-tabs-hide');
				self._trigger('show', null, self._ui(clicked, $show[0]));
			};

		// Hide a tab, $show is optional...
		var hideTab = hideFx ?
			function(clicked, $hide) {
				$hide.animate(hideFx, hideFx.duration || 'normal', function() {
					self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
					$hide.addClass('ui-tabs-hide');
					resetStyle($hide, hideFx);
					self.element.dequeue("tabs");
				});
			} :
			function(clicked, $hide, $show) {
				self.lis.removeClass('ui-tabs-selected ui-state-active').addClass('ui-state-default');
				$hide.addClass('ui-tabs-hide');
				self.element.dequeue("tabs");
			};

		// attach tab event handler, unbind to avoid duplicates from former tabifying...
		this.anchors.bind(o.event + '.tabs', function() {
			var el = this, $li = $(this).closest('li'), $hide = self.panels.filter(':not(.ui-tabs-hide)'),
					$show = $(self._sanitizeSelector(this.hash));

			// If tab is already selected and not collapsible or tab disabled or
			// or is already loading or click callback returns false stop here.
			// Check if click handler returns false last so that it is not executed
			// for a disabled or loading tab!
			if (($li.hasClass('ui-tabs-selected') && !o.collapsible) ||
				$li.hasClass('ui-state-disabled') ||
				$li.hasClass('ui-state-processing') ||
				self._trigger('select', null, self._ui(this, $show[0])) === false) {
				this.blur();
				return false;
			}

			o.selected = self.anchors.index(this);

			self.abort();

			// if tab may be closed
			if (o.collapsible) {
				if ($li.hasClass('ui-tabs-selected')) {
					o.selected = -1;

					if (o.cookie) {
						self._cookie(o.selected, o.cookie);
					}

					self.element.queue("tabs", function() {
						hideTab(el, $hide);
					}).dequeue("tabs");
					
					this.blur();
					return false;
				}
				else if (!$hide.length) {
					if (o.cookie) {
						self._cookie(o.selected, o.cookie);
					}
					
					self.element.queue("tabs", function() {
						showTab(el, $show);
					});

					self.load(self.anchors.index(this)); // TODO make passing in node possible, see also http://dev.jqueryui.com/ticket/3171
					
					this.blur();
					return false;
				}
			}

			if (o.cookie) {
				self._cookie(o.selected, o.cookie);
			}

			// show new tab
			if ($show.length) {
				if ($hide.length) {
					self.element.queue("tabs", function() {
						hideTab(el, $hide);
					});
				}
				self.element.queue("tabs", function() {
					showTab(el, $show);
				});
				
				self.load(self.anchors.index(this));
			}
			else {
				throw 'jQuery UI Tabs: Mismatching fragment identifier.';
			}

			// Prevent IE from keeping other link focussed when using the back button
			// and remove dotted border from clicked link. This is controlled via CSS
			// in modern browsers; blur() removes focus from address bar in Firefox
			// which can become a usability and annoying problem with tabs('rotate').
			if ($.browser.msie) {
				this.blur();
			}

		});

		// disable click in any case
		this.anchors.bind('click.tabs', function(){return false;});

	},

	destroy: function() {
		var o = this.options;

		this.abort();
		
		this.element.unbind('.tabs')
			.removeClass('ui-tabs ui-widget ui-widget-content ui-corner-all ui-tabs-collapsible')
			.removeData('tabs');

		this.list.removeClass('ui-tabs-nav ui-helper-reset ui-helper-clearfix ui-widget-header ui-corner-all');

		this.anchors.each(function() {
			var href = $.data(this, 'href.tabs');
			if (href) {
				this.href = href;
			}
			var $this = $(this).unbind('.tabs');
			$.each(['href', 'load', 'cache'], function(i, prefix) {
				$this.removeData(prefix + '.tabs');
			});
		});

		this.lis.unbind('.tabs').add(this.panels).each(function() {
			if ($.data(this, 'destroy.tabs')) {
				$(this).remove();
			}
			else {
				$(this).removeClass([
					'ui-state-default',
					'ui-corner-top',
					'ui-tabs-selected',
					'ui-state-active',
					'ui-state-hover',
					'ui-state-focus',
					'ui-state-disabled',
					'ui-tabs-panel',
					'ui-widget-content',
					'ui-corner-bottom',
					'ui-tabs-hide'
				].join(' '));
			}
		});

		if (o.cookie) {
			this._cookie(null, o.cookie);
		}
	},

	add: function(url, label, index) {
		if (index === undefined) {
			index = this.anchors.length; // append by default
		}

		var self = this, o = this.options,
			$li = $(o.tabTemplate.replace(/#\{href\}/g, url).replace(/#\{label\}/g, label)),
			id = !url.indexOf('#') ? url.replace('#', '') : this._tabId($('a', $li)[0]);

		$li.addClass('ui-state-default ui-corner-top').data('destroy.tabs', true);

		// try to find an existing element before creating a new one
		var $panel = $('#' + id);
		if (!$panel.length) {
			$panel = $(o.panelTemplate).attr('id', id).data('destroy.tabs', true);
		}
		$panel.addClass('ui-tabs-panel ui-widget-content ui-corner-bottom ui-tabs-hide');

		if (index >= this.lis.length) {
			$li.appendTo(this.list);
			$panel.appendTo(this.list[0].parentNode);
		}
		else {
			$li.insertBefore(this.lis[index]);
			$panel.insertBefore(this.panels[index]);
		}

		o.disabled = $.map(o.disabled,
			function(n, i) { return n >= index ? ++n : n; });

		this._tabify();

		if (this.anchors.length == 1) { // after tabify
			$li.addClass('ui-tabs-selected ui-state-active');
			$panel.removeClass('ui-tabs-hide');
			this.element.queue("tabs", function() {
				self._trigger('show', null, self._ui(self.anchors[0], self.panels[0]));
			});
				
			this.load(0);
		}

		// callback
		this._trigger('add', null, this._ui(this.anchors[index], this.panels[index]));
	},

	remove: function(index) {
		var o = this.options, $li = this.lis.eq(index).remove(),
			$panel = this.panels.eq(index).remove();

		// If selected tab was removed focus tab to the right or
		// in case the last tab was removed the tab to the left.
		if ($li.hasClass('ui-tabs-selected') && this.anchors.length > 1) {
			this.select(index + (index + 1 < this.anchors.length ? 1 : -1));
		}

		o.disabled = $.map($.grep(o.disabled, function(n, i) { return n != index; }),
			function(n, i) { return n >= index ? --n : n; });

		this._tabify();

		// callback
		this._trigger('remove', null, this._ui($li.find('a')[0], $panel[0]));
	},

	enable: function(index) {
		var o = this.options;
		if ($.inArray(index, o.disabled) == -1) {
			return;
		}

		this.lis.eq(index).removeClass('ui-state-disabled');
		o.disabled = $.grep(o.disabled, function(n, i) { return n != index; });

		// callback
		this._trigger('enable', null, this._ui(this.anchors[index], this.panels[index]));
	},

	disable: function(index) {
		var self = this, o = this.options;
		if (index != o.selected) { // cannot disable already selected tab
			this.lis.eq(index).addClass('ui-state-disabled');

			o.disabled.push(index);
			o.disabled.sort();

			// callback
			this._trigger('disable', null, this._ui(this.anchors[index], this.panels[index]));
		}
	},

	select: function(index) {
		if (typeof index == 'string') {
			index = this.anchors.index(this.anchors.filter('[href$=' + index + ']'));
		}
		else if (index === null) { // usage of null is deprecated, TODO remove in next release
			index = -1;
		}
		if (index == -1 && this.options.collapsible) {
			index = this.options.selected;
		}

		this.anchors.eq(index).trigger(this.options.event + '.tabs');
	},

	load: function(index) {
		var self = this, o = this.options, a = this.anchors.eq(index)[0], url = $.data(a, 'load.tabs');

		this.abort();

		// not remote or from cache
		if (!url || this.element.queue("tabs").length !== 0 && $.data(a, 'cache.tabs')) {
			this.element.dequeue("tabs");
			return;
		}

		// load remote from here on
		this.lis.eq(index).addClass('ui-state-processing');

		if (o.spinner) {
			var span = $('span', a);
			span.data('label.tabs', span.html()).html(o.spinner);
		}

		this.xhr = $.ajax($.extend({}, o.ajaxOptions, {
			url: url,
			success: function(r, s) {
				$(self._sanitizeSelector(a.hash)).html(r);

				// take care of tab labels
				self._cleanup();

				if (o.cache) {
					$.data(a, 'cache.tabs', true); // if loaded once do not load them again
				}

				// callbacks
				self._trigger('load', null, self._ui(self.anchors[index], self.panels[index]));
				try {
					o.ajaxOptions.success(r, s);
				}
				catch (e) {}

				// last, so that load event is fired before show...
				self.element.dequeue("tabs");
			}
		}));
	},

	abort: function() {
		// stop possibly running animations
		this.element.queue([]);
		this.panels.stop(false, true);

		// terminate pending requests from other tabs
		if (this.xhr) {
			this.xhr.abort();
			delete this.xhr;
		}

		// take care of tab labels
		this._cleanup();

	},

	url: function(index, url) {
		this.anchors.eq(index).removeData('cache.tabs').data('load.tabs', url);
	},

	length: function() {
		return this.anchors.length;
	}

});

$.extend($.ui.tabs, {
	version: '1.7.1',
	getter: 'length',
	defaults: {
		ajaxOptions: null,
		cache: false,
		cookie: null, // e.g. { expires: 7, path: '/', domain: 'jquery.com', secure: true }
		collapsible: false,
		disabled: [],
		event: 'click',
		fx: null, // e.g. { height: 'toggle', opacity: 'toggle', duration: 200 }
		idPrefix: 'ui-tabs-',
		panelTemplate: '<div></div>',
		spinner: '<em>Loading&#8230;</em>',
		tabTemplate: '<li><a href="#{href}"><span>#{label}</span></a></li>'
	}
});

/*
 * Tabs Extensions
 */

/*
 * Rotate
 */
$.extend($.ui.tabs.prototype, {
	rotation: null,
	rotate: function(ms, continuing) {

		var self = this, o = this.options;
		
		var rotate = self._rotate || (self._rotate = function(e) {
			clearTimeout(self.rotation);
			self.rotation = setTimeout(function() {
				var t = o.selected;
				self.select( ++t < self.anchors.length ? t : 0 );
			}, ms);
			
			if (e) {
				e.stopPropagation();
			}
		});
		
		var stop = self._unrotate || (self._unrotate = !continuing ?
			function(e) {
				if (e.clientX) { // in case of a true click
					self.rotate(null);
				}
			} :
			function(e) {
				t = o.selected;
				rotate();
			});

		// start rotation
		if (ms) {
			this.element.bind('tabsshow', rotate);
			this.anchors.bind(o.event + '.tabs', stop);
			rotate();
		}
		// stop rotation
		else {
			clearTimeout(self.rotation);
			this.element.unbind('tabsshow', rotate);
			this.anchors.unbind(o.event + '.tabs', stop);
			delete this._rotate;
			delete this._unrotate;
		}
	}
});

})(jQuery);
//##############################################################################
// The $class Library, version 1.5
// Copyright 2006, Jeff Lau
// License: http://creativecommons.org/licenses/LGPL/2.1/
// Contact: jlau@uselesspickles.com
// Web:     www.uselesspickles.com
//##############################################################################
// CUSTOMIZE FOR PORTABILITY:
//
//   Portions of the $class library depend on having a reference to the global
// object. By default, the $class library is configured to work with web
// browsers by expecting the global object to be named "self". To configure
// the $class library to work in other environments, create a global variable
// named "GLOBAL_NAMESPACE_OBJECT_NAME" that contains a String representing the
// name of an object that refers to the global object. This variable must be
// defined before making any calls to the $class library.
//
// Example:
//   var GLOBAL_NAMESPACE_OBJECT_NAME = "global";
//
//##############################################################################

$class_library = {
  version: "1.5",

  _getGlobalObjectName: function() {
    try {
      this._globalObjectName = GLOBAL_NAMESPACE_OBJECT_NAME;
    } catch (error) {
      this._globalObjectName = "self";
    }

    this._getGlobalObjectName = Function("return this._globalObjectName");

    return this._globalObjectName;
  },

  _getGlobalObject: function() {
    this._globalObject = eval("(" + this._getGlobalObjectName() + ")");
    this._getGlobalObject = Function("return this._globalObject");

    return this._globalObject;
  },

  _copyObject: function(obj1, obj2) {
    var result = (arguments.length == 2 && obj1) ? obj1 : {};
    var source = ((arguments.length == 2) ? obj2 : obj1) || {};

    for (var i in source) {
      result[i] = source[i];
    }

    return result;
  },
  
  _surrogateCtor: function() {
  }
};

//##############################################################################

function $package(name) {
  // if being called as a constructor...
  if (this instanceof $package) {
    this._name = name;
    return;
  }

  if (!name) {
    $package._currentPackage = null;
    return;
  }

  var components = name.split(".");
  var context = $class_library._getGlobalObject();

  for (var i = 0; i < components.length; ++i) {
    var nextContext = context[components[i]];

    if (!nextContext) {
      nextContext = new $package(components.slice(0, i + 1).join("."));
      context[components[i]] = nextContext;
    }

    context = nextContext;
  }

  $package._currentPackage = context;
}

$package.prototype = {
  getName: function() {
    return this._name;
  },

  toString: function() {
    return "[$package " + this.getName() + "]";
  }
};

//##############################################################################

function $class(name, descriptor) {
  // if being called as a constructor...
  if (this instanceof $class) {
    this._name = name;
    this._isNative = descriptor.isNative;
    this._ctor = descriptor.ctor;
    this._baseCtor = descriptor.baseCtor || (this._ctor == Object ? null : Object);
    this._interfaces = {};

    // if not creating $class for Object...
    if (this._ctor != Object) {
      // if inheriting something other than Object...
      if (this._baseCtor != Object) {
        // if this $class object is being created internally by the $class function...
        if (descriptor.calledFrom$class) {
          // a 'surrogate' constructor is used to create inheritance relationship
          // without actually invoking the base class's constructor code
          $class_library._surrogateCtor.prototype = this._baseCtor.prototype;
          this._ctor.prototype = new $class_library._surrogateCtor();
          this._ctor.prototype.constructor = this._ctor;
        }

        // inherit info about the base class
        this._interfaces = $class_library._copyObject(this._baseCtor.$class._interfaces);
      }
      
      // store this class info on the prototype
      this._ctor.prototype._$class = this;
    }

    return;
  }

  if ($package._currentPackage) {
    name = $package._currentPackage.getName() + "." + name;
  }

  var baseCtor = descriptor.$extends || Object;
  var ctorName = name.replace(/[^.]*\./g, "");
  var ctor = descriptor.$constructor || descriptor[ctorName];

  var uses$base = /\bthis\.\$base\b/;
  var isTrivialCtor = /^\s*function[^(]*\([^)]*\)[^{]*\{\s*(return)?\s*;?\s*\}\s*$/;

  if (!ctor) {
    ctor = new Function();
  }
  
  if (isTrivialCtor.test(ctor)) {
    ctor._$class_isTrivialCtor = true;
    
    if (baseCtor != Object) {
      ctor._$class_relevantImplementation = baseCtor._$class_relevantImplementation || baseCtor;
    }
  }

  if (uses$base.test(ctor)) {
    ctor = $class._wrapExtendedMethod(ctor, baseCtor);
  } else if (!baseCtor._$class_isTrivialCtor) {
    ctor = $class._wrapExtendedCtor(ctor, baseCtor);
  }
  
  ctor.$class = new $class(name, {ctor:ctor, baseCtor:baseCtor, calledFrom$class:true});

  // implement interfaces
  if (descriptor.$implements != null) {
    var ifaces = descriptor.$implements;

    // convert to an array if it is a single object
    if (!(ifaces instanceof Array)) {
      ifaces = [ifaces];
    }

    for (var i = 0, ifacesLength = ifaces.length; i < ifacesLength; ++i) {
      $class_library._copyObject(ctor.$class._interfaces, ifaces[i]._interfaces);
    }
  }

  var specialProperties = {$constructor:true,$extends:true,$implements:true,$static:true};
  specialProperties[ctorName] = true;

  // process all properties in the class descriptor
  for (var propertyName in descriptor) {
    // skip over special properties
    if (specialProperties.hasOwnProperty(propertyName)) {
      continue;
    }

    var value = descriptor[propertyName];

    if (value instanceof $class._ModifiedProperty) {
      // In the release version, only the static modifier results in a
      // $class._ModifiedProperty object, so there is no need to check
      // the modifier value
      ctor[propertyName] = value.value;
      continue;
    }

    if (value instanceof Function && uses$base.test(value)) {
      // wrap the method to give it access to the special $base property
      value = $class._wrapExtendedMethod(value, ctor.prototype[propertyName]);
    }

    ctor.prototype[propertyName] = value;
  }

  // set default toString method
  if (ctor.prototype.toString == Object.prototype.toString) {
    ctor.prototype.toString = new Function(
      "return \"[object \" + $class.typeOf(this) + \"]\";"
    );
  }

  // store the constructor so it is accessible by the specified name
  eval(name + " = ctor;");

  //  call the static initializer
  if (descriptor.$static) {
    descriptor.$static.call(ctor);
  }
}

//##############################################################################

$class.prototype = {
  getName: function() {
    return this._name;
  },

  isNative: function() {
    return this._isNative;
  },

  getConstructor: function() {
    return this._ctor;
  },

  getSuperclass: function() {
    return this._baseCtor ? this._baseCtor.$class : null;
  },

  isInstance: function(obj) {
    return $class.instanceOf(obj, this._ctor);
  },

  implementsInterface: function(iface) {
    return this._interfaces.hasOwnProperty(iface.getName());
  },

  toString: function() {
    return "[$class " + this._name + "]";
  }
};

//##############################################################################

$class._wrapExtendedMethod = function(method, baseMethod) {
  var result = new Function(
    "var m=arguments.callee;" +
    "var h=this.$base;" +
    "this.$base=m._$class_baseMethod;" +
    "try{return m._$class_wrappedMethod.apply(this,arguments);}" +
    "finally{this.$base=h;}"
  );

  result._$class_wrappedMethod = method;
  result._$class_baseMethod = baseMethod._$class_relevantImplementation || baseMethod;
  result.toString = $class._wrappedMethod_toString;

  return result;
};

//##############################################################################

$class._wrapExtendedCtor = function(method, baseMethod) {
  var result = new Function(
    "arguments.callee._$class_baseMethod.apply(this,arguments);" +
    (method._$class_isTrivialCtor ?
      "" : // no need to call an empty function
      "arguments.callee._$class_wrappedMethod.apply(this,arguments);")
  );

  result._$class_wrappedMethod = method;
  result._$class_baseMethod = baseMethod._$class_relevantImplementation || baseMethod;
  result.toString = $class._wrappedMethod_toString;

  if (method._$class_isTrivialCtor) {
    result._$class_relevantImplementation = result._$class_baseMethod;
  }

  return result;
};

//##############################################################################

$class._wrappedMethod_toString = function() {
  return String(this._$class_wrappedMethod);
};

//##############################################################################

$class._ModifiedProperty = function(modifier, value) {
  this.modifier = modifier;
  this.value = value;
};

//##############################################################################

$class.resolve = function(qualifiedName) {
  try {
    return eval("(" + $class_library._getGlobalObjectName() + "." + qualifiedName + ")");
  } catch(error) {
    return undefined;
  }
};

//##############################################################################

$class.implementationOf = function(obj, iface) {
  return $class.getClass(obj).implementsInterface(iface);
};

//##############################################################################

$class.instanceOf = function(obj, type) {
  if (type instanceof $interface) {
    return $class.implementationOf(obj, type);
  }

  switch (typeof obj) {
    case "object":
      return (obj instanceof type) ||
             // special case for null
             (obj === null && type == Null) ||
             // allow RegExp to be considered an instance of Function
             (obj instanceof RegExp) && (type == Function);

    case "number":
      return (type == Number);

    case "string":
      return (type == String);

    case "boolean":
      return (type == Boolean);

    case "function":
      return (type == Function) ||
             // see if it's really a RegExp (because typeof identifies regular
             // expressions as functions in Firefox)
             (obj instanceof RegExp) && (type == RegExp);

    case "undefined":
      return (type == Undefined);
  }

  return false;
};

//##############################################################################

$class.typeOf = function(obj) {
  return $class.getClass(obj).getName();
};

//##############################################################################

$class.getClass = function(obj) {
  if (obj == null) {
    if (obj === undefined) {
      return Undefined.$class;
    }

    return Null.$class;
  }

  return obj._$class || Object.$class;
};

//##############################################################################

$class.instantiate = function(ctor, args) {
  if (ctor.$class && ctor.$class.isNative()) {
    return ctor.apply($class_library._getGlobalObject(), args);
  } else {
    $class_library._surrogateCtor.prototype = ctor.prototype;
    var result = new $class_library._surrogateCtor();
    ctor.apply(result, args);

    return result;
  }
};

//##############################################################################

function $interface(name, descriptor) {
  // if being called as a constructor...
  if (this instanceof $interface) {
    this._name = name;
    this._methods = {};
    this._methodsArray = null;
    this._interfaces = {};
    this._interfaces[name] = this;
    return;
  }

  if ($package._currentPackage) {
    name = $package._currentPackage.getName() + "." + name;
  }

  var iface = new $interface(name);

  // extend interfaces
  if (descriptor.$extends != null) {
    var ifaces = descriptor.$extends;

    // convert to an array if it is a single object
    if (!(ifaces instanceof Array)) {
      ifaces = [ifaces];
    }

    for (var i = 0, ifacesLength = ifaces.length; i < ifacesLength; ++i) {
      $class_library._copyObject(iface._methods, ifaces[i]._methods);
      $class_library._copyObject(iface._interfaces, ifaces[i]._interfaces);
    }
  }

  // process all properties in the descriptor
  for (var propertyName in descriptor) {
    // skip over the special properties
    if (propertyName == "$extends") {
      continue;
    }

    var value = descriptor[propertyName];

    if (value instanceof $class._ModifiedProperty) {
      iface[propertyName] = value.value;
    } else {
      iface._methods[propertyName] = iface._name;
    }
  }

  // store the interface so it can be referenced by the specified name
  eval(name + " = iface;");
}

//##############################################################################

$interface.prototype = {
  getName: function() {
    return this._name;
  },
  
  hasMethod: function(methodName) {
    return Boolean(this._methods[methodName]);
  },

  getMethods: function() {
    if (!this._methodsArray) {
      this._methodsArray = [];
      
      for (var methodName in this._methods) {
        this._methodsArray.push(methodName);
      }
    }
    
    return this._methodsArray;
  },

  toString: function() {
    return "[$interface " + this._name + "]";
  }
};

//##############################################################################

function $abstract(method) {
  // abstract modifier always ignored in release version
  return method;
}

function $static(value) {
  return new $class._ModifiedProperty("static", value);
}

function $final(method) {
  // final modifier always ignored in release version
  return method;
}

//##############################################################################
/*
$package.$class   = new $class("$package",   {ctor:$package});
$class.$class     = new $class("$class",     {ctor:$class});
$interface.$class = new $class("$interface", {ctor:$interface});

Object.$class   = new $class("Object",   {isNative:true, ctor:Object});
Object._$class_isTrivialCtor = true;

Array.$class    = new $class("Array",    {isNative:true, ctor:Array});
String.$class   = new $class("String",   {isNative:true, ctor:String});
Number.$class   = new $class("Number",   {isNative:true, ctor:Number});
Boolean.$class  = new $class("Boolean",  {isNative:true, ctor:Boolean});
Function.$class = new $class("Function", {isNative:true, ctor:Function});
RegExp.$class   = new $class("RegExp",   {isNative:true, ctor:RegExp, baseCtor:Function});
Date.$class     = new $class("Date",     {isNative:true, ctor:Date});

Error.$class          = new $class("Error",          {isNative:true, ctor:Error});
EvalError.$class      = new $class("EvalError",      {isNative:true, ctor:EvalError,      baseCtor:Error});
RangeError.$class     = new $class("RangeError",     {isNative:true, ctor:RangeError,     baseCtor:Error});
ReferenceError.$class = new $class("ReferenceError", {isNative:true, ctor:ReferenceError, baseCtor:Error});
SyntaxError.$class    = new $class("SyntaxError",    {isNative:true, ctor:SyntaxError,    baseCtor:Error});
TypeError.$class      = new $class("TypeError",      {isNative:true, ctor:TypeError,      baseCtor:Error});
URIError.$class       = new $class("URIError",       {isNative:true, ctor:URIError,       baseCtor:Error});

//##############################################################################

$class("Undefined", {
  Undefined: $final(function() {
    throw new Error("Attempted instantiation of the Undefined class.");
  })
});

$class("Null", {
  Null: $final(function() {
    throw new Error("Attempted instantiation of the Null class.");
  })
});

//##############################################################################

$class("Exception", {
  $extends: Error,

  Exception: function(message) {
    this.message = String(message);
    this.name = $class.typeOf(this);
  },

  getName: $final(function() {
    return this.name;
  }),

  getMessage: $final(function() {
    return this.message;
  }),

  toString: $final(function() {
    return "[error " + this.getName() + "] " + this.getMessage();
  })
});

//##############################################################################
*//*
MIT LICENSE
Copyright (c) 2007 Monsur Hossain (http://www.monsur.com)

Permission is hereby granted, free of charge, to any person
obtaining a copy of this software and associated documentation
files (the "Software"), to deal in the Software without
restriction, including without limitation the rights to use,
copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the
Software is furnished to do so, subject to the following
conditions:

The above copyright notice and this permission notice shall be
included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.
*/

// ****************************************************************************
// CachePriority ENUM
// An easier way to refer to the priority of a cache item
var CachePriority = {
    Low: 1,
    Normal: 2,
    High: 4
}

// ****************************************************************************
// Cache constructor
// Creates a new cache object
// INPUT: maxSize (optional) - indicates how many items the cache can hold.
//                             default is -1, which means no limit on the 
//                             number of items.
function Cache(maxSize) {
    this.items = {};
    this.count = 0;
    if (maxSize == null)
        maxSize = -1;
    this.maxSize = maxSize;
    this.fillFactor = .75;
    this.purgeSize = Math.round(this.maxSize * this.fillFactor);
    
    this.stats = {}
    this.stats.hits = 0;
    this.stats.misses = 0;
}

// ****************************************************************************
// Cache.getItem
// retrieves an item from the cache, returns null if the item doesn't exist
// or it is expired.
// INPUT: key - the key to load from the cache
Cache.prototype.getItem = function(key) {

    // retrieve the item from the cache
    var item = this.items[key];
    
    if (item != null) {
        if (!this._isExpired(item)) {
            // if the item is not expired
            // update its last accessed date
            item.lastAccessed = new Date().getTime();
        } else {
            // if the item is expired, remove it from the cache
            this._removeItem(key);
            item = null;
        }
    }
    
    // return the item value (if it exists), or null
    var returnVal = null;
    if (item != null) {
        returnVal = item.value;
        this.stats.hits++;
    } else {
        this.stats.misses++;
    }
    return returnVal;
}

// ****************************************************************************
// Cache.setItem
// sets an item in the cache
// parameters: key - the key to refer to the object
//             value - the object to cache
//             options - an optional parameter described below
// the last parameter accepts an object which controls various caching options:
//      expirationAbsolute: the datetime when the item should expire
//      expirationSliding: an integer representing the seconds since
//                         the last cache access after which the item
//                         should expire
//      priority: How important it is to leave this item in the cache.
//                You can use the values CachePriority.Low, .Normal, or 
//                .High, or you can just use an integer.  Note that 
//                placing a priority on an item does not guarantee 
//                it will remain in cache.  It can still be purged if 
//                an expiration is hit, or if the cache is full.
//      callback: A function that gets called when the item is purged
//                from cache.  The key and value of the removed item
//                are passed as parameters to the callback function.
Cache.prototype.setItem = function(key, value, options) {

    function CacheItem(k, v, o) {
        if ((k == null) || (k == ''))
            throw new Error("key cannot be null or empty");
        this.key = k;
        this.value = v;
        if (o == null)
            o = {};
        if (o.expirationAbsolute != null)
            o.expirationAbsolute = o.expirationAbsolute.getTime();
        if (o.priority == null)
            o.priority = CachePriority.Normal;
        this.options = o;
        this.lastAccessed = new Date().getTime();
    }

    // add a new cache item to the cache
    if (this.items[key] != null)
        this._removeItem(key);
    this._addItem(new CacheItem(key, value, options));
    
    // if the cache is full, purge it
    if ((this.maxSize > 0) && (this.count > this.maxSize)) {
        this._purge();
    }
}

// ****************************************************************************
// Cache.clear
// Remove all items from the cache
Cache.prototype.clear = function() {

    // loop through each item in the cache and remove it
    for (var key in this.items) {
      this._removeItem(key);
    }  
}

// ****************************************************************************
// Cache._purge (PRIVATE FUNCTION)
// remove old elements from the cache
Cache.prototype._purge = function() {
    
    var tmparray = new Array();
    
    // loop through the cache, expire items that should be expired
    // otherwise, add the item to an array
    for (var key in this.items) {
        var item = this.items[key];
        if (this._isExpired(item)) {
            this._removeItem(key);
        } else {
            tmparray.push(item);
        }
    }
    
    if (tmparray.length > this.purgeSize) {

        // sort this array based on cache priority and the last accessed date
        tmparray = tmparray.sort(function(a, b) { 
            if (a.options.priority != b.options.priority) {
                return b.options.priority - a.options.priority;
            } else {
                return b.lastAccessed - a.lastAccessed;
            }
        });
        
        // remove items from the end of the array
        while (tmparray.length > this.purgeSize) {
            var ritem = tmparray.pop();
            this._removeItem(ritem.key);
        }
    }
}

// ****************************************************************************
// Cache._addItem (PRIVATE FUNCTION)
// add an item to the cache
Cache.prototype._addItem = function(item) {
    this.items[item.key] = item;
    this.count++;
}

// ****************************************************************************
// Cache._removeItem (PRIVATE FUNCTION)
// Remove an item from the cache, call the callback function (if necessary)
Cache.prototype._removeItem = function(key) {
    var item = this.items[key];
    delete this.items[key];
    this.count--;
    
    // if there is a callback function, call it at the end of execution
    if (item.options.callback != null) {
        var callback = function() {
            item.options.callback(item.key, item.value);
        }
        setTimeout(callback, 0);
    }
}

// ****************************************************************************
// Cache._isExpired (PRIVATE FUNCTION)
// Returns true if the item should be expired based on its expiration options
Cache.prototype._isExpired = function(item) {
    var now = new Date().getTime();
    var expired = false;
    if ((item.options.expirationAbsolute) && (item.options.expirationAbsolute < now)) {
        // if the absolute expiration has passed, expire the item
        expired = true;
    } 
    if ((expired == false) && (item.options.expirationSliding)) {
        // if the sliding expiration has passed, expire the item
        var lastAccess = item.lastAccessed + (item.options.expirationSliding * 1000);
        if (lastAccess < now) {
            expired = true;
        }
    }
    return expired;
}

Cache.prototype.toHtmlString = function() {
    var returnStr = this.count + " item(s) in cache<br /><ul>";
    for (var key in this.items) {
        var item = this.items[key];
        returnStr = returnStr + "<li>" + item.key.toString() + " = " + item.value.toString() + "</li>";
    }
    returnStr = returnStr + "</ul>";
    return returnStr;
}
/*
 * jQuery Tooltip plugin 1.3
 *
 * http://bassistance.de/jquery-plugins/jquery-plugin-tooltip/
 * http://docs.jquery.com/Plugins/Tooltip
 *
 * Copyright (c) 2006 - 2008 JÃ¶rn Zaefferer
 *
 * $Id: jquery.tooltip.js 5741 2008-06-21 15:22:16Z joern.zaefferer $
 * 
 * Dual licensed under the MIT and GPL licenses:
 *   http://www.opensource.org/licenses/mit-license.php
 *   http://www.gnu.org/licenses/gpl.html
 */
 
;(function($) {

    // the tooltip element
    var helper = {},
    // the current tooltipped element
		current,
    // the title of the current element, used for restoring
		title,
    // timeout id for delayed tooltips
		tID,
    // IE 5.5 or 6
		IE = $.browser.msie && /MSIE\s(5\.5|6\.)/.test(navigator.userAgent),
    // flag for mouse tracking
		track = false;

    $.tooltip = {
        blocked: false,
        defaults: {
            delay: 200,
            fade: false,
            showURL: true,
            extraClass: "",
            top: 15,
            left: 15,
            id: "tooltip",
            useClick: false
        },
        block: function() {
            $.tooltip.blocked = !$.tooltip.blocked;
        }
    };

    $.fn.extend({
        tooltip: function(settings) {
            settings = $.extend({}, $.tooltip.defaults, settings);
            createHelper(settings);
            if (settings.useClick)
                return this.each(function() {
                    $.data(this, "tooltip", settings);
                    this.tOpacity = helper.parent.css("opacity");
                    // copy tooltip into its own expando and remove the title
                    this.tooltipText = this.title;
                    $(this).removeAttr("title");
                    // also remove alt attribute to prevent default tooltip in IE
                    this.alt = "";
                })
				.toggle(save, hide);
            else
                return this.each(function() {
                    $.data(this, "tooltip", settings);
                    this.tOpacity = helper.parent.css("opacity");
                    // copy tooltip into its own expando and remove the title
                    this.tooltipText = this.title;
                    $(this).removeAttr("title");
                    // also remove alt attribute to prevent default tooltip in IE
                    this.alt = "";
                })
				    .mouseover(save)
				    .mouseout(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(settings) {
        // there can be only one tooltip helper
        if (helper.parent)
            return;
        // create the helper, h3 for title, div for url
        helper.parent = $('<div id="' + settings.id + '"><h3><a href="#">close</a>&nbsp;</h3><div class="body"></div><div class="url"></div></div>')
        // add to document
			.appendTo(document.body)
        // hide it at first
			.hide();

        // apply bgiframe if available
        if ($.fn.bgiframe)
            helper.parent.bgiframe();

        // save references to title and url elements
        helper.title = $('h3', helper.parent);
        helper.body = $('div.body', helper.parent);
        helper.url = $('div.url', helper.parent);
    }

    function settings(element) {
        return $.data(element, "tooltip");
    }

    // main event handler to start showing tooltips
    function handle(event) {
        // show helper, either with timeout or on instant
        if (settings(this).delay)
            tID = setTimeout(show, settings(this).delay);
        else
            show();

        // if selected, update the helper position when the mouse moves
        track = !!settings(this).track;
        $(document.body).bind('mousemove', update);

        // update at least once
        update(event);
    }

    // save elements title before the tooltip is displayed
    function save() {
        // if this is the current source, or it has no title (occurs with click event), stop
        if ($.tooltip.blocked || this == current || (!this.tooltipText && !settings(this).bodyHandler))
            return;

        // save current
        current = this;
        title = this.tooltipText;

        if (settings(this).bodyHandler) {
            helper.title.hide();
            var bodyContent = settings(this).bodyHandler.call(this);
            if (bodyContent.nodeType || bodyContent.jquery) {
                helper.body.empty().append(bodyContent)
            } else {
                helper.body.html(bodyContent);
            }
            helper.body.show();
        } else if (settings(this).showBody) {
            var parts = title.split(settings(this).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 if (settings(this).useClick) {
            helper.body.html(title).show();
            $("a", helper.title).click(function() { $(current).click(); return false; });
            //helper.title.append("<span onclick='Javascript:alert(\"t\");'>here</span>");
        } else {
            helper.title.html(title).show();
            helper.body.hide();
        }



        // if element has href or src, add and show it, otherwise hide it
        if (settings(this).showURL && $(this).url())
            helper.url.html($(this).url().replace('http://', '')).show();
        else
            helper.url.hide();

        // add an optional class for this tip
        helper.parent.addClass(settings(this).extraClass);

        // fix PNG background for IE
        if (settings(this).fixPNG)
            helper.parent.fixPNG();

        handle.apply(this, arguments);
    }

    // delete timeout and show helper
    function show() {
        tID = null;
        if ((!IE || !$.fn.bgiframe) && settings(current).fade) {
            if (helper.parent.is(":animated"))
                helper.parent.stop().show().fadeTo(settings(current).fade, current.tOpacity);
            else
                helper.parent.is(':visible') ? helper.parent.fadeTo(settings(current).fade, current.tOpacity) : helper.parent.fadeIn(settings(current).fade);
        } else {
            helper.parent.show();
        }
        update();
    }

    /**
    * callback for mousemove
    * updates the helper position
    * removes itself when no current element
    */
    function update(event) {
        if ($.tooltip.blocked)
            return;

        if (event && event.target.tagName == "OPTION") {
            return;
        }

        // stop updating when tracking is disabled and the tooltip is visible
        if (!track && helper.parent.is(":visible")) {
            $(document.body).unbind('mousemove', update)
        }

        // if no current element is available, remove this listener
        if (current == null) {
            $(document.body).unbind('mousemove', update);
            return;
        }

        // remove position helper classes
        helper.parent.removeClass("viewport-right").removeClass("viewport-bottom");

        var left = helper.parent[0].offsetLeft;
        var top = helper.parent[0].offsetTop;
        if (event) {
            // position the helper 15 pixel to bottom right, starting from mouse position
            left = event.pageX + settings(current).left;
            top = event.pageY + settings(current).top;
            var right = 'auto';
            if (settings(current).positionLeft) {
                right = $(window).width() - left;
                left = 'auto';
            }
            helper.parent.css({
                left: left,
                right: right,
                top: top
            });
        }

        var v = viewport(),
			h = helper.parent[0];
        // check horizontal position
        if (v.x + v.cx < h.offsetLeft + h.offsetWidth) {
            left -= h.offsetWidth + 20 + settings(current).left;
            helper.parent.css({ left: left + 'px' }).addClass("viewport-right");
        }
        // check vertical position
        if (v.y + v.cy < h.offsetTop + h.offsetHeight) {
            top -= h.offsetHeight + 20 + settings(current).top;
            helper.parent.css({ top: top + 'px' }).addClass("viewport-bottom");
        }
    }

    function viewport() {
        return {
            x: $(window).scrollLeft(),
            y: $(window).scrollTop(),
            cx: $(window).width(),
            cy: $(window).height()
        };
    }

    // hide helper and restore added classes and the title
    function hide(event) {
        if ($.tooltip.blocked)
            return;
        // clear timeout if possible
        if (tID)
            clearTimeout(tID);
        // no more current element
        current = null;

        var tsettings = settings(this);
        function complete() {
            helper.parent.removeClass(tsettings.extraClass).hide().css("opacity", "");
        }
        if ((!IE || !$.fn.bgiframe) && tsettings.fade) {
            if (helper.parent.is(':animated'))
                helper.parent.stop().fadeTo(tsettings.fade, 0, complete);
            else
                helper.parent.stop().fadeOut(tsettings.fade, complete);
        } else
            complete();

        if (settings(this).fixPNG)
            helper.parent.unfixPNG();
    }

})(jQuery);
/*
 * 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 = "/js/thirdpart/loadingAnimation.gif";
var imgLoader = new Image();//Damien [2009-may-25]

/*!!!!!!!!!!!!!!!!! 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){
	
	imgLoader.src = tb_pathToImage;//Damien [2009-may-25]
	
	$(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$/;
	   var urlType = baseURL.toLowerCase().match(urlString);

		if(urlType == '.jpg' || urlType == '.jpeg' || urlType == '.png' || urlType == '.gif' || urlType == '.bmp'){//code to show images
				
			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'>close</a> or Esc Key</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 == 190){ // display previous image
					if(!(TB_NextHTML == "")){
						document.onkeydown = "";
						goNext();
					}
				} else if(keycode == 188){ // 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'>close</a> or Esc Key</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'>close</a> or Esc Key</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;
  }
}




$package("com.reva.ajax");

$class("AjaxManager", { AjaxManager: 
    /**
     * Ajax Manager
     * @classDescription Ajax Manager
     * @alias com.reva.ajax.AjaxManager
     * @return {com.reva.ajax.AjaxManager}
     * @constructor
     */
    function() {
		this.ajaxRequests=0;
		this.lastLoggedRequest="";
    },
	
    ajaxStart:  function(){
		this.ajaxRequests++;
		//$(".ajax_status").addClass("ajax_status_busy");
	},
	
    ajaxStop:  function(_stop_imediatelly){
		this.ajaxRequests--;
		if(_stop_imediatelly || this.ajaxRequests<=0){
			//$(".ajax_status").removeClass("ajax_status_busy");
			this.ajaxRequests=0;
		}
	},
	
    logRequest:  function(_params){		
		if (_params != this.lastLoggedRequest)
		{
			/*$.post({
		        url: "/consumer/Ajax/AjaxRequestTrack.aspx?"+_params,		        
		        dataType: "json",
			    success:function(_data){
					// do nothing	
			   }
			 });*/
			$.ajax({
		        url: "/consumer/Ajax/AjaxRequestTrack.aspx?"+_params,
				type: "GET",
		        async: true		        			    
			 });
		}
		this.lastLoggedRequest = _params;
	},
	
    rememberLink:  function(_selector){		
		$(_selector).click( function() {
			
	        var _href=$(this).attr("href");	
	        if(_href.indexOf("displayContactForm")>0){
                _href = _href.substring(31,(_href.length-3));
				_href = "/consumer/consultationform.aspx?"+_href;	                       
            }
			else if(_href.indexOf("displayPage")>0){
	            _href = _href.substring(24,(_href.length-3));
				_href = "/consumer/consultationform.aspx?"+_href;
            }   
					        
			if(_href.indexOf("?")>0){
				$.historyLoad(_href.substring(_href.indexOf("?")+1));				
			}
			window.location.href=_href;
			
			return false;
		} );
	},
	
    rememberUrl:  function(_href)
    {
        if (_href != undefined)
        {
            if(_href.indexOf("displayContactForm")>0){
	            //alert("1"+_href); 
	            _href = _href.substring(31,(_href.length-16));	
	            //alert("2"+_href);        
	            _href = "/consumer/consultationform.aspx?"+_href;
	            //alert("3"+_href);
	            }	
		    if(_href.indexOf("?")>0){
			    $.historyLoad(_href.substring(_href.indexOf("?")+1));
		    }
		}
	},
	
    rememberParams:  function(_params){	
		var _url=null;
		if(typeof(_params)=="string"){
			_url=_params;
		}else{
			_url=$.param(_params);
		}		
		$.historyLoad(_url);
	}
});$package("com.reva.consumer.browseproviders");

$class("ProviderDetails", { ProviderDetails:
    /**
    * Provider details
    * @alias com.reva.consumer.browseproviders.ProviderDetails
    * @return {com.reva.consumer.browseproviders.ProviderDetails}
    * @constructor
    */
    function(_container) {
        this.mainContainer = _container || $("#provider_details");
        this.brochure = this.mainContainer;
        this.providerId = 0;
        this.clinicId = 0;
        this.rpos = 'direct';
        this.queryString = null;
        this.ActiveTab = 'provider_details_tab1';
        this.imageStart = 0;
        this.imageFinish = 3;        
        this.proAcc = false;
        this.external = false;
    },
    isProviderSelected: function() {
        return this.providerId != 0;
    },
    init: function(_providerId, _clinicId) {
        this.brochure = this.mainContainer;


        if (this.mainContainer.length == 0) {
            this.mainContainer = $("#provider_details");
            this.brochure = this.mainContainer;
            if (this.mainContainer.length == 0) {
                alert("Sorry, but this brochure can't be displayed right now.");
                return;
            }
        }

        try {
            if (gvGoogleMap != null && gvGoogleMap.inited && $.browser.msie) {
                document.getElementById("hidden_content_holder").appendChild(document.getElementById("googleMapIframe"));
            }
        } catch (err) { }

        if (_providerId) {
            this.providerId = _providerId;
        }
        if (_clinicId) {
            this.clinicId = _clinicId;
        }

        if (this.queryString.indexOf("rpos") < 0)
            this.queryString += "&rpos=" + this.rpos;
		
		this.displayProviderDetails(this);
        
    },

    

    displayProviderDetails: function(_providerDetails) {

        if (_providerDetails.queryString.indexOf('rpos') < 0 && strQueryString.indexOf("sids=" + _providerDetails.providerId) > 0)
            _providerDetails.queryString += "&rpos=direct";

        //not sure this is used anymore	
        //$("div.brochure_treatments div.provider_details_rate_card ul.brochure_ul li span", _providerDetails.brochure).Tooltip({ track: true, delay: 0 });

        //don't give featured clinics phone out		
        if (_providerDetails.featuredClinic)
            _providerDetails.brochure.find("span.phoneLink").remove();

        /*** init albums links ***/
        $(".gallery_images a", _providerDetails.brochure).click(function() {
            var _tmpHref = $(this).attr("href").toString();
            var _tmpID = _tmpHref.replace((_tmpHref.substring(0, _tmpHref.indexOf("key=") + 4)), "");
            var _tmpMasterImage = $('#masterimage', _providerDetails.brochure);
            _tmpMasterImage.attr("src", "/SharedControls/getthumb.aspx?w=250&h=250&scale=true&img=" + _tmpID);
            _tmpMasterImage.attr("alt", $("div", this).attr("title"));
            _tmpMasterImage.attr("title", $("div", this).attr("title"));
            _tmpMasterImage.parent().attr("href", _tmpHref);
            return false;
        });


        /** Show hide some links **/
        //treatments link
        if ($(".provider_details_rate_card li", _providerDetails.brochure).length < 20)
            $(".provider_details_rate_card .pseudoLink", _providerDetails.brochure).hide();

        /*** only do this lot if its consumer side ***/

        if (!gvSupplierView) {
            gvGoogleMap = new com.reva.consumer.browseproviders.ProviderMap(_providerDetails.brochure);
            /*** init tabs ***/
            var _tabsParams = {
                select: function(event, ui) {
                    if (ui.panel && ui.panel.id == "tab_map") {
                        gvGoogleMap.init();
                    }
					
					try {
			            pageTracker._trackPageview("/" + ui.panel.id + "/" + window.location.pathname);
			        } catch (googlefailed) { }
                }
			

            };

            //$('.jquery_tab', _providerDetails.brochure).tabs(_tabsParams);
            $('#tabsmenu').tabs(_tabsParams);

            if (_tabsParams.initial > 0 && _providerDetails.ActiveTab == "tab_map")
                gvGoogleMap.init();

            /*** init consultation links ***/
            /*$("a.provider_details_contact").each(function() {
            var _tmpLink = $(this);
            if (gvSupplierView) {
            _tmpLink.attr("href", "/");
            _tmpLink.removeAttr("onclick");
            _tmpLink.click(function() { return false; });
            }
	            
            });*/

            /*** Prices tab ***/
            //first we must hide the text - not hidden by aspx so that google will see it
            $(".treatment_item .content", _providerDetails.brochure).each(function() {
                $(this).css("display", "none");
            });
            //code to show-hide the prices details
            $("#tab_prices .show_more", _providerDetails.brochure).each(function() {
                $(this).click(function() {
                    var ti = $(this).parent().parent().next();
                    if (ti.css("display") == "none") {
                        ti.css("display", "block");
                        //$(".ShowLink", this).html("[Hide Details]");
                        $(".ShowLink", this).css("display", "none");
                    } else {
                        ti.css("display", "none");
                        $(".ShowLink", this).html("Show Details &raquo;");
                    }
                    return false;
                });
            });
            if (gvRHSAds)
                gvRHSAds.hide();

            //alert(gvSupplierView + " - " + _providerDetails.featuredClinic + " - " + _providerDetails.proAcc + " - " + _providerDetails.brochure.find("h1.pro_acc").length==0);
            //            if (!_providerDetails.external && !_providerDetails.featuredClinic && !_providerDetails.proAcc && ((document.referrer.indexOf("revahealth.") > 0 && document.referrer.indexOf("revahealth.") < 20) || (document.referrer.indexOf("gmact") > 0 && document.referrer.indexOf("gmact") < 20) || (document.referrer.indexOf("localhost") > 0 && document.referrer.indexOf("localhost") < 20))) {

            //            }

            if (!_providerDetails.external && !_providerDetails.featuredClinic && !_providerDetails.proAcc) //ads on for all pages
            //if (!_providerDetails.external && !_providerDetails.featuredClinic && !_providerDetails.proAcc && ((document.referrer.indexOf("revahealth.") > 0 && document.referrer.indexOf("revahealth.") < 20) || (document.referrer.indexOf("gmact") > 0 && document.referrer.indexOf("gmact") < 20) || (document.referrer.indexOf("localhost") > 0 && document.referrer.indexOf("localhost") < 20)))//ads off for landing pages
            {
                var tmpIframe = "<iframe id='revaAdFrameBrochure' src='/consumer/google_adv_middle_brochure.html' style='margin-top:10px;' width='728' scrolling='no' height='90' frameborder='0' vspace='0' marginwidth='0' marginheight='0' hspace='0' allowtransparency='true'></iframe>";
                _providerDetails.brochure.find("div.BW").before(tmpIframe);
                $("#revaAdFrameRight").css("margin-top", ($.browser.msie ? "6px" : "0px"));
            }

            if ((document.referrer.indexOf("revahealth.") > 0 && document.referrer.indexOf("revahealth.") < 20) || (document.referrer.indexOf("gmact") > 0 && document.referrer.indexOf("gmact") < 20) || (document.referrer.indexOf("localhost") > 0 && document.referrer.indexOf("localhost") < 20)) {
                $("#backToSearch").html("Return to Listings");
                $("#backToSearch").bind("click", function() { window.history.back(); return false; });
            }
            else {
                $("#backToSearch").css("font-size", "14px");  
				
				if (!_providerDetails.proAcc && !_providerDetails.external) {
					$(".BW_map").before("<div class='provider_gallery BW_images'><div class='no_photo'></div></div>");
					//$(".no_photo").css("background-image", "transparent url('/SharedControls/GetThumb.aspx?img=0&w=250&h=250&scale=true') no-repeat no-scroll 0px 0px");
					$(".no_photo").css("background-image", "url('/SharedControls/GetThumb.aspx?img=0&w=250&h=250&scale=true')").css("background-position", "0px");
				}
				
				$(".BW_address .clinic_address .jq_contact").show();
            }

			//log the brochure view 
            gvAjaxManager.logRequest(_providerDetails.queryString);
			//display brochure and remove splash
            _providerDetails.mainContainer.show();
            _providerDetails.brochure.show();
            if (gvSplash)
                gvSplash.hide();


            $('.jquery_tab', _providerDetails.brochure).tabs('select', gvProviderDetails.ActiveTab);

            if (revaGV_CurrencyRate > 1 || revaGV_CurrencyRate < 1) {
                if (_providerDetails.brochure.find('.BW_treatment_prices').length > 0) {
                    var t = _providerDetails.brochure.find('.BW_treatment_prices');

                    if (t.text() != "Free") {
                        var tt = t.text().match(/\d+/)[0];

                        tt = revaGV_CurrencyRate * parseInt(tt);
                        t.html(revaGV_Currency + Math.ceil(tt) + (t.text().indexOf("+") > 0 ? "+" : ""));
                    }
                }

                $('.treatment_item span.price', _providerDetails.brochure).each(function() {

                    price = $(this).text();
                    if (price != "Free") {
                        var newPrice = '';

                        //test if the text is price on request do nothing if it is
                        if (price.indexOf("Typically") > -1) {
                            newPrice = "Typically " + revaGV_Currency;
                        }
                        else if (price.indexOf("Up to") > -1) {
                            newPrice = "Up to " + revaGV_Currency;
                        }
                        else {
                            newPrice = revaGV_Currency;
                        }

                        price = price.match(/\d+/)[0];
                        price = revaGV_CurrencyRate * parseInt(price);
                        $(this).html(newPrice + Math.ceil(price));
                    }
                });

            }

//            _providerDetails.brochure.find('a.jq_contact').attr("href", _providerDetails.brochure.find('a.jq_contact').attr("href") + '&fcid=' + providersListParams.fcid);
        }

    },

    showHideSection: function(divToShowHide) {
        var _tmpDiv = $(divToShowHide, this.brochure);
        var _innerDiv = $(".short", _tmpDiv);
        if (_innerDiv.length > 0) {
            _innerDiv.addClass("expanded");
            _innerDiv.removeClass("short");
            $("a.link_more", _tmpDiv).html("[Hide Details]");
        } else {
            _innerDiv = $(".expanded", _tmpDiv);
            _innerDiv.addClass("short");
            _innerDiv.removeClass("expanded");
            $("a.link_more", _tmpDiv).html("[Show More]");
        }

    },

    showPhoneNumber: function() {
        var tmpDiv = $(".phoneLink div.phone_number_box", gvProviderDetails.brochure);
        var tmpLink = $(".phoneLink span", gvProviderDetails.brochure);
        if (tmpDiv.css("display") == "block") {
            tmpDiv.css("display", "none");
            tmpLink.text("[Show Phone Number]");
        } else {
            //log the fact the phone number was looked up
            gvAjaxManager.logRequest("phone=1&rid=" + providersListParams.rid + "&dcid=" + providersListParams.dcid + "&city=" + providersListParams.city + "&sids=" + gvProviderDetails.providerId + "&clinicid=" + gvProviderDetails.clinicId);
            tmpDiv.css("display", "block");
            tmpLink.text("[Hide Phone Number]");
        }
    },

    galleryArrowClick: function(moveBy) {
        this.imageStart += moveBy;
        this.imageFinish += moveBy;
        if (this.imageStart < 0 || this.imageFinish < 3) {
            this.imageStart = 0;
            this.imageFinish = 4;
        }
        var _tmpTotal = $('.gallery_images a', this.brochure).length;
        if (this.imageFinish > _tmpTotal) {
            this.imageStart = _tmpTotal - 4;
            this.imageFinish = _tmpTotal;
        }

        $('.gallery_images a:lt(' + this.imageStart + ')', this.brochure).hide();
        $('.gallery_images a:gt(' + (this.imageStart - 1) + ')', this.brochure).show();
        $('.gallery_images a:gt(' + this.imageFinish + ')', this.brochure).hide();

    },

    myTriggerTab: function(tabToShow) {

        //$('.jquery_tab', this.brochure).tabs('select',tabToShow);
        $('#tabsmenu').tabs('select', tabToShow);
        reva_GoToPageTop();
    },

    showHidePrices: function() {
        //code to show-hide the prices details
        $("#tab_prices .show_more", _providerDetails.brochure).each(function() {
            $(this).click(function() {
                var ti = $(this).parent().parent().next();
                if (ti.css("display") == "none") {
                    ti.css("display", "block");
                    $(this).css("background", "url(/images/sprite_provider_details.gif) no-repeat -17px -657px");
                    //$(".ShowLink", this).html("<b>&raquo;</b> [Hide Details]");
                    (".ShowLink", this).css("display", "none");
                } else {
                    ti.css("display", "none");
                    $(this).css("background", "url(/images/sprite_provider_details.gif) no-repeat -17px -675px");
                    $(".ShowLink", this).html("<b>&raquo;</b> Show Details &raquo;");
                }
                return false;
            });
        });
    }

}); $package("com.reva.consumer.browseproviders");

$class("SearchFilter", { SearchFilter: 
    /**
     * SearchFilter
     * @alias com.reva.consumer.browseproviders.SearchFilter
     * @return {com.reva.consumer.browseproviders.SearchFilter}
     * @constructor
     */
    function(_container) {
    	this.filterContainer=_container || $("#search_filter");		
		this.searchPanel = $("#searchBox");		
		this.ajaxCacheCountry = new Cache(30);
		this.ajaxCacheTreatment = new Cache(30);
		this.ajaxCacheClinicType = new Cache(30);		
		this.FilterBar = $("div.FilterBar");
		this.FilterBarContent = $("div.FilterBar .FiltersHolder");
		this.locSelect = $("select:eq(0)",this.FilterBarContent);
		this.locDiv = $("div:eq(0)",this.FilterBarContent);
		this.trSelect = $("select:eq(1)",this.FilterBarContent);
		this.trDiv = $("div:eq(1)",this.FilterBarContent);
		this.ctSelect = $("select:eq(2)",this.FilterBarContent);
		this.ctDiv = $("div:eq(2)",this.FilterBarContent);
		this.sSelect = $("select:eq(3)",this.FilterBarContent);	
		this.sDiv = $("div:eq(3) select",this.FilterBarContent);	
    },
 	init: function()
	{	
		if(this.searchPanel.length<1)
			this.searchPanel=$("#searchBox");			
		if(this.FilterBar.length<1)
			this.FilterBar=$("div.FilterBar");
		
		//change funciton for location dropdown
		this.locSelect.bind("change",function(){
			var selectedOption = $(this).find("option:selected");
			if ($(this).attr("rel") != selectedOption.attr("rel")) {
				reva_showSplash('Updating Results');				
				gvAjaxManager.logRequest("searchtype=2&change=dest&value="+selectedOption.attr("rel"));				
				if(providersListParams.pid != 0)
				{
					var tmptr = gvSearchFilter.trSelect.find("option:selected").val().split('/');
					window.location = selectedOption.val() + "/" + tmptr[tmptr.length-1] + (providersListParams.mapview == 1 ? "/map" : "");
					
				}else				
					window.location = selectedOption.val() + (providersListParams.mapview == 1 ? "/map" : "");
			}

		});	
		
		//change funciton for clinic type dropdown		
		this.ctSelect.bind("change",function(){
			var selectedOption = $(this).find("option:selected");
			if (providersListParams.cid != selectedOption.attr("rel")) {
				reva_showSplash('Updating Results');
				gvAjaxManager.logRequest("searchtype=2&change=clinictype&value="+selectedOption.attr("rel"));
				window.location = selectedOption.val() + (providersListParams.mapview == 1 ? "/map" : "");
			}

		});

		//change funciton for treatment dropdown
		this.trSelect.bind("change",function(){
			var selectedOption = $(this).find("option:selected");
			if (providersListParams.pid != selectedOption.attr("rel")) {
				reva_showSplash('Updating Results');
				gvAjaxManager.logRequest("searchtype=2&change=procedure&value="+selectedOption.attr("rel"));
				window.location = selectedOption.val() + (providersListParams.mapview == 1 ? "/map" : "");
			}

		});
		
		if(providersListParams.mapview == 0){
			//change funciton for narrowing dropdown
			this.sSelect.bind("change",function(){
				var selectedOption = $(this).find("option:selected");
				reva_showSplash('Updating Results');
							
				var tmpSff = ["0","0","0","0","0","0","0","0","0","0","0"];
		        if(selectedOption.val()>-1)
					tmpSff[selectedOption.val()] = "1";
				gvAjaxManager.logRequest("searchtype=2&change=filter&value="+selectedOption.text());
		        providersListParams.sf = tmpSff.toString();
		        window.setTimeout('gvSearchFilter.performSearch()', 1);	        
				
			});
			
			//set up the filters dropdown. 
			if (_narrowCBList.length < 1) {
	            _narrowCBList = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; 
	        }
			
	        for (var i = 1; i < (_narrowCBList.length+1); i++) {			
				switch (i) {
	                case 0:					
	                    if ((providersListParams.dcid == '269' && providersListParams.fcid == 269) || (providersListParams.dcid == '269')) {						
							this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
						}
	                    break;
	                case 1:
	                    if (providersListParams.fcid == 0 || providersListParams.fcid == providersListParams.dcid)
	                        this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
	                    break;
	                case 5:
	                    if (providersListParams.fcid != providersListParams.dcid)
	                        this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
	                    break;
	                case 6:
	                    if (providersListParams.fcid != providersListParams.dcid)
	                        this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
	                    break;
	                case 7:
	                    if ((providersListParams.dcid == '144' && providersListParams.fcid == 144) || providersListParams.dcid == '144')
	                        this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
	                    break;
	                case 8:
	                    if (providersListParams.fcid == 0 || providersListParams.dcid == providersListParams.fcid)
	                        this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
	                    break;
	                case 10:
	                    if (providersListParams.dcid == '144')
	                        this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
	                    break;
	                default:
						this.sDiv.find("option:eq("+i+")").clone().appendTo(this.sSelect);
	                    break;
	            }
			}
		}else{
			this.sSelect.hide();
			this.sDiv.hide();	
			$("span:eq(3)",this.FilterBarContent).hide();		 
		}
		this.initLocationNarrowing();
        this.initTreatmentNarrowing();
	},
	
	initLocationNarrowing: function()
	{		
	
		var tmpString = "";		
		this.locDiv.find("a").each(function(){
			var _curLink = $(this);
			var _tmpID = _curLink.attr("id").split("_")[1];
			var _tmpType = _curLink.attr("id").split("_")[0];
			//locSelect.after("<option value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			//locSelect.find("option:last").after("<option value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			//gvSearchFilter.locSelect.html(gvSearchFilter.locSelect.html() + "<option rel='" + _curLink.attr("id").split("_")[1] + "' value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			var found = true;			
			if(_curLink.attr("class").indexOf('donotremove')<0){
				if 
				((_tmpType.indexOf("location")>0 && providersListParams.location > 0 && _tmpID!=providersListParams.location)||
				(_tmpType.indexOf("country")>0 && providersListParams.dcid > 0 && _tmpID!=providersListParams.dcid)
				)
				
				{
					found=false;
					for (i in _narrowLocList) {
						if (_narrowLocList[i] == _tmpID) {
							found = true;
							break;
						}
					}
				}
				}
				
			
			if (found) {
				tmpString += "<option rel='" + _tmpID + "' value='" + _curLink.attr("href") + "'>" + _curLink.text() + "</option>";
			}

		});
		
		
		this.locSelect.html(tmpString);
		var selectedID = 0;
		if(this.locDiv.find("a:eq(0)").attr("id").indexOf("location"))
			selectedID = providersListParams.location;
		else
			selectedID = providersListParams.dcid;
		if(this.locSelect.find("option:eq(1)").text().indexOf("Go back")==0)
			this.locSelect.find("option:eq(1)").after("<optgroup label='- - - - - - - -'></optgroup>");
		else
			this.locSelect.find("option:eq(0)").after("<optgroup label='- - - - - - - -'></optgroup>");
		
		//alert(selectedID + " - " + this.locSelect.find("option[rel='" + selectedID + "']").length + " - " + this.locSelect.find("option[rel='" + selectedID + "']").attr("selected") );
		//this.locSelect.find("option[rel=" + selectedID + "]").attr("selected","true");
		window.setTimeout("gvSearchFilter.locSelect.find(\"option[rel=" + selectedID + "]\").attr(\"selected\",\"true\")",10);
		this.locSelect.attr("rel",selectedID);
		this.locDiv.hide();
		
		
	},
	
	initTreatmentNarrowing: function()
	{	
		var tmpString = "";	
		/////
		//Clinic type
		/////
		
		this.ctDiv.find("a").each(function(){
			var _curLink = $(this);
			var _tmpID = _curLink.attr("id").split("_")[1];
			//locSelect.after("<option value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			//locSelect.find("option:last").after("<option value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			//gvSearchFilter.ctSelect.html(gvSearchFilter.ctSelect.html() + "<option rel='" + _curLink.attr("id").split("_")[1] + "' value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			var found = true;
			if (_tmpID!=0 && _curLink.attr("class").indexOf('donotremove')>0 &&  (providersListParams.cid > 0 && _tmpID != providersListParams.cid)) {
				found = false;
				for (i in _narrowClinicList) {
					if (_narrowClinicList[i] == _tmpID) {
						found = true;
						break;
					}					
				}
			}
			if (found) {
				tmpString += "<option rel='" + _tmpID + "' value='" + _curLink.attr("href") + "'>" + _curLink.text() + "</option>";
				if(_curLink.text().indexOf("All ") ==0)
					tmpString += "<optgroup label='- - - - - - - -'></optgroup>";
				
			}
		});		
		
		this.ctSelect.html(tmpString);
		
		//this.ctSelect.find("option[rel='" + providersListParams.cid + "']").attr("selected","true");
		window.setTimeout("gvSearchFilter.ctSelect.find(\"option[rel=" + providersListParams.cid + "]\").attr(\"selected\",\"true\")",10);
		this.ctDiv.hide();
		
		/////
		//Treatment
		/////		
		tmpString = "";	
		this.trDiv.find("a").each(function(){
			var _curLink = $(this);
			var _tmpID = _curLink.attr("id").split("_")[1];
			//locSelect.after("<option value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			//locSelect.find("option:last").after("<option value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			//gvSearchFilter.trSelect.html(gvSearchFilter.trSelect.html() + "<option rel='" + _curLink.attr("id").split("_")[1] + "' value='"+_curLink.attr("href")+"'>"+_curLink.text()+"</option>");
			var found = true;
			if (_tmpID!=0 && _curLink.attr("class").indexOf('donotremove')>0 &&  (providersListParams.pid > 0 && _tmpID != providersListParams.pid)) {
				found = false;
				for (i in _narrowTreatList) {
					if (_narrowTreatList[i] == _tmpID) {
						found = true;
						break;
					}
					
				}
			}
			if (found) {
				tmpString += "<option rel='" + _tmpID + "' value='" + _curLink.attr("href") + "'>" + _curLink.text() + "</option>";
				if(_curLink.text().indexOf("All ") ==0)
					tmpString += "<optgroup label='- - - - - - - -'></optgroup>";
				
			}
		});
		this.trSelect.html(tmpString);	
		
		//this.trSelect.find("option[rel='" + providersListParams.pid + "']").attr("selected","true");
		window.setTimeout("gvSearchFilter.trSelect.find(\"option[rel=" + providersListParams.pid + "]\").attr(\"selected\",\"true\")",10);
		this.trDiv.hide();
		
	},
	
	
	
	doSearch: function()
	{				
	
	    pageLoaded = false;	
		reva_showSplash('Updating Results');
		$.post("/consumer/Ajax/ajaxGetHints.aspx?datatype=6&cid=" + providersListParams.cid,{treatment:$("#treatment_inputbox").val(),treatment_ID:$("#treatment_hidden").val(),country:$("#country_inputbox").val(),country_ID:$("#country_hidden").val()},
		   function(_data){
		        //alert(_data);
				window.location = _data;
		   },"text"
		 );	
		 pageLoaded = true;	
				
},

	performSearch: function()
	{				
	    pageLoaded = false;		
		
		gvSearchFilter.addDelay();
		//clearing some values
		providersListParams.page="0";;
		gvMapIframe.attr("src","");   	    
		
		window.setTimeout('gvSearchFilter.endSearch();',5);
		
},

	addDelay: function()
	{
		reva_GoToPageTop();		
		reva_showSplash('Updating Results');
		return;
	},

	buildLists: function()
	{	
		//////
		//Location
		/////
		var _cachedDetails;
		_cachedDetails = this.ajaxCacheCountry.getItem($.param({ cid: providersListParams.cid, fcid: providersListParams.fcid, pid: providersListParams.pid, problemid: providersListParams.problemid, rid: providersListParams.rid, dcid: providersListParams.dcid, location: providersListParams.location }));
		if (_cachedDetails != null) {
			this.locDiv.html(_cachedDetails);
		}
		else {
			gvAjaxManager.ajaxStart();
			$.ajax({
				url: "/consumer/ajax/ajaxGetHints.aspx",
				data: {
					cid: providersListParams.cid,
					pid: providersListParams.pid,
					problemid: providersListParams.problemid,
					fcid: providersListParams.fcid,
					dcid: providersListParams.dcid,
					rid: providersListParams.rid,
					location: providersListParams.location,
					datatype: 3
				},
				async: false,
				dataType: "html",
				success: function(_html){
					gvSearchFilter.locDiv.html(_html);
					gvSearchFilter.ajaxCacheCountry.setItem($.param({
						cid: providersListParams.cid,
						fcid: providersListParams.fcid,
						pid: providersListParams.pid,
						problemid: providersListParams.problemid,
						rid: providersListParams.rid,
						dcid: providersListParams.dcid,
						location: providersListParams.location
					}), _html);
					gvAjaxManager.ajaxStop();
				},
				error: function(XMLHttpRequest, textStatus, errorThrown){
					alert(errorThrown);
				}
			});
		}
			
			
			//////
			//Treatment
			/////
		    _cachedDetails = this.ajaxCacheTreatment.getItem($.param({ cid: providersListParams.cid, fcid: providersListParams.fcid, pid: providersListParams.pid, problemid: providersListParams.problemid, rid: providersListParams.rid, dcid: providersListParams.dcid, location: providersListParams.location }));
			if (_cachedDetails != null) {
				this.trDiv.html(_cachedDetails);
			}
			else {
				gvAjaxManager.ajaxStart();
				$.ajax({
					url: "/consumer/ajax/ajaxGetHints.aspx",
					data: {
						cid: providersListParams.cid,
						pid: providersListParams.pid,
						problemid: providersListParams.problemid,
						fcid: providersListParams.fcid,
						dcid: providersListParams.dcid,
						rid: providersListParams.rid,
						location: providersListParams.location,
						datatype: 4
					},
					async: false,
					dataType: "html",
					success: function(_html){
						gvSearchFilter.trDiv.html(_html);
						gvSearchFilter.ajaxCacheTreatment.setItem($.param({
							cid: providersListParams.cid,
							fcid: providersListParams.fcid,
							pid: providersListParams.pid,
							problemid: providersListParams.problemid,
							rid: providersListParams.rid,
							dcid: providersListParams.dcid,
							location: providersListParams.location
						}), _html);
						gvAjaxManager.ajaxStop();
					},
					error: function(XMLHttpRequest, textStatus, errorThrown){
						alert(errorThrown);
					}
				});
				gvAjaxManager.ajaxStop();
			}
			
			//////
			//Clinic Type
			/////
			_cachedDetails = this.ajaxCacheClinicType.getItem($.param({ cid: providersListParams.cid, fcid: providersListParams.fcid, pid: providersListParams.pid, problemid: providersListParams.problemid, rid: providersListParams.rid, dcid: providersListParams.dcid, location: providersListParams.location }));
			if (_cachedDetails != null) {
				this.ctDiv.html(_cachedDetails);
			}
			else {
				gvAjaxManager.ajaxStart();
				$.ajax({
					url: "/consumer/ajax/ajaxGetHints.aspx",
					data: {
						cid: providersListParams.cid,
						pid: providersListParams.pid,
						problemid: providersListParams.problemid,
						fcid: providersListParams.fcid,
						dcid: providersListParams.dcid,
						rid: providersListParams.rid,
						location: providersListParams.location,
						datatype: 5
					},
					async: false,
					dataType: "html",
					success: function(_html){
						gvSearchFilter.ctDiv.html(_html);
						gvSearchFilter.ajaxCacheClinicType.setItem($.param({
							cid: providersListParams.cid,
							fcid: providersListParams.fcid,
							pid: providersListParams.pid,
							problemid: providersListParams.problemid,
							rid: providersListParams.rid,
							dcid: providersListParams.dcid,
							location: providersListParams.location
						}), _html);
						gvAjaxManager.ajaxStop();
					},
					error: function(XMLHttpRequest, textStatus, errorThrown){
						alert(errorThrown);
					}
				});
				gvAjaxManager.ajaxStop();
			}
			
		this.initLocationNarrowing();
        this.initTreatmentNarrowing();
	},

	
	endSearch: function()
	{
		//this.buildLists();		leaving this out for the moment since we go directly to url [damien 27-aug-2009]
		//Show the new list.			
		gvOverviewPanel.displayOverview();		
		gvProvidersList.listProviders(true);
		//moving these two to the list providers class
		//this.initLocationNarrowing();
		//this.initTreatmentNarrowing();
		gvAjaxManager.rememberParams(providersListParams);
		window.setTimeout('gvSearchFilter.endstuff();',15);
	},

	endstuff: function()
	{		
		//this.initLocationNarrowing();leaving this out for the moment since we go directly to url [damien 27-aug-2009]
        //this.initTreatmentNarrowing();	leaving this out for the moment since we go directly to url [damien 27-aug-2009]	
		this.displayFilteredText();
		reva_setMainTabs();
		gvSplash.hide();
		reva_GoToPageTop();
		pageLoaded = true;
	},

	hideAutocompleteOptions: function()
	{
		$("#reva_listOfOptions").hide();
		$("#reva_noResults").hide();
	},

	displayFilteredText: function(){
		//Standard format
		//	All/Top XXX [Clinic type] in [location]
		//	All/Top XXX clinic that perform [treatment] in [location]
		var SearchHeadingText = "";
		
		//if this was search for a staff or clinic only display its text
		if (providersListParams.displaypage != "") {
			SearchHeadingText = "Search Results for '" + providersListParams.displaypage + "'";
		}
		else {		
			//we don't really output more then 400 as people simply don't look at them and google only indexs first page
			SearchHeadingText = (_validPreviewCount >= 400 ? "Top " : "All ") + _validPreviewCount;
			//if procedure selected use change text
			if(providersListParams.pid != 0)
				SearchHeadingText += " Clinics that provide " + this.trSelect.find("option:selected").text()
			else
				SearchHeadingText += " " + this.ctSelect.find("option:selected").text(); 						
			
			var _tmpT = this.locSelect.find("option:selected").text();;
			if (_tmpT.length > 0) {
				//if it starts with 'all of' take text from after this point
				if (_tmpT.indexOf("All of") == 0) 
					SearchHeadingText += " in " + _tmpT.substr(6);
				else if (_tmpT.indexOf("Worldwide") > -1) 
					SearchHeadingText += "Worldwide";
				else 
					SearchHeadingText += " in " + _tmpT;				
			}
			
		}
		
		$("h1.selected_country_header").html(SearchHeadingText);
	},

	ShowHideFilters: function(displayMode)
	{        
		//displaymode settings 
		//  null - alternates
		//  0    - hide
		//  1    - show		
        var _link = $('.show_hide_filters span',this.FilterBar);
        
		if (typeof(displayMode) == 'undefined') {
			if (_link.html().indexOf('Hide') > -1) {
				displayMode = 0;
			}
			else {
				displayMode = 1;
			}
		}
		
		if (displayMode == 1) {			
			_link.html('&laquo;&nbsp;Hide Filters');
			_link.addClass("border");
			this.FilterBarContent.show();
		}else
		{
		    _link.removeClass("border");
			_link.html('Show Filters&nbsp;&raquo;');
			this.FilterBarContent.hide();
		}
		
    },
	
	ShowHideExtendedFilters: function()
	{        
		var _arrow = $('.show_hide_filters span',this.FilterBar);
        var _link = $('.show_hide_filters a',this.FilterBar);
        
        if (_link.html().indexOf('Hide') == 0) {
            _arrow.removeClass('arrow_hide');
            _arrow.addClass('arrow_show');
            _link.html('[Show Filters]');
            this.FilterBarContent.hide();
        } else
        {
            _arrow.removeClass('arrow_show');
            _arrow.addClass('arrow_hide');
            _link.html('[Hide Filters]');
            this.FilterBarContent.show();
        }
    },
	
	searchBoxAutoFillClear: function(control)
	{	     
	    $("#"+control+'_inputbox').val("");	    
		$("#"+control+'_hidden').val("");	    
	    return;
	}


});$package("com.reva.consumer.browseproviders");

$class("OverviewPanel", { OverviewPanel: 
    /**
     * OverviewPanel
     * @alias com.reva.consumer.browseproviders.OverviewPanel
     * @return {com.reva.consumer.browseproviders.OverviewPanel}
     * @constructor
     */
    function(_container) {
		this.mainContainer = _container || ($("#Providers_overview").length>0 ? $("#Providers_overview") : $("#providersOverviewHolder"));		
		this.ajaxCache = new Cache(30);
    },
 	init: function()
	{
	},
	
	displayOverview:function(){
		
		var overviewPanel=this.mainContainer;		
		var providersOverviewAjaxCache = this.ajaxCache;
		var _cachedDetails = providersOverviewAjaxCache.getItem($.param({ cid: providersListParams.cid, pid: providersListParams.pid, problemid: providersListParams.problemid, rid: providersListParams.rid, dcid: providersListParams.dcid, city: providersListParams.city, displaypage: providersListParams.displaypage, location: providersListParams.location}));
		if(_cachedDetails!=null){
			
			this.mainContainer.html(_cachedDetails);					
						
			return;
		}
		
		gvAjaxManager.ajaxStart();
		$.ajax({
			url: "/consumer/Ajax/ProvidersOverview.aspx",
			data: providersListParams,
			async: false,
			dataType: "html",
			success: function(_data){
				
				gvOverviewPanel.mainContainer.html(_data);				
								
				
				gvOverviewPanel.ajaxCache.setItem($.param({
					cid: providersListParams.cid,
					pid: providersListParams.pid,
					problemid: providersListParams.problemid, 
					rid: providersListParams.rid,
					dcid: providersListParams.dcid,
					city: providersListParams.city,
					displaypage: providersListParams.displaypage,
					location: providersListParams.location					
				}), _data);
				
								
				gvAjaxManager.ajaxStop(true);
			}
		});
		
		 		
	
	}
});$package("com.reva.consumer.browseproviders");

$class("ProvidersList", { ProvidersList:
    /**
    * ProvidersList
    * @alias com.reva.consumer.browseproviders.ProvidersList
    * @return {com.reva.consumer.browseproviders.ProvidersList}
    * @constructor
    */
    function(_container) {
        this.mainContainer = _container || ($(".providers_list_td").length > 0 ? $(".providers_list_td") : $("#list_view"));
        this.listings = $("#providers_list", this.mainContainer);
        this.queryString = null;
        this.ajaxCache = new Cache(30);
        this.myFilterOptions = { review: false, guarantee: false };

    },
    init: function(doFullInit) {
        this.listings = $("#providers_list", this.mainContainer);

        //tb_init('a.thickbox'); moving to pagination as calling it here is doubling it and causing problems [damien 22-sep-2009]

        var _logInfo = "";
		var kmChange = (providersListParams.fcid == 269 || providersListParams.fcid == 270 ? true : false);
		var euroChange = (revaGV_CurrencyRate != 1 ? true : false);
		
        this.listings.find(".s_listing").each(function() {
			
            /*if (_logInfo != "")
                _logInfo += ",";
            var _currentPreview = $(this);
            var _tempId = _currentPreview.attr("id");
            var _providerId = _tempId.split("_")[2];
            var _clinicId = _tempId.split("_")[3];
            var tmpquery = buildProviderRelatedQuery();
            _logInfo += _clinicId;*/
			if (_logInfo != "")
                _logInfo += ",";
            var listing = $(this);
			
            _logInfo += listing.attr("id").split("_")[3];
			
			if (kmChange && listing.find('.jq_kmdistance')) {
				listing.find('.jq_kmdistance').text((Math.ceil(parseInt(listing.find('.jq_kmdistance').text().replace(" km","")) * .62)) + " miles");
			}
			if(euroChange)
			{
				var price = listing.find('.s_listing_title_price b').text();
				//test if the text is price on request do nothing if it is
				if(price.indexOf("Price")==-1)
				{
					price = price.substr(1);//.replace("â‚¬","");
					var isMaxPrice = true;
					if(price.indexOf("+")>0)
					{
						price.replace("+","");	
						isMaxPrice = false;					
					}
					price = revaGV_CurrencyRate * parseInt(price);
					listing.find('.s_listing_title_price b').html(revaGV_Currency + Math.ceil(price) + (isMaxPrice ? "" : "+"));					
				}
			}	
			
			listing.find('a.jq_details').attr("href",listing.find('a.jq_details').attr("href") + '&fcid=' + providersListParams.fcid);		
        });

        // log request		
        //_validPreviewCount is set in the providers list div by providerslst.aspx and is the total number of clinics that matched the search exactly
        gvAjaxManager.logRequest(buildProviderRelatedQuery() + "&clinicid=" + _logInfo + "&totalvalid=" + _validPreviewCount);

        
        gvRHSAds.css("margin-top", "0px");

        //if(this.listings.find('.featured').length==0 && pageInited && $("#revaAdFrame").length<1)
        //{
        var tmpCnt = this.listings.find(".s_listing").length;
        var tmpIframe = "<iframe id='revaAdFrame' src='/consumer/google_adv_middle.html' style='margin-bottom:14px' width='728' scrolling='no' height='90' frameborder='0' vspace='0' marginwidth='0' marginheight='0' hspace='0' allowtransparency='true'></iframe>";
        if (tmpCnt > 2) {
            this.listings.find(".s_listing:eq(1)").after(tmpIframe);
        } else if (tmpCnt > 1) {
            this.listings.find(".s_listing:eq(0)").after(tmpIframe);

        }
        //}

        this.initPagination();
        if (doFullInit)
            this.endListProviders();
    },


    listProviders: function(doInit) {
        //adding Flash effect so users see page change - clear containts and wait before sending ajax request 
        //this.mainContainer.html("<h1 style=\"margin:250px 0px 200px 100px;\">Loading....</h1>");

        var _cachedList = this.ajaxCache.getItem($.param(providersListParams));
        if (_cachedList != null) {
            this.mainContainer.html(_cachedList);

            this.init(doInit);
            return;
        }

        gvAjaxManager.ajaxStart();
        $.ajax({
            url: "/consumer/Ajax/ProvidersList.aspx",
            data: providersListParams,
            async: false,
            /*type: "POST",*/
            dataType: "html",
            success: function(_data) {
                gvProvidersList.ajaxCache.setItem($.param(providersListParams), _data);
                gvProvidersList.mainContainer.html(_data);
                gvProvidersList.init(doInit);
                gvAjaxManager.ajaxStop();
            },
            onerror: function(errorMsg) {
                gvProvidersList.mainContainer.html('<div>We encountered a problem trying to retrieve the list of clinics. Please try a different search.</div>');
                gvAjaxManager.ajaxStop();
            }
        });

        try {
            pageTracker._trackPageview("/searchperformed.html");
        } catch (googlefailed) { }
    },

    displayProvider: function(_providerId, _clinicId, _rpos, featured, _proAccount, thislink) {
        reva_showSplash('Loading Brochure');
        /*var _tmpurl = $('div.column_treatment a.selected').attr("href");
        if (typeof(_tmpurl) != "undefined") {
        _tmpurl = _tmpurl.split('/');
        if(_tmpurl[_tmpurl.length] != "map")
        thislink += "/" + _tmpurl[_tmpurl.length];
        }*/
        if (reva_treatmentText != "") {
            //alert(reva_treatmentText);
            $(thislink).attr("href", $(thislink).attr("href") + "/" + reva_treatmentText);
            //alert($(thislink).attr("href"));
        }
        return;
        /*pageLoaded = false;
	    
		reva_showSplash('Loading Brochure');
        gvSearchFilter.hideAutocompleteOptions();					
        reva_GoToPageTop();
				
		gvRHSAds.hide();			
        gvMainTabs.hide();
        $("div.FilterBar").addClass("ui-tabs-hide");
        $("div.search_intro").addClass("ui-tabs-hide");
        $("#ProviderTextHeader").addClass("ui-tabs-hide");
		
		var _currentPreview = $("#provider_preview_" + _providerId + "_" + _clinicId,this.listings);		    
		
		gvProviderDetails.brochure.hide();
        gvProviderDetails.providerId = _providerId;
        gvProviderDetails.clinicId = _clinicId;
        gvProviderDetails.featuredClinic = (featured > 0 ? true : false);
        gvProviderDetails.rpos = _rpos;
        gvProviderDetails.proAcc = _proAccount > 0 ? true : false;
        //var _href=$("a.contact_link",_currentPreview).attr("href");
        var _href=buildProviderRelatedQuery(_providerId, _clinicId, _rpos);
							
        //we removed contact buttons on preview if non-valid so need to generate 
        gvProviderDetails.queryString=getQueryString(_href); 
				
		
        window.setTimeout("gvProvidersList.endDisplayProvider('"+_href+"');",1);
        return false;
        */


    }, endDisplayProvider: function(_href) {
        gvProviderDetails.init();
        gvAjaxManager.rememberParams(_href);
        pageLoaded = true;
    },

    initPagination: function() {					
        $("#providers_list_pagination a").click(function() {
            pageLoaded = false;
            reva_showSplash('Updating Results');

            providersListParams.page = $(this).attr("id").split("_")[1];
            gvAjaxManager.rememberParams(providersListParams);

            //gvProviderDetails.providerId = 0;
            //gvProviderDetails.clinicId = 0;
            //gvProviderDetails.brochure.hide();
            //display in case brochure was shown
            //gvOverviewPanel.mainContainer.show();
            //RHS ads might have been hidden by brochure view
            //gvRHSAds.show();			
            reva_GoToPageTop();
            window.setTimeout('gvProvidersList.endPagination();', 1);

            return false;
        });

    },

    endPagination: function() {
        gvProvidersList.listProviders(false);
		tb_init('.s_listing a.thickbox');
        gvSplash.hide();
        pageLoaded = true;
    },

    narrowByFilter: function(cbOption, filterID) {

        var tmpSff = providersListParams.sf.split(',');
        tmpSff[filterID] = (cbOption.checked ? 1 : 0);
        providersListParams.sf = tmpSff.toString();
        if (providersListParams.mapview == 1) {
            var _tmpurl = $('div.column_treatment a.selected').attr("href");
            if (typeof (_tmpurl) != "undefined") {
                _tmpurl += "/map";
                var _narrowCBList = providersListParams.sf.split(',');
                for (sfid in _narrowCBList)
                    if (_narrowCBList[sfid] == 1) {
                    _tmpurl += "/index.aspx?sf=" + providersListParams.sf;
                    break;
                }

                var _tmpurl2 = (document.location.href.indexOf("#") > 0 ? document.location.href.substring(0, document.location.href.indexOf("#")) : document.location.href);
                if (_tmpurl != _tmpurl2) {

                    document.location.href = _tmpurl;
                    return;
                }
            }
        }
        else {
            window.setTimeout('gvSearchFilter.performSearch()', 1);
        }
    },

    narrowByDistance: function(newDistance) {

        providersListParams.distance = newDistance;
        window.setTimeout('gvSearchFilter.performSearch()', 1);
    },

    endListProviders: function() {
        /*var _tmpSF = providersListParams.sf.split(',');

        if (_narrowCBList.length < 1) {
            _narrowCBList = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
        }
        for (var i = 0; i < _narrowCBList.length; i++) {
            var tmpLi = $("div.column_features ul li:eq(" + i + ")", gvSearchFilter.FilterBar);
            tmpLi.show();
            tmpLi.removeClass("cb_disabled");
            switch (i) {
                case 0:
                    if ((providersListParams.dcid == '269' && providersListParams.fcid != 269) || (providersListParams.dcid != '269'))
                        tmpLi.hide();
                    break;
                case 1:
                    if (providersListParams.fcid == 0 || providersListParams.fcid != providersListParams.dcid)
                        tmpLi.hide();
                    break;
                case 5:
                    if (providersListParams.fcid == providersListParams.dcid)
                        tmpLi.hide();
                    break;
                case 6:
                    if (providersListParams.fcid == providersListParams.dcid)
                        tmpLi.hide();
                    break;
                case 7:
                    if ((providersListParams.dcid == '144' && providersListParams.fcid != 144) || providersListParams.dcid != '144')
                        tmpLi.hide();
                    break;
                case 8:
                    if (providersListParams.fcid == 0 || providersListParams.dcid != providersListParams.fcid)
                        tmpLi.hide();
                    break;
                case 10:
                    if (providersListParams.dcid != 144)
                        tmpLi.hide();
                    break;
                default:

                    break;
            }
            var _tmpCB = tmpLi.find(":checkbox");
            //set if it should be disabled or not
            if (_narrowCBList[i] == 0) {
                _tmpCB.attr("disabled", "disabled");
                tmpLi.addClass("cb_disabled");
            } else {
                _tmpCB.removeAttr("disabled");
                tmpLi.removeClass("cb_disabled");
            }

            //place or remove tick
            if (_tmpSF[i] == '1') {
                _tmpCB.attr("checked", "checked");
                tmpLi.addClass("selected");
            }
            else {
                _tmpCB.removeAttr("checked");
                tmpLi.removeClass("selected");
            }

        }
        */

        //gvSearchFilter.initLocationNarrowing();
        //gvSearchFilter.initTreatmentNarrowing();

        //RHS ads might have been hidden by brochure view
        //gvRHSAds.show();

    }


});
$package("com.reva.consumer.browseproviders");
var displayProviderOnMap=null;
$class("ProviderMap", { ProviderMap:
    /**
    * Provider map
    * @alias com.reva.consumer.browseproviders.ProviderMap
    * @return {com.reva.consumer.browseproviders.ProviderMap}
    * @constructor
    */
    function(_providerDetails) {
        this.providerDetails = _providerDetails;
        this.inited = false;
    },
    init: function() {
        if (this.inited == true)
            return;
        this.inited = true;
        var _key = $("#googleMapProvider", this.providerDetails).attr("rel");
        //_providerDetails=this.providerDetails;
        //var _providerMap=this;
        $("#googleMapTitle", this.providerDetails).html($("#provider_details_title", this.providerDetails).html());
        //if($("#googleMapIframe",this.providerDetails).length>0  && $.browser.msie){
        //document.getElementById("googleMapProvider").appendChild(document.getElementById("googleMapIframe"));			
        //displayProviderOnMap();
        //}else{
        $("#googleMapProvider", this.providerDetails).html('<iframe src="/consumer/Ajax/GoogleMap.aspx?key='+_key+'" name="googleMapIframe" id="googleMapIframe" FRAMEBORDER="0"></iframe>');
        //}
    },
    selectProviderFromMap: function(_sids, _clinicid) {
        $(".provider_preview_selected").removeClass("provider_preview_selected");
        $("#provider_preview_" + _sids + "_" + _clinicid).addClass("provider_preview_selected");
        if ($.browser.msie) {
            gvProviderDetails.init(_sids);
        } else {
            setTimeout("selectProviderFromMap('" + _sids + "','" + _clinicid + "')", 100);
        }
        return false;
    }
});

function selectProviderFromMap(_sids){
	gvProviderDetails.init(_sids);
}var providersListParams = {cid:"91",pid:"0",problemid:"0",qty:"0",rid:0,dcid:"0",fcid:0,city:"",page:0,displaypage:"",location:0,sf:"0,0,0,0,0,0,0,0,0,0,0",mapview:0};
var pageInited = false;
var pageLoaded = false;
var gvAjaxManager = new com.reva.ajax.AjaxManager();
var gvProviderDetails = null;
var gvSearchFilter = null;
var gvOverviewPanel = null;
var gvProvidersList = null;
var gvGoogleMap = null;
var gvSupplierView = false;
var _firstHit = '';
var gvRHSAds;
var gvMainTabs;
var gvSplash;
var gvMapIframe;
var revaGV_Currency = "â‚¬";
var revaGV_CurrencyRate = 1;
function reva_GoToPageTop(){
		//var _scrollY = window.pageYOffset || document.documentElement && document.documentElement.scrollTop || document.body.scrollTop || 0;				
		window.scrollTo(0,0);
	}
function getQueryString(_href)
{
    if (_href == undefined)
    {
        return '';
    }
    else
    {
	    if(_href.indexOf("?")>=0)
	    {
		    return _href.substring(_href.indexOf("?")+1);
	    }
	    return _href;
	}
}

function buildProviderRelatedQuery(_providerId, _clinicId, _rpos){
    if (_providerId)
	{
	    if (_rpos)
		{
		    return $.param(providersListParams) + "&sids=" + _providerId + "&clinicid=" + _clinicId + "&rpos=" + _rpos;
		}
		else
		{
		    return $.param(providersListParams) + "&sids=" + _providerId + "&clinicid=" + _clinicId;
		}
    }
    else
	{
	    return $.param(providersListParams);
	}
	
}

//simple helper function to return a value from a cookie.Returns empty if no value
function reva_getCookieValue(cookieName)
{
	var nameEQ = cookieName + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function getConsultationLink(_queryString)
{
	_queryString=_queryString.replace("rid=0","rid=-1");
	return "https://"+window.location.host+"/consumer/consultationform.aspx?" + _queryString;		
}

/*
 * page inits
 */


function initRequestParams(){
	
	//if(window.location.hash!="" && window.location.hash.match("provider_details_tab")==null){
	if(window.location.hash!=""){
		//alert(window.location.hash.substr(1));
		//need to remove the # at the start of the values we need
		if(gvProviderDetails)
			gvProviderDetails.queryString = window.location.hash.substr(1);
		parseRequestQuery(window.location.hash.substr(1));			
	}else{
		if(gvProviderDetails)
			gvProviderDetails.queryString = strQueryString;
		parseRequestQuery(strQueryString);
	}
	
	
	
	$.historyInit(
        function(_hash) {
			
    		if((_hash || (_hash=='' && _firstHit != '')) && pageLoaded && pageInited)
				{
					//alert("3 - "+_hash);
					pageLoaded=false;
					var _queryString='';
					if(_hash=='' && _firstHit != '')
						_queryString = _firstHit;
					else	
						_queryString=_hash.replace(/%2C/g,",");	
					if(gvProviderDetails)
						gvProviderDetails.queryString=_queryString;
	    			parseRequestQuery(_queryString);
					
					reva_showSplash('Updating Results')	
					window.setTimeout('hashChanged();',1);
						    										
				}
    	}
    );
    
	_firstHit = $.param(providersListParams);	
    
}


function parseRequestQuery(_qString){		
	if (_qString != "" ){
		_qString=getQueryString(_qString);
		_qString = _qString.replace(/%2C/ig,',');		
		_qString = _qString.split("&");
		if(gvProviderDetails)
			gvProviderDetails.providerId=0;
				
		for(var _i = 0; _i < _qString.length; _i++)
		{	
				var _currentParam=_qString[_i].split("=");
				if(typeof(providersListParams[_currentParam[0]])!="undefined"){
					
					providersListParams[_currentParam[0]]=_currentParam[1];
				}else if(_currentParam[0]=="sids" && gvProviderDetails){
					gvProviderDetails.providerId=_currentParam[1];
				}else if(_currentParam[0]=="clinicid" && gvProviderDetails){
					gvProviderDetails.clinicId=_currentParam[1];
				}
		}
	}
	
	if(typeof(providersListParams["rid"])=="undefined")
		providersListParams["rid"]=0
		
	if(providersListParams["rid"]==-1){
		providersListParams["rid"]=0;
	}
	
	if(providersListParams["city"] && typeof(providersListParams["city"])!="undefined" && providersListParams["city"]!="" && providersListParams["city"].lenght > 2)
	{
		providersListParams["city"] = providersListParams["city"].charAt(0).toUpperCase() + providersListParams["city"].substr(1);			
	}else
		providersListParams["city"] = "";
	
	var tmpfcidparams =  reva_getCookieValue("fcidparams");	
	if(tmpfcidparams)
	{
		var tmpCurrency = tmpfcidparams.split("|")[0];
		switch(tmpCurrency)
		{
			case '0':
				revaGV_Currency = "&euro;";
				break;
			case '1':
				revaGV_Currency = "&pound;";
				break;
			case '2':
				revaGV_Currency = "&yen;";
				break;
			case '3':
				revaGV_Currency = "&#376;";
				break;
			default:
				revaGV_Currency = tmpCurrency;
				break;	
				
		}		
		revaGV_CurrencyRate = 	tmpfcidparams.split("|")[1];
	}
	tmpfcidparams =  reva_getCookieValue("fcid");	
	if(tmpfcidparams)
	{
		providersListParams.fcid = 	tmpfcidparams;
	}
	
}

function hashChanged(){
	pageLoaded = false;
	reva_showSplash("Updating Results");
	
	gvSearchFilter.buildLists();
	gvOverviewPanel.displayOverview();
	gvProvidersList.listProviders(true);
	
	reva_setMainTabs();	
	gvMainTabs.show();	
	gvSearchFilter.displayFilteredText();
	window.setTimeout('gvSplash.hide();',1);	
	
	pageLoaded=true;	

}


function reva_cachePrep(){	
	gvProvidersList.ajaxCache.setItem($.param(providersListParams), gvProvidersList.mainContainer.html());
	
	gvOverviewPanel.ajaxCache.setItem($.param({
					cid: providersListParams.cid,
					pid: providersListParams.pid,
					problemid: providersListParams.problemid, 
					rid: providersListParams.rid,
					dcid: providersListParams.dcid,
					city: providersListParams.city,
					displaypage: providersListParams.displaypage,
					location: providersListParams.location,
					ver: providersListParams.ver
				}), gvOverviewPanel.mainContainer.html());
	
	if (gvProviderDetails && gvProviderDetails.isProviderSelected())
		gvProviderDetails.ajaxCache.setItem($.param({ cid: providersListParams.cid, pid: providersListParams.pid, problemid: providersListParams.problemid, clinicid: gvProviderDetails.clinicId }), gvProviderDetails.mainContainer.html());                
	
	
	gvSearchFilter.ajaxCacheCountry.setItem($.param({
		cid: providersListParams.cid,
		fcid: providersListParams.fcid,
		pid: providersListParams.pid,
		problemid: providersListParams.problemid,
		rid: providersListParams.rid,
		dcid: providersListParams.dcid,
		location: providersListParams.location
	}), gvSearchFilter.locDiv.html());
	
	gvSearchFilter.ajaxCacheTreatment.setItem($.param({
		cid: providersListParams.cid,
		fcid: providersListParams.fcid,
		pid: providersListParams.pid,
		problemid: providersListParams.problemid,
		rid: providersListParams.rid,
		dcid: providersListParams.dcid,
		location: providersListParams.location
	}), gvSearchFilter.trDiv.html());
	
	gvSearchFilter.ajaxCacheClinicType.setItem($.param({
		cid: providersListParams.cid,
		fcid: providersListParams.fcid,
		pid: providersListParams.pid,
		problemid: providersListParams.problemid,
		rid: providersListParams.rid,
		dcid: providersListParams.dcid,
		location: providersListParams.location
	}), gvSearchFilter.ctDiv.html());
}

function reva_Modal_PhoneClinic(cName, cPhone, linkID, clinicId)
{
	$("#lightbo p b:eq(0)").html(cName);
	$("#lightbo p b:eq(1)").html(cPhone);
	$("#lightbo").show();
	gvAjaxManager.logRequest('link=' + linkID + '&clinicid=' + clinicId);
	try{
		gvAjaxManager.logRequest('phone=1&rid=' + providersListParams.rid + '&dcid=' + providersListParams.dcid + '&city=' + providersListParams.city + '&clinicid=' + clinicId);
		}
		catch(failedlog){}
}

function reva_setMainTabs(){	
	
	$("#list_view").show();
	$("#providersOverviewHolder").hide();
	var _tmptext = $("#text_country").attr("rel");
	if(providersListParams.pid>0 && $("#text_treatment").length>0)
		_tmptext = $("#text_treatment").attr("rel");
	$(".title_links .pseudoLink").text(_tmptext);
}

function reva_mapClick(thisLink)
{
	gvAjaxManager.logRequest("tab=2&" + $.param(providersListParams));
	var _tmpurl = $('div.column_treatment a.selected').attr("href");
	if (typeof(_tmpurl) != "undefined") {
		_tmpurl += "/map";
		var _narrowCBList = providersListParams.sf.split(',');
			for(sfid in _narrowCBList)
				if(_narrowCBList[sfid] == 1)
				{
					_tmpurl += "/index.aspx?sf="+providersListParams.sf;
					break;
				}
				
		thisLink.href = _tmpurl;
						
	}
				
}

function reva_infoSwitch(theLink)
{
	theLink = $(theLink);	
	if(theLink.text().toLowerCase().indexOf("info") > 0)
	{		
		$("#list_view").hide();
		$("#providersOverviewHolder").show();
		theLink.text("Return to Listings");
		if($(".title_links span").length>1)
			$(".title_links span:eq(0)").hide();
		
		//gvAjaxManager.logRequest("tab=3&" + $.param(providersListParams));
		
	}else
	{
		$("#list_view").show();
		$("#providersOverviewHolder").hide();
		var _tmptext = $("#text_country").attr("rel");
		if(providersListParams.pid>0 && $("#text_treatment").length>0)
			_tmptext = $("#text_treatment").attr("rel");
		theLink.text(_tmptext);
		$(".title_links span:eq(0)").show();
		//gvAjaxManager.logRequest("tab=1&" + $.param(providersListParams));	
	}
	
}

function reva_showSplash(splashText) {
    if (splashText)
        $("#search_splash p").html(splashText);
    $('#ani a').animate({ backgroundPosition: "(500px -1110px)" }, { duration: 8000, callback: function() { if (pageLoaded && !pageLoaded) reva_showSplash(); } });
    $("#search_splash").show();
}


function reva_trackLink(thehref,linkID) {
    if(gvAjaxManager == null)
		gvAjaxManager = new com.reva.ajax.AjaxManager();
	
	try{
		gvAjaxManager.logRequest('searchlink='+linkID+'&');
		}
		catch(failedlog){}
	
	
}
