function changeTab(tabNum)
{
  var blueLeft ="images/ltr_left_corner_blue_tab.gif";
  var blueRight ="images/ltr_right_corner_blue_tab.gif";
  var whiteLeft ="images/ltr_left_corner_white_tab.gif";
  var whiteRight ="images/ltr_right_corner_white_tab.gif";
  
  var tabID;
	for(var i=2; i<5; i++)
	{
	 tabID = "tab_"+i;
		if(tabNum == i)
		{
    		document.getElementById(tabID).style.display = "";
    		document.getElementById("tab"+tabNum).className = "white_tab";
    		document.getElementById("l"+tabNum).src = whiteLeft;//left corner
    		document.getElementById("r"+tabNum).src = whiteRight;//right corner
		}
		else
		{
			document.getElementById(tabID).style.display = "none";
			document.getElementById("tab"+i).className = "blue_tab";
      document.getElementById("l"+i).src = blueLeft;//left corner
    	document.getElementById("r"+i).src = blueRight;//right corner		
		}
	
	}
}

//function that switches quotes bar tabs & content
function switch_quotes_bar_tab(num) {
	$('#quotes_bar_layer'+num).siblings().css({'display':'none'});
	$('#quotes_bar_layer'+num).css({'display':''});
	document.getElementById('quotes_bar_tabs_left').className = 'quotes_bar_' + num;
	document.getElementById('quotes_bar_tabs_right').className = 'quotes_bar_rtl_' + num;
}

function changeTabNew(prefix,tabNum)
{ 
  var tabID;
	for(var i=1; i<=3; i++)
	{
	 tabID = prefix+"_tab_"+i;
		if(tabNum == i)
		{
    		if (i>1)
    		{	var prev;
    		prev=i-1;
    			document.getElementById(prefix+'_seperator_'+prev).style.display = "none";	
    		}
    			
    		document.getElementById(tabID).className = "profile_on_tab";
    		document.getElementById(prefix+'_tab_data_'+i).style.display = "";	
		}
		else
		{	
			document.getElementById(tabID).className = "profile_off_tab";
			document.getElementById(prefix+'_tab_data_'+i).style.display = "none";	
		}
	
	}
}

function changeTabFreeBee(tabNum)
{	
  var tabID;
	for(var i=1; i<=3; i++)
	{
	 tabID = "freebee_tab_"+i;
		if(tabNum == i)
		{
    		if (i>1)
    		{	var prev;
    			prev=i-1;
    			document.getElementById('freebee_seperator_'+prev).style.display = "none";	
    		}
    			
    		document.getElementById(tabID).className = "freebee_on_tab";
    		document.getElementById('freebee_data_'+i).style.display = "";	
		}
		else
		{	
			document.getElementById(tabID).className = "freebee_off_tab";
			document.getElementById('freebee_data_'+i).style.display = "none";	
			document.getElementById('freebee_seperator_'+i).style.display = "";	
		}
	
	}
}


/* Modified to support Opera */
function bookmarksite(title,url){
if (window.sidebar) // firefox
	window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
	var elem = document.createElement('a');
	elem.setAttribute('href',url);
	elem.setAttribute('title',title);
	elem.setAttribute('rel','sidebar');
	elem.click();
} 
else if(document.all)// ie
	window.external.AddFavorite(url, title);
}


function analysis_print_Popup(type,myID) {
	if(type!='analysis' && type!='education') {
                window.open('/'+type+'/analysis_print.php?contentID='+myID,"Window2",
                "menubar=no,width=830,height=640,toolbar=no, scrollbars=1");
	}
	else if(type == 'news') {
				window.open('/news/news_print.php?newsID='+myID,"Window2",
                "menubar=no,width=830,height=640,toolbar=no, scrollbars=1");
	}else {
		window.open('/analysis/analysis_print.php?contentID='+myID,"Window2",
        "menubar=no,width=830,height=640,toolbar=no, scrollbars=1");
	}
}
var tgs = new Array( 'div','span','td','tr');

var szs = new Array('small','medium','large');
var startSz = 0;                
function ts( trgt,inc ) {
	if (!document.getElementById) return
	var d = document,cEl = null,sz = startSz,i,j,cTags;
	
	sz += inc;
	if ( sz < 1 ) sz = 2;
	if ( sz > 2 ) sz = 0;
	startSz = sz;
		
	if ( !( cEl = d.getElementById( trgt ) ) ) cEl = d.getElementsByTagName( trgt )[ 0 ];

	cEl.className = szs[ sz ];

	for ( i = 0 ; i < tgs.length ; i++ ) {
		cTags = cEl.getElementsByTagName( tgs[ i ] );
		for ( j = 0 ; j < cTags.length ; j++ ) cTags[ j ].className = szs[ sz ];
	}
}                   

function strpos( haystack, needle, offset){
    // http://kevin.vanzonneveld.net
    // +     original by: Martijn Wieringa
    // *         example 1: substr('abcdef', 0, -1);
    // *         returns 1: 'abcde'	
	var i = haystack.indexOf( needle, offset ); // returns -1
    return i >= 0 ? true : false;
}

function substr( f_string, f_start, f_length ) {
    // http://kevin.vanzonneveld.net
    // +     original by: Martijn Wieringa
    // *         example 1: substr('abcdef', 0, -1);
    // *         returns 1: 'abcde'
 
    if(f_start < 0) {
        f_start += f_string.length;
    }
 
    if(f_length == undefined) {
        f_length = f_string.length;
    } else if(f_length < 0){
        f_length += f_string.length;
    } else {
        f_length += f_start;
    }
 
    if(f_length < f_start) {
        f_length = f_start;
    }
 
    return f_string.substring(f_start, f_length);
}

function openAddReviewDiv(div,gotolocation)
{
  	document.getElementById(div).style.display='block';
	location.href=gotolocation;

}

function checkUncheckAll(theElement) 
{
var theForm = theElement.form, z = 0;
	for(z=0; z<theForm.length;z++)
	{
	      if(theForm[z].type == 'checkbox' && theForm[z].name != 'checkall')
	      {
		  	theForm[z].checked = theElement.checked;
	      }
	}
}

