    function getKeyCode(e)
	{
		if (window.event)
			return window.event.keyCode;
		else if (e)
			return e.which;
		else
			return null;
	}

	function readCookie(name)
	{
		var nameEQ = name + "=";
		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 keyRestrict(e, validchars,target)
	{
		var key='', keychar='';
		key = getKeyCode(e);
		if (key == null) return true;
		keychar = String.fromCharCode(key);
		keychar = keychar.toLowerCase();
		validchars = validchars.toLowerCase();
		if (validchars.indexOf(keychar) != -1)
		{
			if (keychar == '.' && target.value.indexOf(keychar) != -1) {return false;}
			else {return true;}
		}
		if ( key==null || key==0 || key==8 || key==9 || key==13 || key==27 )
			return true;
		return false;
	}
	
	
	function changeOrder(val)
	{
	    var combo
	    if (val == '1')
	    {
	       combo =  document.forms[0].OrderFirst;
	    }
	    else if (val == '2')
	    {
	       combo =  document.forms[0].OrderFirstBottom;
	    }
	    
	    
		/*
		var combo = document.forms[0].OrderFirst;
		if (!combo)
		{
		    combo = document.forms[0].OrderFirstBottom;
		}
		*/
		var filter = 'NewestFirst';		

		switch (combo.options[combo.selectedIndex].text)
		{
		    
			case 'Newest First':
				filter = 'NewestFirst';
				break;
			case 'Oldest First':
				filter = 'OldestFirst';
				break;
			case 'Male Only':
				filter = 'MaleOnly';
				break;
			case 'Female Only':
				filter = 'FemaleOnly';
				break;
			case 'Most Helpful First':
				filter = 'MostHelpful';
				break;
			case 'Least Helpful First':
				filter = 'LeastHelpful';
				break;
			case 'Same as Your Home Location':
				filter = 'SameLocation';
				break;
			case 'Different than Home Location':
				filter = 'DifferentLocation';
				break;
			default:
				// Check for dynamic ones here.
				var testValue = new String()
				testValue = combo.options[combo.selectedIndex].text;
				if (testValue.match('^(Same as)(.{0,})(Location)$'))
				{
					filter = 'SameLocation-Property';
					break;
				}
				break;
		}
			
		doAjaxInitReviews(filter);
		
	}
	
	function doAjaxChangeReviews(pageNumber, useFilter)
	{		
	
		var param = 'a=pagedReview';
		param = param + '&u=' + userId;
		param = param + '&w=' + webId;
		param = param + '&d=' + delayHours;
		param = param + '&pn=' + pageNumber;
		/* change ppg from 10 to 5 for 4.0 */
		param = param + '&ppg=5';
		param = param + '&fil=' + useFilter;
		param = param + '&p=' + encodeURIComponent(propertyName);
		param = param + '&r=' + escape(recordLink);
		param = param + '&vid=' + verticalId;
		
		
		
		var url = '/verticals/PropertyDetailsFunction.aspx';			
		var ajaxSubmit = new Ajax.Request(
			url, 
			{
				method: 'get', 
				parameters: param, 
				onComplete: doAjaxChangeReviewsCallback
			});
			
							
		
	}
	
	
	function doAjaxChangeReviewsCallback(response)
	{			
		var replaceDiv = document.getElementById('memRevs'); // Find the replacement target.						
		if (replaceDiv != null){replaceDiv.innerHTML = response.responseText;}		
	}

	function doAjaxUserFeedback(feedbackValue, targetVoteId)
	{						
		// Build the params
		var param = 'a=leaveFeedback';
		param = param + '&u=' + userId;
		param = param + '&w=' + webId;
		param = param + '&v=' + targetVoteId;
		param = param + '&f=' + feedbackValue;
		param = param + '&ct=' + readCookie('ZagatCID');
	    
		var url = '/verticals/PropertyDetailsFunction.aspx';
		var ajaxSubmit = new Ajax.Request(
			url, 
			{
				method: 'get', 
				parameters: param, 
				onComplete: doUserFeedbackCallback
			});					
	}

	function doAjaxInitReviews(inFilter)
	{

		var useFilter = 'NewestFirst';		
		if (inFilter != null) {useFilter = inFilter;}		
		// Build the params
		var param = 'a=pagedReview';
		param = param + '&u=' + userId;
		param = param + '&w=' + webId;
		param = param + '&d=' + delayHours;
		param = param + '&pn=1';
		/* change ppg from 10 to 5 for 4.0 */
		param = param + '&ppg=5';
		param = param + '&fil=' + useFilter;
		param = param + '&p=' + encodeURIComponent(propertyName);
		param = param + '&r=' + recordLink;
		param = param + '&vid=' + verticalId;
		
	
		var url = '/verticals/PropertyDetailsFunction.aspx';
		var ajaxSubmit = new Ajax.Request(
			url, 
			{
				method: 'get', 
				parameters: param, 
				onComplete: doInitReviewsCallback
			});
				
	}
	
				
	function doUserFeedbackCallback(response)
	{		
		var responseItems = new Array();
		responseItems = response.responseText.split('|');

		var helpfulYes = document.getElementById('helpfulYes' + responseItems[1]);
		var helpfulNo = document.getElementById('helpfulNo' + responseItems[1]);

		if (responseItems[0] == '2') {helpfulYes.innerHTML = 'Yes'; helpfulNo.parentNode.removeChild(helpfulNo);}
		else {helpfulNo.innerHTML = 'No'; helpfulYes.parentNode.removeChild(helpfulYes);}
	}
	
	function doInitReviewsCallback(response){				
		// Find the replacement target.
		
		var replaceDiv = document.getElementById('memRevs');					
		if (replaceDiv != null){replaceDiv.innerHTML = response.responseText;}	
		
	}
	
	function updateVote(radioObject){	
		// The name is what is commonly shared between all of the items.
		var radioName = radioObject.name;
		
		// Select all options that actually have the same name that was just selected.
		var radioOptions = document.getElementsByName(radioName);
			
		// Iterate through all of the options.
		for (var i = 0; i < radioOptions.length; i++)
		{
			// The state of the image will depend on whether this was the item
			// that was just clicked.
			if (radioOptions[i].id == radioObject.id)
			{
				// Pull all the labels.
				var labels = document.getElementsByTagName('label');				
				// Find the label that matches.
				for (var j = 0; j < labels.length; j++)
				{				
					// 'for' is for all browsers except ie, 'htmlFor is for ie.
					var forAttribute = (labels[j].getAttribute('for') || labels[j].getAttribute('htmlFor'));					
					if (forAttribute == radioObject.id){labels[j].className = 'act';} // Set it to the active class.
				}				
			}
			else
			{
				var labels = document.getElementsByTagName('label');
				for (var j = 0; j < labels.length; j++)
				{					
					var forAttribute = (labels[j].getAttribute('for') || labels[j].getAttribute('htmlFor')); // 'for' is for all browsers except ie, 'htmlFor is for ie.									
					if (forAttribute == radioOptions[i].id){labels[j].className = '';} // Set it to no class (inactive).
				}	
			}
		}						
	}
	
var lengthtexting = true;
var substringlength = 0;

function updateRemainSpan(target, lenLimit)
{
	// Grab the span in question.
	var remainSpan = document.getElementById('remain');
	remainSpan.innerHTML = lenLimit - target.value.length + ' ';
}

function chktextlen(object,evnt,lenlimit){

    if (lengthtesting = false) { /* Are we disabled? */
		updateRemainSpan(object, 450);
        return true;            /* Yes, exit        */
    }

    if (typeof(evnt.keyCode) != "undefined") { /* possibly IE? */
        var asciicode = evnt.keyCode; /* get ascii code from
                                            evnt.keyCode */
    }
    else {
        if (typeof(evnt.which) != "undefined") { /* Possibly NN? */
            var asciicode = evnt.which;  /*get the ascci code from
                                            evnt.which */
        }
        else {                /* If we get here neither evnt.which or
                                    evnt.keyCode are defined and we
                                    cannot perform length checking because
                                    we can't look at the key that was
                                    pressed */
                testlengthenabled = false;  /* Disable our self */
                updateRemainSpan(object, 450);
                return true;   /* return True to accept keystroke */
        }
    }
    /* Now we check for and accept a Control key, but not the Enter key,
        and for a backspace If it is a control key other than enter or
        the backspace, we accept the keystroke */
    /* NOTE - NN 4 does not pass any control keys other than enter and
        backspace to the KeyPress event, but IE 4 does, so we have to
        check for them, so as not to incorrectly disallow them */

    if ((asciicode <= 31) && (asciicode != 13) ||  (asciicode == 8) || (asciicode == 17) || ((asciicode >= 33) && (asciicode <= 40)) || ((asciicode >= 45) && (asciicode <= 46)))
	{
		updateRemainSpan(object, 450);
        return true;
    }

    if (object.value.length < lenlimit)
    {
        updateRemainSpan(object, 450);
        return true;  /* Limit not reached, accept keystroke */
    }
    else {  /* We are at or over the limit, if over the limit,
                we trim the text - see notes below */
        if (object.value.length > lenlimit) {
            object.value = object.value.substring(0,substringlength);
        }
            updateRemainSpan(object, 450);
            return false;  /* Ignore the keystroke */
    }
}

function getComment(divObject)
{	
	var outValue = ''; // Default the out.
	// Get all of the list objects.
	var allText = divObject.getElementsByTagName('textarea');		
	// Iterate through the labels.
	if (allText.length > 0) {outValue = escape(trimAll(allText[0].value));}	
	return outValue;	
}
	
function getCost(divObject)
{	
	var outValue = -1; // Default the out.	
	// Get all of the text objects.
	var allText = divObject.getElementsByTagName('input');	
	if (allText.length > 0){outValue = allText[0].value;}	
	return outValue;
}
	
function getVote(divObject)
{	
	var outValue = -1; // Default the out.	
	// Get all of the list objects.
	var allLabels = divObject.getElementsByTagName('label');	
	// Iterate through the labels.
	for (var i = 0; i < allLabels.length; i++)
	{		
		if (allLabels[i].className == 'act') {outValue = i;} // Now, check to see if the current label is active.
	}	
	return outValue;	
}


function doAjaxSubmit(){
		    
    var ddlCuisine;
	var ddlNeighborhood;
	// Build the parameter string.  First, iterate through all the votes
	var allDivs = document.getElementsByTagName('div');	
	var cusineid;
	var neighborhoodid;	
	
	showError('');
	if (ptype==1)
	{	  
		
	    var dvStandardSubHeader = document.getElementById('dvStandardSubHeader');

	    if (dvStandardSubHeader)
	    {

	        dvStandardSubHeader.className = 'elhide';	
	    }
	}

	if(ptype==2) //we have dropdowns
	{	

	  if (detailFlag){
	      if (detailFlag == 1) {
	        ddlCuisine = document.getElementById('ctl00_ctl00_MainMasterPageContentHolder_MainContentPlaceHolder_ucUserReview_ddlCuisine');
	        ddlNeighborhood = document.getElementById('ctl00_ctl00_MainMasterPageContentHolder_MainContentPlaceHolder_ucUserReview_ddlNeighborhood');
	      }
	  }
	  else{	  
	    ddlCuisine = document.getElementById('ctl00_ctl00_MainMasterPageContentHolder_ResultsListContentPlaceHolder_UsrReview_ddlCuisine');
	    ddlNeighborhood = document.getElementById('ctl00_ctl00_MainMasterPageContentHolder_ResultsListContentPlaceHolder_UsrReview_ddlNeighborhood');	                                             
      }           
      

	  if(ddlCuisine && ddlNeighborhood){ 
	    if(ddlCuisine.selectedIndex < 1){
	        showError('Please complete all required fields.');
		    return false;
	      }
	    if( ddlNeighborhood.length > 1 && ddlNeighborhood.selectedIndex < 1){
	        showError('Please complete all required fields.');
		    return false;
		  }
		    
	      cusineid=ddlCuisine.options[ddlCuisine.selectedIndex].value;
		  neighborhoodid=ddlNeighborhood.options[ddlNeighborhood.selectedIndex].value;
	  }
	  else
	  {

	    showError('Unable to process.  Vote not submitted.');
		return false;
	  }			  
   }	     
	
	// Set the action for the function page.
	var param = 'a=submitVote';

	if (isEdit=='1') 
	{
	    param +='&n=0';
	}
	else 
	{
	    param +='&n=1';
	}
	
	param+='&islst=' + islist;
	//adding geoid
	param+='&geoid=' + geoid;
	//adding  type of property
	param+='&tp=' + ptype;	
	//adding cuisine and neighborhood
	if(cusineid!=''){param+='&cnm=' + cuisines; param+='&cid=' + cusineid;}
	if(neighborhoodid!=''){param+='&nnm=' + neighborhood; param+='&nid=' + neighborhoodid;}
	
	// Seed the sequence.
	var voteSeq = 1;
		
	for (var i = 0; i < allDivs.length; i++)
	{		
		if (allDivs[i].className == 'revnum') 	// Check to see if it contains a vote.
		{			
			// Check to see if it is required.
			var isRequired = allDivs[i].getAttribute('isRequired');			
			// Get the vote value.
			var voteValue = getVote(allDivs[i]);			
			// Check for required.
			if (isRequired == 'True' && voteValue == -1)
			{
				showError('Please complete all required fields.');
				return false;
			}
			else
			{	// Append the previous & if there is a length.
				
				if (param.length > 0) {param = param + '&';}				
				// Update the parameter.
				param += 'v' + voteSeq + '=' + voteValue;				
				// Increment the sequence.
				voteSeq++;
			}							
		}
		else if (allDivs[i].className == 'revcost')
		{
			// Check to see if it is required.
			var isRequired = allDivs[i].getAttribute('isRequired');			
			// Get the cost value.
			var costValue = getCost(allDivs[i]);			
			// Check for required.
			if (isRequired == 'True' && costValue == -1){
				showError('Please complete all required fields.');
				return false;
			}
			else
			{	// Append the previous & if there is a length.
			    if (costValue)
			    {
				if (param.length > 0) {param += '&';}				
				// Update the parameter.
				param += 'v' + voteSeq + '=' + costValue;				
				// Increment the sequence.
				voteSeq++;
				}
			}
		}		
	}	
	
	// Now, fill in the rest of the vote sequences.
	do
	{	// Append the previous & if there is a length.
		if (param.length > 0) {param += '&';}						
		param += 'v' + voteSeq + '=';	// Update the parameter.			
		voteSeq++
	}
	while (voteSeq <= 5)
	
	// Find the div with the description.
	for (var i = 0; i < allDivs.length; i++)
	{	// Check for the description.
		if (allDivs[i].className == 'revdesc')
		{	// Append the previous & if there is a length.
			if (param.length > 0) {param += '&';}
			
			var commentValue = getComment(allDivs[i]);			
			
			if(ptype==2){
				if(commentValue.length == 0){
				  var status = showReviewError(true)
				  //for safety
				  if (!status){showError('A review is required before submitting. Please add your review.');}				     
				  return false;
				  }
			  }
			
			// Update the parameter.
			param += 'c=' + commentValue;
						
			break;
		}
	}
    
	param += '&s=' + surveyTypeId;
	param += '&u=' + userId;
	param += '&w=' + webId;
	param += '&vid=' + vID;
	param += '&p=' + encodeURIComponent(propertyName);
	param += '&cc=' + costCurrencyId;
	param += '&ct=' + readCookie('ZagatCID');
	param += '&ip=';
	if (voteId != '0' && voteId != 0) {param += '&v=' + voteId;}
	else {param = param + '&v=';}
	// Find the error node.  This is temp, to show when the vote is being
	// submitted.
	
	if (surveyTypeId == 0){
		    showError('Unable to locate Survey Type ID.  Vote not submitted.');
			return false;
		}
	else
		{
	
		showError('Submitting Vote...');
		var url = '/verticals/PropertyDetailsFunction.aspx';
		var ajaxSubmit = new Ajax.Request(
		url, 
		{
			method: 'get', 
			parameters: param, 
			onComplete: doSubmitCallback
		});		
	    }									
}

function ConvertCarriageReturns(textarea, strReplace)
{
textarea.value = escape(textarea.value)

for(i=0;i<textarea.value.length;i++)
	{if(textarea.value.indexOf("%0D%0A") > -1 ) {textarea.value = textarea.value.replace("%0D%0A",strReplace)}}
	
textarea.value = unescape(textarea.value)
}

function doSubmitCallback(response)
{	
	// Find the error node.  This is temp, to show when the vote is being
	// submitted.
	showError('');
	// Parse the response XML by loading it into a document structure.
	var docXml = response.responseXML.documentElement;	

    if (!docXml) {byeFlyover();} //object is null because of error.
       
	//checking validation	
	var prifviol = docXml.getElementsByTagName('profanityviolation')[0];			 
	if(prifviol)
	  {	  	  	   	   
	  if(prifviol.firstChild.nodeValue=='1')
	    {return showReviewError(false);}
	  else 
	    {return showReviewError(true);}  
	  }	 		
	// There are two primary pages that this is currently called from.  Each
	// of them have a slightly different behavior, in regards to what needs
	// to be accomplished on a response callback.		

	if (islist == 0) //PropertyDetails.aspx page
		{ 
		var headerObject = document.getElementById('ctl00_ctl00_MainMasterPageContentHolder_MainContentPlaceHolder_UserReview_dvStandardHeader');			
		if (headerObject != null) {headerObject.innerHTML = '<h3 class=\'toggle\'><span>View/Edit Your Review</span></h3>';}						
		}
			
	// Evaluate the JSON array structure that is returned.  It will
	// create an object called updateParam.
	var replacementTarget = docXml.getElementsByTagName('linkReplacement')[0];
			
	if (islist == 1) //AjaxResults.aspx page
	{			
		var linkObjects = document.getElementsByTagName('a');
		if (linkObjects)
		{
			for(i = 0; i < linkObjects.length - 1; i++)
			{
				var linkObject = linkObjects[i];
				if (linkObject)
				{
					if (linkObject.id == 'link' + webId)
					{
						var cleanedJSON	= new String();
						cleanedJSON = unescape(replacementTarget.text);
						linkObject.setAttribute('json', replacementTarget.firstChild.nodeValue)
						linkObject.innerHTML = 'Update Your Review';													
						if(ptype==2){
						  linkObject.setAttribute('ptype',1); 
						  ptype=1;						  
						  trWebId = document.getElementById('tr'+webId); //we need to change image and style						  
						  if(trWebId){
							trWebId.className = 'member';														  
							var curSpan = document.getElementById('spnimg'+webId); 
							if(curSpan)
							  {
							   curSpan.innerHTML ='Member Added';
							   addEvent(curSpan, 'mouseover', function() {showMemAdd(this);});			
							   addEvent(curSpan, 'mouseout', function() {hideMemAdd(this);});
							  }							
							}	
						  }
						  							
						break;
					}
				}
			}
		}															
	}			
	
	//var descText = docXml.getElementsByTagName('description')[0].firstChild.data;
	var thankText = docXml.getElementsByTagName('thank')[0].firstChild.nodeValue;
	
	// Reload the window due to problems with Anchoring the change on submit.
	// CR 18407
	
	//

	var fbPublish = docXml.getElementsByTagName('fbPublish')[0];
	if (fbPublish) {
	    eval(fbPublish.firstChild.nodeValue);    
	}
	
	if(islist == 1)
	{
	    if (!fbPublish) {
	        SetReviewConfirmation(thankText);
	        byeFlyover();
	        scroll(0, 0);
	    }
	    else {
	        thankYouText = thankText;
	    }
	   
	}
	else {
	    if (!fbPublish) {
	        window.location.hash = '#movetoreviews';  //String(window.location).replace(/\#.*$/, "")  + '#movetoreviews';
	        window.location.reload();
	    }
	        
	}
	
	
	//if(islist == 1)
	//{
	//SetReviewConfirmation(thankText); byeFlyover();
	//window.location.hash = '#thankjump';
	//}
	//else
	//{
	//SetReviewConfirmationNew(thankText);
	//window.location.hash = '#thankjump';
  //}
    
    
	// Find the vote id.
	//if (docXml.firstChild.textContent)
	//{
	//var vId = docXml.firstChild.textContent;
	//if (vId != null)
	//    {
	//        voteId = vId;
	//        isEdit = '1';
	//    }
	//}
	//else if (docXml.selectSingleNode('vote_id'))
	//{
	//   var vId = docXml.selectSingleNode('vote_id').text;
	//    if (vId != null)
	//    {
	//        voteId = vId;
	//        isEdit = '1';
	//    }
	//}									
}

function showFeedDialogResult() {
    window.location.hash = '#movetoreviews';  //String(window.location).replace(/\#.*$/, "")  + '#movetoreviews';
    window.location.reload();
}

var thankYouText;

function showFeedDialogResultList() {
//    SetReviewConfirmation(thankYouText);
//    byeFlyover();
    //    scroll(0, 0);

    //WI# 3715 - FB is causing the form fields to lock.
    //only refresh the page on an FB publish.
    window.location.reload();
}
function showError(varErr)
{

	var errorDiv = document.getElementById('errors');
	
	if(errorDiv)
	{			
		if(varErr!='') {errorDiv.style.display = 'block';}
		else {errorDiv.style.display = 'none'; } 
		errorDiv.innerHTML = varErr;  
		errorDiv.className = 'error_msg';    
	}
			
	if(varErr=='')
	  {
	  var errorReview = document.getElementById('errors_review');
	  var errorsProfanity = document.getElementById('errors_profanity');
	  var errorsRequired = document.getElementById('errors_required');
	  if(errorReview){errorReview.style.display = 'none';}  			  
	  if(errorsProfanity){errorsProfanity.className = 'elhide';}  	  	
	  if(errorsRequired){errorsRequired.className = 'elhide';}  
	  }	  		
}



function showReviewError(isRequired){		
	try
		{		
		var errorReview = document.getElementById('errors_review');
		var errorsProfanity = document.getElementById('errors_profanity');
		var errorsRequired = document.getElementById('errors_required');
	
		if(errorReview && errorsProfanity && errorsRequired){
			errorReview.style.display = 'block';
			errorReview.className = 'error_msg';
					
			if(isRequired)
				{errorsRequired.className = 'elview'; errorsProfanity.className = 'elhide';}
			else
				{errorsRequired.className = 'elhide'; errorsProfanity.className = 'elview';}
			return true;	
			}
		else {return false;}
		}
	catch(err)
		{return false;}				
}

//trim leading and ending spaces from strings
function trimAll(sString){
	while (sString.substring(0,1) == ' '){
		sString = sString.substring(1, sString.length);
	}
	while (sString.substring(sString.length-1, sString.length) == ' '){
		sString = sString.substring(0,sString.length-1);
	}
return sString;
}

function SetReviewConfirmationNew(msg)
{

        var divConf = document.getElementById('editConfirm');
        if(divConf) 
        {
            divConf.style.display="block";
            
            if (document.all) //IE
            {
                if (divConf.innerHTML.indexOf('Thank you for reviewing')< 0)
                {
                    divConf.innerHTML = '<div class="confirmMsg" >' + msg + '</div>' + divConf.innerHTML; 
                    //displayHeader();
                    window.scrollTo(0,findPosY(divConf) - 20); 
                }
            }
            else //Firefox
            {
                
                if (divConf.innerText.indexOf('Thank you for reviewing')< 0)
                {
                    divConf.innerText = '<div class="confirmMsg" >' + msg + '</div>' + divConf.innerText; 
                    //displayHeader();
                    window.scrollTo(0,findPosY(divConf) - 20); 
                }
            }
            
        }
        else
        {
        
          divConf = document.getElementById('editDefault');
          if (divConf)
          {
              if (divConf.innerHTML.indexOf('Thank you for reviewing')< 0)
              {
                divConf.innerHTML =  '<div class="confirmMsg" >' + msg + '</div>' + divConf.innerHTML; 
                //displayHeader();
                window.scrollTo(0,findPosY(divConf) - 20); 
              }
          }
          
        }
        
        
     displayHeader();

     var addLink1 = document.getElementById('addReviewLink');
     if (addLink1) 
     {
        addLink1.className = 'editReview';
     }
     var addLink = document.getElementById('addRev');
     if (addLink)
     {
        addLink.className = 'editReview';
     }
     
     var noReviewDiv = document.getElementById('propDetailUpsell');
     
     if (noReviewDiv)
     {
        noReviewDiv.style.display="none";
     }
     
    
}

//This functions hides the User Review control and displays the header + button
function displayHeader()
{
    
    var headerDiv = document.getElementById("editConfirm");
    if (headerDiv)
    {
        headerDiv.style.display = "block";
        
    }
    
    var showButton = document.getElementById("addRev");
    if (showButton)
    {
        showButton.style.display = "block";
        //showButton.className = "editReview";
        
    }
    
    var showButton = document.getElementById("mainAddButton");
    if (showButton)
    {
        showButton.style.display = "block";
        //showButton.className = "addReview";
        
    }
    
    var showButton = document.getElementById("mainEditButton");
    if (showButton)
    {
        showButton.style.display = "block";
        //showButton.className = "editReview";
        
    }
    
    var textBody = document.getElementById("editbody");
    if (textBody)
    {
        textBody.style.display = "none";
        textBody.className = "hidepane";
    }
    
}


function toggleUserReviewpane () 
{
 
var obj = document.getElementById('editbody');

var paneobj=obj;
while (!(paneobj.className.match(/showpane/) || paneobj.className.match(/hidepane/))) 
{
    paneobj=paneobj.parentNode;
}

//Check if pane is in a paneset
var setobj=paneobj;
while ( (!setobj.className.match(/paneset/)) && (setobj.nodeName!="BODY") ) 
{
setobj=setobj.parentNode;
}

//If paneset exists, turn off sibling showpanes
if (setobj.nodeName!="BODY") 
{

var sibs=getElementsByClassName(setobj,"div","showpane");

    for (var k=0; k<sibs.length; k++) 
    {
        if (sibs[k] != paneobj) 
        {
            sibs[k].className = sibs[k].className.replace(new RegExp(/hidepane/), "showpane")
        }
    }
}
//CR#17720 Keep the Your Review panel open - do not hide pane.  -James Sang 09/14/07
toggleclass1 (paneobj,"showpane","showpane");

return false;
 
}

function toggleUserReviewpaneNew () 
{
    var obj = document.getElementById('mainEditButton');
    
    if (!obj)
    {
        obj = document.getElementById('mainAddButton');
    }
   
    if (obj)
    {   
        if (obj.style.display=="block" || obj.style.display=="")
        {
            obj.style.display = "none";
        }
        else
        {
           obj.style.display = "block";
        }
    
    }
    
    //CR#17720 Keep the Your Review panel open - do not hide pane.  -James Sang 09/14/07
    toggleclass1 ("showpane","hidepane");
}

function toggleclass1(obj, state1, state2) 
{

	//obj.className = state2;
	
	var obj1 = document.getElementById('editbody');
	obj1.className = state1;
	obj1.style.display="block";
	
}

/*function WikiCallBackTrue(propid)
{ 
 ShowMsg();
 objnewid = document.getElementById('ctlEditDetails_lnkSubmit');
 if(propid > 0 && objnewid){Anthem_FireCallBackEvent(objnewid,event,'updatelatlong',propid,false,'','','',true,null,null,null,true,true); } 
}*/

function WikiCallBackTrue(propid)
{ 
    
	ShowMsg();
	objnewid = document.getElementById('Anthem_ctl00_ctl00_MainMasterPageContentHolder_ctlEditDetails_lnkSubmit__');
	if(propid > 0 && objnewid)
	{

		if (ie == true)
		{
			Anthem_FireCallBackEvent(objnewid,event,'updatelatlong',propid,true,'','','',true,null,null,null,true,true);
		}
		else
		{
			var evt = document.createEvent("UIEvents");
			evt.initUIEvent("click", true, true, window, 1); 
			Anthem_FireCallBackEvent(objnewid,evt,'updatelatlong',propid,true,'','','',true,null,null,null,true,true);
		}


	} 
}

function WikiCallBackTrue()
{
    ShowMsg();
}

function WikiCallBackFalse()
{
//alert('false');
}

/* POST ANTHEM FUNCTION CALL*/
function ShowMsg()
{
byeFlyover();
objmsg = document.getElementById('confirmMsg');
if(objmsg){objmsg.style.display='block'; objmsg.focus();} 
}
function ShowWiki()
{
callFlyover('flyWiki');
objmsg = document.getElementById('confirmMsg');
if(objmsg){objmsg.style.display='none';} 
}


function URLDecode (encodedString) {
  var output = encodedString;
  var binVal, thisString;
  var myregexp = /(%[^%]{2})/;
  while ((match = myregexp.exec(output)) != null
             && match.length > 1
             && match[1] != '') {
    binVal = parseInt(match[1].substr(1),16);
    thisString = String.fromCharCode(binVal);
    output = output.replace(match[1], thisString);
  }
  return output;
}