//COOL DETECT BROWSER FUNCTION
var BrowserDetect = {
	init: function () {
		this.browser = this.searchString(this.dataBrowser) || "An unknown browser";
		this.version = this.searchVersion(navigator.userAgent)
			|| this.searchVersion(navigator.appVersion)
			|| "an unknown version";
		this.OS = this.searchString(this.dataOS) || "an unknown OS";
	},
	searchString: function (data) {
		for (var i=0;i<data.length;i++)	{
			var dataString = data[i].string;
			var dataProp = data[i].prop;
			this.versionSearchString = data[i].versionSearch || data[i].identity;
			if (dataString) {
				if (dataString.indexOf(data[i].subString) != -1)
					return data[i].identity;
			}
			else if (dataProp)
				return data[i].identity;
		}
	},
	searchVersion: function (dataString) {
		var index = dataString.indexOf(this.versionSearchString);
		if (index == -1) return;
		return parseFloat(dataString.substring(index+this.versionSearchString.length+1));
	},
	dataBrowser: [
		{ 	string: navigator.userAgent,
			subString: "OmniWeb",
			versionSearch: "OmniWeb/",
			identity: "OmniWeb"
		},
		{
			string: navigator.vendor,
			subString: "Apple",
			identity: "Safari"
		},
		{
			prop: window.opera,
			identity: "Opera"
		},
		{
			string: navigator.vendor,
			subString: "iCab",
			identity: "iCab"
		},
		{
			string: navigator.vendor,
			subString: "KDE",
			identity: "Konqueror"
		},
		{
			string: navigator.userAgent,
			subString: "Firefox",
			identity: "Firefox"
		},
		{
			string: navigator.vendor,
			subString: "Camino",
			identity: "Camino"
		},
		{		// for newer Netscapes (6+)
			string: navigator.userAgent,
			subString: "Netscape",
			identity: "Netscape"
		},
		{
			string: navigator.userAgent,
			subString: "MSIE",
			identity: "Explorer",
			versionSearch: "MSIE"
		},
		{
			string: navigator.userAgent,
			subString: "Gecko",
			identity: "Mozilla",
			versionSearch: "rv"
		},
		{ 		// for older Netscapes (4-)
			string: navigator.userAgent,
			subString: "Mozilla",
			identity: "Netscape",
			versionSearch: "Mozilla"
		}
	],
	dataOS : [
		{
			string: navigator.platform,
			subString: "Win",
			identity: "Windows"
		},
		{
			string: navigator.platform,
			subString: "Mac",
			identity: "Mac"
		},
		{
			string: navigator.platform,
			subString: "Linux",
			identity: "Linux"
		}
	]

};
BrowserDetect.init();
//COOL DETECT BROWSER FUNCTION END



function changeIndexfeaturedTabNew(prefix_tab,prefix_data,tabNum,last_tab_num)
{	
  var tabID;
	for(var i=1; i<=20; i++)
	{
	 	 tab_div = prefix_tab+i;
	 	 data_div = prefix_data+i;
	 	 last_tab = prefix_tab+last_tab_num;
		 if(document.getElementById(tab_div) && document.getElementById(data_div))
		 {
		 	//checking if tab is last one, so save it in var, to save it's classname.
			if(tabNum == i)
			{	    	
	    		document.getElementById(tab_div).className = "selected";
	    		document.getElementById(data_div).style.display = "";	
			}
			else
			{	
				if(tab_div==last_tab)
				document.getElementById(tab_div).className = "last";
				else
				document.getElementById(tab_div).className = "";
				document.getElementById(data_div).style.display = "none";	
			}
		}
	}
}

function getElementsByStyleClass (className) {
  var all = document.all ? document.all :
    document.getElementsByTagName('*');
  var elements = new Array();
  for (var e = 0; e < all.length; e++)
    if (all[e].className == className)
      elements[elements.length] = all[e];
  return elements;
}


function erase_input_onclick (element){
if(element.firstTime){return}
element.firstTime=true
element.value=""
}

function urlencode(str) {
	return escape(str).replace('+', '%2B').replace('%20', '+').replace('*', '%2A').replace('/', '%2F').replace('@', '%40');
}

function validateEmail(email)
{
  var filter=/^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
  if (filter.test(email))
    retVal=1;
  else
    retVal=0;
	return retVal;
}

//function to know which radio button was checked
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

//check if value is numeric
function IsNumeric(strString) {
	var strValidChars = "0123456789.";
	var strChar;
	var blnResult = true;
	
	if (strString.length == 0) return false;
	
	//check if strString consists of valid characters listed above
	for (i = 0; i < strString.length && blnResult == true; i++) {
		strChar = strString.charAt(i);
		if (strValidChars.indexOf(strChar) == -1) {
			blnResult = false;
		}
	}
	return blnResult;
}

function error_open_popup(url,type_dir)
{
	childWin=open(""+url+"&usr_type="+type_dir,"","width=650,height=450,resizable=no,alwaysRaised=no,screenX=0,screenY=0,dependent=no,scrollbars=0");
}

function analysis_toggle_div(direction, no_of_divs, new_link) {
	var current_div = parseInt($('#analysis_active_div_id').val());
	var new_div;
	
	if(direction == 'next') {
		if(current_div == no_of_divs) {
			new_div = 1;
		} else {
			new_div = current_div + 1;
		}
	} else {
		if(current_div == 1) {
			new_div = no_of_divs;
		} else {
			new_div = current_div - 1;
		}
	}
	$('#analysis_div_'+current_div).css('display','none');
	$('#analysis_div_'+new_div).css('display','block');
	$('#analysis_active_div_id').attr('value',new_div);
	
	$('#hp_more_link').attr('href', $('#title_link_'+new_div).attr('href'));
}

function webinar_box_toggle_div(direction,num_of_items) {

	item_number = $('#webinar_box_current_div').val();
	number_to_check = num_of_items - 1;
	
	if(direction=='next') {
		if(item_number < number_to_check) {
			item_number++;
		} else {
			item_number=0;
		}
	} else { // previous
		if(item_number > 0) {
			item_number--;
		} else {
			item_number=number_to_check;
		}
	}
	$('#webinar_box_current_div').val(item_number);
	
	$.get("/common/ajax_func.php",{ action:'get_webinar_box_item', item_number: item_number } ,function(data) {
		if(data!='') {
  			$('#webinar-box-item').html(data);
		}
   });
}

//////////Quotes Search ////////////////////
var count_li_next = 2;
var count_li_prev = 0;
var count_li_selected = 0;
var count_new_li = 0;
var search_text_assigned = false;
var search_list_find = false;

function ReplaceAll(Source,stringToFind,stringToReplace){

  var temp = Source;
  var index = temp.indexOf(stringToFind);
  while(index != -1){
	  temp = temp.replace(stringToFind,stringToReplace);
	  index = temp.indexOf(stringToFind);
  }
  return temp;
}

var searchBox = '';
var searchBoxTop;
var searchBoxLeft;
var pairId = '';

function update_auto_complete(element, evt, parameter) {
	if (!parameter) parameter = '';
	if((evt.keyCode>=48 && evt.keyCode<=90) || (evt.keyCode>=96 && evt.keyCode<=111) || evt.keyCode==38 || evt.keyCode==40 || evt.keyCode==8 || evt.keyCode==46) {
		count_li_next = 2;
		count_li_prev = 0;
		count_li_selected = 0;
		count_new_li = 0;
		
		if($(element).val().length>=1) {
			if(evt.keyCode == 40 || evt.keyCode == 38) {
				if($('.li_search_list').length>0) {
					search_text_assigned = true;
					$('.li_search_list').each(function() {
						if($(this).is('.highlight') && count_li_selected==0) {
							count_li_selected=1;
							$(this).removeClass('highlight');
							if(evt.keyCode == 40) {
								$('#search_li_'+count_li_next).addClass('highlight');
								count_new_li = count_li_next;
							} else {
								if(count_li_prev > 0) {
									$('#search_li_'+count_li_prev).addClass('highlight');
									count_new_li = count_li_prev;
								} else {
									$('.search_inner_container ul li:last').addClass('highlight');
									count_new_li = $('.li_search_list').length;
								}
							}
						}
						count_li_next++;
						count_li_prev++;
					});
					if(!$('#search_li_'+count_new_li+' .name').length) {
						count_li_selected=0;
						if($('.search_inner_container ul li:first .name').length) {
							var str = ReplaceAll($('.search_inner_container ul li:first .symbol').html(), '<b>', '');
							str = ReplaceAll(str, '</b>', '');
							str = ReplaceAll(str, '<B>', '');
							str = ReplaceAll(str, '</B>', '');
							//$('#searchText').val( str );
							$('#searchText' + searchBox).val( str );
						}
					} else {
						var str = ReplaceAll($('#search_li_'+count_new_li+' .symbol').html(), '<b>', '');
							str = ReplaceAll(str, '</b>', '');
							str = ReplaceAll(str, '<B>', '');
							str = ReplaceAll(str, '</B>', '');
							//$('#searchText').val( str );
							$('#searchText' + searchBox).val( str );
					}
					if(count_li_selected == 0) {
						$('.search_inner_container ul li:first').addClass('highlight');
						count_li_selected = 1;
						count_new_li = count_li_selected;
					}
					//$('#quotes_search_text').val( $('#search_li_'+count_new_li+' .symbol').html() );
					if (searchBox == '_inside')
						$('#insideSearchForm').attr('action',$('#search_li_'+count_new_li+' .link').html());
					else if (searchBox.substr(0, 10) == '_portfolio')
						pairId = $('#search_li_' + count_new_li + ' .symbol').attr('pairid');
					else if (searchBox == '_economicCalendar') //Gil
						pairId = $('#search_li_'+count_new_li+' .link').html();
					else
						$('#combineSearchForm').attr('action',$('#search_li_'+count_new_li+' .link').html());
				}
			} else {
				//search_text_assigned = false;				
				if(window.SearchStartTimerIsOn==1) {
					clearTimeout(window.SearchStartTimer);
				}
		  		window.AllowAutoCompleteFlag = 0;
		  		window.SearchStartTimer = setTimeout('AllowAutoComplete()', 170); 
		  		window.SearchStartTimerIsOn = 1;
		  		setTimeout(function() { CheckAutoComplete($(element).val(), parameter); }, 170);
			}
		} else {
			//$('#search_list_container').css('display','none');
			//$('#search_list_container').html('&nbsp;');
			if (searchBox.substr(0, 10) == '_portfolio')
				$('#search_list_container_portfolio').html('&nbsp;');
			else
				$('#search_list_container' + searchBox).html('&nbsp;');
		}
	}
}

function AllowAutoComplete() {
	window.AllowAutoCompleteFlag = 1;
}

function CheckAutoComplete(search_text, parameter) {
	if(window.AllowAutoCompleteFlag==1) {
		ExecuteAutoComplete(search_text, parameter);
	}
}

function ExecuteAutoComplete(search_text, parameter) {
	
	$.get("/common/search/search_ajax.php",{ action:'get_auto_complete', search_text: search_text, parameter: parameter } ,function(data) {
		if(data!='') {
  			//$('#search_list_container').html(data);
  			//$('#search_list_container').css('display','block');
			if (searchBox.substr(0, 10) == '_portfolio')
			{
				$('#div_search_list_container_portfolio').css('left', searchBoxLeft + 1);
				$('#div_search_list_container_portfolio').css('top', searchBoxTop + 18);
				$('#search_list_container_portfolio').html(data);
			}
			else
				$('#search_list_container' + searchBox).html(data);
  			search_text_assigned = false;
  			search_list_find = true;
		} else {
			//$('#search_list_container').css('display','none');
			$('.li_search_list').html('');
			//$('#search_list_container').html('&nbsp;');
			if (searchBox.substr(0, 10) == '_portfolio')
				$('#search_list_container_portfolio').html('&nbsp;');
			else
				$('#search_list_container' + searchBox).html('&nbsp;');
			search_list_find = false;
		}
   });
}

function add_search_events() { 
	
	$('.ul_search_list li').each(function() {
		// Add onClick, blur, onmouseover, onmouseout  to each li
		$(this).click(function() {
			var str = ReplaceAll($(this).find('.symbol').html(), '<b>', '');
			str = ReplaceAll(str, '</b>', '');
			str = ReplaceAll(str, '<B>', '');
			str = ReplaceAll(str, '</B>', '');
			//$('#searchText').val( str );
			$('#searchText' + searchBox).val( str );
			//$('#combineSearchForm').submit();
			if (searchBox == '_inside')
				$('#insideSearchForm').submit();
			else if (searchBox.substr(0, 10) == '_portfolio')
				addToPortfolio(pairId, searchBox.substr(11));
			else if (searchBox == '_economicCalendar') //Gil
				searchEvent();
			else
				$('#combineSearchForm').submit();
		}).blur(function() {
			$(this).removeClass('highlight');
		}).mouseover(function() {
			var str = ReplaceAll($(this).find('.symbol').html(), '<b>', '');
			str = ReplaceAll(str, '</b>', '');
			str = ReplaceAll(str, '<B>', '');
			str = ReplaceAll(str, '</B>', '');
			//$('#searchText').val( str );
			$('#searchText' + searchBox).val( str );
			//$('#combineSearchForm').attr('action',$('#'+$(this).attr('id')+' .link').html());
			if (searchBox == '_inside')
				$('#insideSearchForm').attr('action',$('#'+$(this).attr('id')+' .link').html());
			else if (searchBox.substr(0, 10) == '_portfolio')
				pairId = $('#'+$(this).attr('id')+' .symbol').attr('pairid');
			else if (searchBox == '_economicCalendar') //Gil
				pairId = $('#' + $(this).attr('id') + ' .link').html();
			else
				$('#combineSearchForm').attr('action',$('#'+$(this).attr('id')+' .link').html());
			$(this).addClass('highlight');
			search_text_assigned = true;
		}).mouseout(function() {
			$(this).removeClass('highlight');
		});
		
	});

	$('#combineSearchForm').submit(function() {
		if(search_text_assigned!=true && ($('.ul_search_list').length>0) ) {
			$('#combineSearchForm').attr('action',$('.ul_search_list li:first .link').html());
		}
	});
	$('#insideSearchForm').submit(function() {
		if(search_text_assigned!=true && ($('.ul_search_list').length>0) ) {
			$('#insideSearchForm').attr('action',$('.ul_search_list li:first .link').html());
		}
	});
	$('#portfolioSearchForm_' + searchBox.substr(11)).submit(function() {
		addToPortfolio(pairId, searchBox.substr(11));
		return false;
	});
}

function validate_quotes_search_form(quotes_form) {
	if((($('#combineSearchForm').val().length>=1) && ($('.ul_search_list').length>0)) || search_list_find == true) {
		return true;
	} else {
		return false;
	}
}
////////// End Quotes Search ////////////////
function get_markets_drop_down(ele_btn) {
	show_markets_drop_down(ele_btn);
	var waiting_container = '<div class="markets_list_border" style="height:100px;"><img src="/images/ajax-loader.gif" style="margin:30px 70px 0px 70px;" /></div>';

	$('#markets_list_container').html(waiting_container);
	$.get("/common/ajax_func.php",{ action:'get_markets_menu'} ,function(data) {
		if(data!='') {
			$('#markets_list_container').html('&nbsp;');
  			$('#markets_list_container').html(data);
		} else {
			$('#markets_list_container').css('display','none');
			$('.li_search_list').html('');
			$('#markets_list_container').html('&nbsp;');
		}
    });
}
function show_markets_drop_down(ele_btn)
{
	if (time_out_off)
	{
		clearTimeout(t);
		time_out_off = false;
	}
	$('#col_separater').css('display','none');	
	$(ele_btn).addClass('markets_dropdown_btn_pressed');
	$('#markets_list_container').css('display','block');
	sub_menu = true;
	time_out_on = false;
	time_out_off = false;
}
function hide_markets_drop_down() {
	$('#markets_dropdown_btn').removeClass('markets_dropdown_btn_pressed');
	$('#col_separater').css('display','block');
	$('#markets_list_container').hide();
	sub_menu = false;
	time_out_on = false;
	time_out_off = false;
}
function bind_markets_drop_down_events() {
	$('#markets_list_container').hover(
			function(){
				//show_markets_drop_down($('#markets_dropdown_btn'));
				showSubMenu('markets_menu');
			},
			//function(){hide_markets_drop_down()}
			function(){
				$('#markets_dropdown_btn').removeClass('markets_dropdown_btn_pressed');
				$('#col_separater').css('display','block');
				hideSubMenu('markets_menu')
			}
	);
	
	$('#markets_dropdown_btn').hover(  
			function(){$(this).addClass('markets_dropdown_btn_pressed'); $('#col_separater').hide();}, 
			function(){
					$('#markets_dropdown_btn').removeClass('markets_dropdown_btn_pressed');
					$('#col_separater').css('display','block');
					//hide_markets_drop_down();
					hideSubMenu('markets_menu')
			}
	);
}
/*################################################################
########################  DROPDOWNS  #############################
################################################################*/
	var disappeardelay=0  //menu disappear speed onMouseout (in miliseconds)
	var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
	var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)
	
	/////No further editting needed
	
	var ie5=document.all
	var ns6=document.getElementById&&!document.all
	
	function getposOffset(what, offsettype){
	var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
	var parentEl=what.offsetParent;
	while (parentEl!=null){
	totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
	parentEl=parentEl.offsetParent;
	}
	return totaloffset;
	}
	
	function showhide(obj, e, visible, hidden){
	if (ie5||ns6)
	dropmenuobj.style.left=dropmenuobj.style.top=-500
	if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
	obj.visibility=visible
	else if (e.type=="click")
	obj.visibility=hidden
	}
	
	function iecompattest(){
	return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
	}
	
	function clearbrowseredge(obj, whichedge){
	var edgeoffset=0
	if (whichedge=="rightedge"){
	var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
	dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
	if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
	edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
	}
	else{
	var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
	var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
	dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
	if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
	edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
	if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
	edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
	}
	}
	return edgeoffset
	}
	
	function dropdownmenu(obj, e, dropmenuID){
	if (window.event) event.cancelBubble=true
	else if (e.stopPropagation) e.stopPropagation()
	if (typeof dropmenuobj!="undefined") //hide previous menu
	dropmenuobj.style.visibility="hidden"
	clearhidemenu()
	if (ie5||ns6){
	//obj.onmouseout=delayhidemenu
	dropmenuobj=document.getElementById(dropmenuID)
	if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
	dropmenuobj.onmouseover=clearhidemenu
	dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
	showhide(dropmenuobj.style, e, "visible", "hidden")
	dropmenuobj.x=getposOffset(obj, "left")
	dropmenuobj.y=getposOffset(obj, "top")
	dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
	dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
	}
	return clickreturnvalue()
	}
	
	function clickreturnvalue(){
	if ((ie5||ns6) && !enableanchorlink) return false
	else return true
	}
	
	function contains_ns6(a, b) {
	while (b.parentNode)
	if ((b = b.parentNode) == a)
	return true;
	return false;
	}
	
	function dynamichide(e){
	if (ie5&&!dropmenuobj.contains(e.toElement))
	delayhidemenu()
	else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
	delayhidemenu()
	}
	
	function delayhidemenu(){
	delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
	}
	
	function clearhidemenu(){
	if (typeof delayhide!="undefined")
	clearTimeout(delayhide)
	}
/*################################################################
########################  DROPDOWNS  #############################
################################################################*/
	
/*################################################################
########################  New Header  #############################
################################################################*/

	var oldDropDownId = null;
	var dropDownId = null;
	function showQuotesBar()
	{
		//var arrDivId = document.getElementsByName('mainMenuDropDown');
		var x = 33;
		/*while (arrDivId[x])
		{
			if (x != dropDownId)
				hideQuotesBar(arrDivId[x].id);
			x++;
		}*/
		while (document.getElementById('mainMenuDropDown_' + x + '_container'))
		{
			if (x != dropDownId)
				hideQuotesBar(x);
			x++;
		}
		if (time_out_off)
		{
			clearTimeout(t);
			time_out_off = false;
		}
		
		document.getElementById('mainMenuDropDown_' + dropDownId + '_container').style.visibility = 'visible';
		document.getElementById('mainMenuDropDown_' + dropDownId + '_container').style.display = 'block';
		document.getElementById('mainMenuDropDown_' + dropDownId + '_divid').style.visibility = 'visible';
		sub_menu = true;
		time_out_on = false;
		time_out_off = false;
	}

	function hideQuotesBar(dropDown)
	{
		//return;
		if (dropDown)
		{
			document.getElementById('mainMenuDropDown_' + dropDown + '_container').style.visibility = 'hidden';
			document.getElementById('mainMenuDropDown_' + dropDown + '_container').style.display = 'none';
			document.getElementById('mainMenuDropDown_' + dropDown + '_divid').style.visibility = 'hidden';
		}
		else
		{
			document.getElementById('mainMenuDropDown_' + dropDownId + '_container').style.visibility = 'hidden';
			document.getElementById('mainMenuDropDown_' + dropDownId + '_container').style.display = 'none';
			document.getElementById('mainMenuDropDown_' + dropDownId + '_divid').style.visibility = 'hidden';

			sub_menu = false;
			time_out_on = false;
			time_out_off = false;
		}
	}

	function showMyAccount()
	{
		if (time_out_off)
		{
			clearTimeout(t);
			time_out_off = false;
		}
		document.getElementById('my_account').className = 'selected my_account';
		document.getElementById('my_account_list_div').style.display = 'block';
		sub_menu = true;
		time_out_on = false;
		time_out_off = false;
	}

	function hideMyAccount()
	{
		//return;
		document.getElementById('my_account').className = 'no_selected my_account';
		document.getElementById('my_account_list_div').style.display = 'none';
		sub_menu = false;
		time_out_on = false;
		time_out_off = false;
	}
	
	function markLine(id, dirr)
	{
		document.getElementById(id).style.background = '#DAE5F0';
		if (dirr == 'rtl')
			document.getElementById('a_' + id).style.background = 'url("/images/arrows-rtl.png") right -131px no-repeat #DAE5F0';
		else
			document.getElementById('a_' + id).style.background = 'url("/images/arrows.png") 0px -131px no-repeat #DAE5F0';
	}
	
	function unMarkLine(id, dirr)
	{
		document.getElementById(id).style.background = '#fff';
		if (dirr == 'rtl')
			document.getElementById('a_' + id).style.background = 'url("/images/arrows-rtl.png") right -131px no-repeat #fff';
		else
			document.getElementById('a_' + id).style.background = 'url("/images/arrows.png") 0px -131px no-repeat #fff';
	}

	var time_out_on = false;
	var time_out_off = false;
	var sub_menu = false;
	var t;
	function showSubMenu(what)
	{ 
		if (!time_out_on)
		{
			if (what == 'my_account')
				t=setTimeout("showMyAccount()", 110);
			else if (what == 'markets_menu')
			{
				t=setTimeout("show_markets_drop_down($('#markets_dropdown_btn'))", 110);
			}
			else
			{
				oldDropDownId = dropDownId; 
				dropDownId = what;
				t=setTimeout("showQuotesBar()", 110);
			}
			time_out_on = true;
			time_out_off = false;
		}
	}

	function hideSubMenu(what)
	{
		if (sub_menu)
		{
			if (what == 'my_account')
				t=setTimeout("hideMyAccount()", 110);
			else if (what == 'markets_menu')
				t=setTimeout("hide_markets_drop_down()", 110);
			else
				t=setTimeout("hideQuotesBar()", 110);
		}
		else
			clearTimeout(t);
		time_out_on = false;
		time_out_off = true;
	}
	
	/*################################################################
	########################  Big PopUp  #############################
	################################################################*/

	// Open the lightbox
	function openLightBox(div_id, div_width, div_height, fadin, other)
	{
		var box = document.getElementById(div_id);

		// Enable the dark layer on the al page
		$('#mainLightBoxFilter').css('height',$(document).height());
		$('#mainLightBoxFilter').css('display','block');

		var leftpos = ($(document).width() - div_width) / 2;
		var toppos = ($(window).height() - div_height) / 2;
		$(box).css('left',leftpos);
		$(box).css('top',toppos);
		if(fadin){
			gradient(div_id, 0);
			fadein(div_id);
		}else{ 	
			$('#' + div_id).css('display','block');
		}
	}

	// Close the lightbox
	function closeLightBox(div_id, fadout, other)
	{
		$('#mainLightBoxFilter').css('display','none');
		$('#' + div_id).css('display','none');
	}

	function test(event)
	{
        if(event.keyCode == 27)
        	alert("Esc pressed");
	}
	/*################################################################
	########################  Big PopUp  #############################
	################################################################*/
	
function sendDataToSWF(movieName, dataObj) {
 	//check that movieName is not empty and that dataObj is object
     	if(movieName!='' && typeof dataObj=='object') {
     		
	     	var movieObj; //prepare Variable for SWF object
	     	
	     	//assign SWF element to object variable "movieObj"
				if (navigator.appName.indexOf("Microsoft") != -1) {
					movieObj = window[movieName];
				} else {
					movieObj = document[movieName];
				}
				
			//Exit if SWF element was not found
				if(!movieObj) return false;
				
			//Call function inside SWF and pass dataObj
 				movieObj.sendDataToActionScript(dataObj);
				
     	} else {
     		return false;
     	}
}
//Quotes Refresh //////////////////////////
/*function quote_rates_refresh(pair_ID,defaultDomain,show_bid_ask) 
{
	$.ajax({
		url: "http://"+defaultDomain+"/common/ajax_quotes.php",
		type: "POST",
		data: "action=refresh_pair_data&pair="+pair_ID,
		dataType: ($.browser.msie) ? "text" : "text",
		success: function(data){
			window.trycount = 0;
			
			var JSONobject = JSON.parse(data);

			if(JSONobject.authorized && JSONobject.authorized=='true') {
				
			//get last value of "Last"
			if(document.getElementById('last_last')) var last_value = document.getElementById('last_last').innerHTML;
			else var last_value = 0;
			
			//get last value of "Change" in percent
			//CHANGE_VALUE - percent
			if(document.getElementById('last_change')) {
				var change_value = document.getElementById('last_change').innerHTML;
				change_value = change_value.substr(-1);
			} else var change_value = '0.00';

			//get last value of "Change"
			//CHANGE_VALUE - normal
			if(document.getElementById('last_change_normal')) {
				var change_value_normal = document.getElementById('last_change_normal').innerHTML;
				change_value_normal = change_value_normal.substr(-1);
			} else var change_value_normal = '0.00';
			
			if(show_bid_ask==true) {
				var bid = JSONobject.bid;
				var ask = JSONobject.ask;
			}
			var open 				= JSONobject.open;
			var last 				= JSONobject.last;
			var low  				= JSONobject.low;
			var high 				= JSONobject.high;
			var change 				= JSONobject.change;
			var change_percent 		= JSONobject.change_percent;
			var last_close_value 	= JSONobject.last_close_value;
			var last_step_direction = JSONobject.last_step_direction;
			var datetime 			= JSONobject.datetime;
			var timestamp			= JSONobject.timestamp;
			var clockIcon			= JSONobject.clockIcon;
			var exchangeStatus		= JSONobject.exchangeStatus;

			if(document.getElementById('equity_turnover_volume')) {
				var turnover_volume			= JSONobject.turnover_volume;
			}
			
			if(last_step_direction=='Down') {
				var color = 'red';
				var arrow = 'actual_arrow_down';
			} else if(last_step_direction=='Up') {
				var color = 'green';
				var arrow = 'actual_arrow_up';
			} else {
				if(document.getElementById('last_last')) var color = document.getElementById('last_last').style.color;
				else var color = 'green';
				if(document.getElementById('actual_arrow_image')) {
					var arrow = document.getElementById('actual_arrow_image').className;
				} else {
					var arrow = 'actual_arrow_up';
				}
			}

			//UPDATE CHART
			//Build Object that will be PUSHED to SWF			
				var dataObj= {
		     				 last: last,
			     			 change: change,
			     			 change_percent: change_percent,
			     			 high: high,
			     			 low: low,
			     			 last_step_direction: last_step_direction,
			     			 datetime: timestamp
			     		   };
			     		  
			//Push data to SWF
			     sendDataToSWF('LiveChart', dataObj);
			//UPDATE CHART
			
			var change_prefix = '';
			//change color of "CHange" accordingly to value of "change_value"
			if(change_percent==change_value) {
				var change_color = '#000';
			} else {
				//alert(change);
				if(change_percent<0) {
					var change_color = 'red';
					//change_prefix = '-';
				} else if(change_percent>0) {
					var change_color = 'green';
					change_prefix = '+';
				}
			}
			
			if($('#currency_last').html()=='') 
			{
				if(last_step_direction == 'Up') 
				{
					color = 'green';
					arrow = 'actual_arrow_up';
				} else if(last_step_direction == 'Down') 
				{
					color = 'red';
					arrow = 'actual_arrow_down';
				}
			}
			
			if ( last == '' || change == '' || change_percent == '' || high == '' || low == '' || last_close_value == '' || open == '' || ((bid == '' || ask == '') && (show_bid_ask==true)) || datetime == '' )
			{
				// do nothing
			}
			else
			{
				if(document.getElementById('currency_last')) $('#currency_last').html('<span id="last_last" class="arial_24" style="font-weight: bold;">'+last+'</span>');
				if(document.getElementById('last_change_normal')) $('#last_change_normal').html('<span style="color:'+change_color+';" id="last_change_normal">'+change_prefix+change+'</span>');
				if(document.getElementById('last_change')) $('#last_change').html('<span style="color:'+change_color+';" id="last_change">('+change_prefix+change_percent+'%)</span>');
				if(document.getElementById('currency_high')) $('#currency_high').html(high);
				if(document.getElementById('currency_low')) $('#currency_low').html(low);
				if(document.getElementById('currency_prev')) $('#currency_prev').html(last_close_value);
				if(document.getElementById('currency_open')) $('#currency_open').html(open);
				if(show_bid_ask==true) {
					if(document.getElementById('currency_bid')) $('#currency_bid').html(bid);
					if(document.getElementById('currency_ask')) $('#currency_ask').html(ask);
				}
				$('#currency_time').html(datetime);
				document.getElementById('clockIcon').className = "generalIcons " + clockIcon;
				if(document.getElementById('actual_arrow_image')) document.getElementById('actual_arrow_image').className = arrow;
				$('#exchange_status').html(exchangeStatus);
				
				if(document.getElementById('equity_turnover_volume')) $('#equity_turnover_volume').html(turnover_volume);
			}
		}
		},
		error:
			function(XMLHttpRequest, textStatus, errorThrown)
			{
				if ( window.trycount < 2 ) {
					window.trycount++;
					quote_rates_refresh(pair_ID,defaultDomain,show_bid_ask);
				} else if ( trycount == 2) {
					
				}
			}
		
	});
	
}*/
// End Quotes Refresh //////////////////////////

function ajaxSetSessionAndContinuePortfolio(redirect_to, uri, pair_id, submit)
{
	$.get('/common/ajax_func.php', {action: 'set_session_portolio', uri: uri, pair_id: pair_id, submit: submit}, function(data) {
		window.location = redirect_to;
	});
}

function gen_sideblock_user_quotes(sid) {
	$.get('/common/user_quotes_block/user_quotes_sblock_data.php', {action:"print_page",sid:sid}, function(data) {
		$('#recent-box-text').html(data);
	});
}

function clear_sideblock_user_quotes() {
	$.get('/common/user_quotes_block/user_quotes_sblock_data.php', {action:"clear_cache"}, function(data) {
		$('#recent-box-text').html(data);
	});
}

function OnClickRecentQuotes(Element) {
	var newTabID = $(Element).attr("id");
	$(Element).addClass('Selected').unbind("click").siblings().each(
			function()
			{
				$(this).removeClass('Selected').click(
						function()
						{
							OnClickRecentQuotes(this);
						}
				); 
			});
	switch (newTabID)
	{
		case "tab_1" :
			gen_sideblock_user_quotes($(Element).attr('sid'));
			$('#recent-box-text').css('display','block');
			$('#portfolio-box-text').css('display','none');
			break;
		case "tab_2" :
			genSideblockUserPortfolio($('#tab_2').attr('uri'),$(Element).attr('sid'));
			$('#recent-box-text').css('display','none');
			$('#portfolio-box-text').css('display','block');
			break;
	}
}

function genSideblockUserPortfolio(uri,sid) {
	$.get('/common/portfolio/portfolio.data.php', {action:"getPortfolioSideBox", uri:uri,sid:sid}, function(data) {
		$('#portfolio-box-text').html(data);
	});
}

/*     ----------- Calculation & Validation Functions for Calculators START-------------     */
function toFixed(num,decim)
{
	num *= Math.pow(10,decim); 
	num = Math.round(num);
	num /= Math.pow(10,decim); 
	return num;
}


function val_inputs(inputs)
{
	var inputsArray = inputs.split(",");
	var ret=true;
	var i=0;
	while(i < inputsArray.length)
	{
		HideError(inputsArray[i]);
		if(isNaN($(inputsArray[i]).val()) || $(inputsArray[i]).val().length == 0)
		{
			ShowError(inputsArray[i]);
			ret = false;
		}
		i++;
	}
	return ret;
}

function ShowError(box)
{
	$(box).removeClass("input_border").addClass("input_error");
}

function HideError(box)
{
	$(box).removeClass("input_error").addClass("input_border");
}

/*     ----------- Calculation & Validation Functions for Calculators END-------------     */


/*     ----------- Fibonacci calculator Javascript START -------------     */
function uptrend_submit() {

	$("#uploader img").fadeIn('fast').fadeOut();
	HideError("#uphigh");
	HideError("#uplow");
	
		var A = $("#uplow").val()*1;
		var B = $("#uphigh").val()*1;
		var C = $("#upcustom").val();
	
	if(val_inputs("#uplow,#uphigh") && B > A)
	{
		
		var pips=B-A;
		var ret1=B-(pips*0.236);
		var ret2=B-(pips*0.382);
		var ret3=B-(pips*0.5);
		var ret4=B-(pips*0.618);
		var ret5=B-(pips*0.764);
		var ret6=B-(pips*1);
		var ret7=B-(pips*1.382);

		var ext1=B+(pips*2.618);
		var ext2=B+(pips*2);
		var ext3=B+(pips*1.618);
		var ext4=B+(pips*1.382);
		var ext5=B+(pips*1);
		var ext6=B+(pips*0.618);

		if(C.length > 0)
		{
			C = C*1;
			 ext1=C+(pips*2.618);
			 ext2=C+(pips*2);
			 ext3=C+(pips*1.618);
			 ext4=C+(pips*1.382);
			 ext5=C+(pips*1);
			 ext6=C+(pips*0.618);
		}


		$("table#upRetrace td#result1").text(toFixed(B,5));
		$("table#upRetrace td#result2").text(toFixed(ret1,5));
		$("table#upRetrace td#result3").text(toFixed(ret2,5));
		$("table#upRetrace td#result4").text(toFixed(ret3,5));
		$("table#upRetrace td#result5").text(toFixed(ret4,5));
		$("table#upRetrace td#result6").text(toFixed(ret5,5));
		$("table#upRetrace td#result7").text(toFixed(A,5));
		$("table#upRetrace td#result8").text(toFixed(ret7,5));
		
		$("table#upExten td#result1").text(toFixed(ext1,5));
		$("table#upExten td#result2").text(toFixed(ext2,5));
		$("table#upExten td#result3").text(toFixed(ext3,5));
		$("table#upExten td#result4").text(toFixed(ext4,5));
		$("table#upExten td#result5").text(toFixed(ext5,5));
		$("table#upExten td#result6").text(toFixed(ext6,5));
		
	}
	else
	{
		
		if($("#uphigh").val() < $("#uplow").val())
		{
			ShowError("#uphigh");
			ShowError("#uplow");
		}
		
	}
}


function downtrend_submit() {
	$("#downloader img").fadeIn('fast').fadeOut();
	HideError("#downhigh");
	HideError("#downlow");
		
		var A = $("#downhigh").val()*1;
		var B = $("#downlow").val()*1;
		var C = $("#downcustom").val();
		
	
	if(val_inputs("#downlow,#downhigh") && A > B)
	{	
		var pips=A-B;
		var ret1=B+(pips*0.236);
		var ret2=B+(pips*0.382);
		var ret3=B+(pips*0.5);
		var ret4=B+(pips*0.618);
		var ret5=B+(pips*0.764);
		var ret6=B+(pips*1);
		var ret7=B+(pips*1.382);

		var ext1=B-(pips*2.618);
		var ext2=B-(pips*2);
		var ext3=B-(pips*1.618);
		var ext4=B-(pips*1.382);
		var ext5=B-(pips*1);
		var ext6=B-(pips*0.618);

		if(C.length > 0)
		{
			C = C*1;
			 ext1=C-(pips*2.618);
			 ext2=C-(pips*2);
			 ext3=C-(pips*1.618);
			 ext4=C-(pips*1.382);
			 ext5=C-(pips*1);
			 ext6=C-(pips*0.618);
		}


		$("table#downRetrace td#result1").text(toFixed(ret7,5));
		$("table#downRetrace td#result2").text(toFixed(A,5));
		$("table#downRetrace td#result3").text(toFixed(ret5,5));
		$("table#downRetrace td#result4").text(toFixed(ret4,5));
		$("table#downRetrace td#result5").text(toFixed(ret3,5));
		$("table#downRetrace td#result6").text(toFixed(ret2,5));
		$("table#downRetrace td#result7").text(toFixed(ret1,5));
		$("table#downRetrace td#result8").text(toFixed(B,5));
		
		$("table#downExten td#result1").text(toFixed(ext6,5));
		$("table#downExten td#result2").text(toFixed(ext5,5));
		$("table#downExten td#result3").text(toFixed(ext4,5));
		$("table#downExten td#result4").text(toFixed(ext3,5));
		$("table#downExten td#result5").text(toFixed(ext2,5));
		$("table#downExten td#result6").text(toFixed(ext1,5));
		
	}
	else
	{		
		if($("#downhigh").val() < $("#downlow").val())
		{
			ShowError("#downhigh");
			ShowError("#downlow");
		}
		
	}
}
/*     ----------- Fibonacci calculator Javascript END -------------     */



/*     ----------- Pivot calculator Javascript Start -------------     */
function pivot_submit()
{
	$("#loader").fadeIn('fast').fadeOut();
	var high = parseFloat($("#HRate").val());
	var low = parseFloat($("#LRate").val());
	var close = parseFloat($("#CRate").val());
	var open = parseFloat($("#ORate").val());
	
	if(val_inputs("#HRate,#LRate,#CRate,#ORate") && high >= low && high >= close && high >= open && low <= close && low <=open)
	{
		
		var bpivot = (high + low + close) / 3;
		var bsup1,res1;
		bsup1 = 2 * bpivot - high;
		bres1 = 2 * bpivot - low; 
		
		$("#br3").text(toFixed(high + 2*(bpivot - low),4));
		$("#br2").text(toFixed(bpivot+(bres1-bsup1),4));
		$("#br1").text(toFixed(bres1,4));
		$("#bp").text(toFixed(bpivot,4));
		$("#bs1").text(toFixed(bsup1,4));
		$("#bs2").text(toFixed(bpivot - (bres1 - bsup1),4));
		$("#bs3").text(toFixed(low - 2*(high - bpivot),4));

		var wpivot = (high + low + (2 * close))/4;
		
		$("#wr1").text(toFixed((2*wpivot)-low,4));
		$("#wr2").text(toFixed(wpivot + high - low,4));
		$("#wp").text(toFixed(wpivot,4));
		$("#ws1").text(toFixed((2 * wpivot) - high,4));
		$("#ws2").text(toFixed((wpivot - high) + low,4));

		$("#cr1").text(toFixed(close + ((high - low) * (1.1/12)),4));
		$("#cr2").text(toFixed(close + ((high - low) * (1.1/6)),4));
		$("#cr3").text(toFixed(close + ((high - low) * (1.1/4)),4));
		$("#cr4").text(toFixed(close + ((high - low) * (1.1/2)),4));

		$("#cs1").text(toFixed(close - ((high - low) * (1.1/12)),4));
		$("#cs2").text(toFixed(close - ((high - low) * (1.1/6)),4));
		$("#cs3").text(toFixed(close - ((high - low) * (1.1/4)),4));
		$("#cs4").text(toFixed(close - ((high - low) * (1.1/2)),4));
		

		var tmpv;
		

			if (close < open)
				tmpv = (high + (low * 2) + close);
            if (close > open)
            	tmpv = ((high * 2) + low + close);
            if (close == open)
            	tmpv = (high + low + (close * 2));

            $("#demar1").text(toFixed((tmpv / 2) - low,4));
            $("#demas1").text(toFixed((tmpv / 2) - high,4));
		
	}
	else
	{		
		if(val_inputs("#HRate,#LRate,#CRate,#ORate")){
		if(high < low)
		{
			ShowError("#HRate");
			ShowError("#LRate");
		}
		if(high < close)
		{
			ShowError("#HRate");
			ShowError("#CRate");
		}
		if(high < open)
		{
			ShowError("#HRate");
			ShowError("#ORate");
		}
		if(low > close)
		{
			ShowError("#LRate");
			ShowError("#CRate");
		}
		if(low > open)
		{
			ShowError("#LRate");
			ShowError("#ORate");
		}
		}
	}
}
/*     ----------- Pivot calculator Javascript END -------------     */