function GetXmlHttpObject()
{
var xmlHttp=null;
try
  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)
  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)
    {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
  }
return xmlHttp;
}



function Shownews(cat,tab,lang)
{
xmlhttpnews = GetXmlHttpObject();
if (xmlhttpnews==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlhttpnews.onreadystatechange=function()
  {
  if (xmlhttpnews.readyState==4 && xmlhttpnews.status==200)
    {
    document.getElementById("newspanel").innerHTML=xmlhttpnews.responseText;
	active_tab_news(tab);
    }
  }
xmlhttpnews.open("GET",document.location.protocol + "//" + document.location.host  + "/trading/show_news2.php?time=" + new Date() + "&cat="+cat+"&lang=" + lang,true);
xmlhttpnews.send();

}

function ShowSummaryOnlyRep(rep, lang)
{
xmlhttpmarketsumm= GetXmlHttpObject();
if (xmlhttpmarketsumm==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlhttpmarketsumm.onreadystatechange=function()
  {
  if (xmlhttpmarketsumm.readyState==4 && xmlhttpmarketsumm.status==200)
    {
    document.getElementById("msum").innerHTML=xmlhttpmarketsumm.responseText;
	
    }
	
  }
xmlhttpmarketsumm.open("GET",document.location.protocol + "//" + document.location.host  + "/trading/show_market_summary2.php?time=" + new Date() + "&lang=" + lang,true);
xmlhttpmarketsumm.send();
if (rep == 1)
{ 
setTimeout("ShowSummaryOnlyRep("+rep +", '" + lang + "')",20000);
}
}


function ShowSummaryOnly(lang)
{
xmlhttpmarketsumm= GetXmlHttpObject();
if (xmlhttpmarketsumm==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
xmlhttpmarketsumm.onreadystatechange=function()
  {
  if (xmlhttpmarketsumm.readyState==4 && xmlhttpmarketsumm.status==200)
    {
    document.getElementById("msum").innerHTML=xmlhttpmarketsumm.responseText;
	
    }
	
  }
xmlhttpmarketsumm.open("GET",document.location.protocol + "//" + document.location.host  + "/trading/show_market_summary2.php?time=" + new Date() + "&lang=" + lang,true);
xmlhttpmarketsumm.send();
}




function ShowSummaryRep(rep, lang)
{
xmlhttpsumm = GetXmlHttpObject();
if (xmlhttpsumm==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 	
xmlhttpsumm.onreadystatechange=function()
  {
  if (xmlhttpsumm.readyState==4 && xmlhttpsumm.status==200)
    {
    document.getElementById("summarypanel").innerHTML=xmlhttpsumm.responseText;
	active_tab_summary(tab);
	}
	
  }
 
xmlhttpsumm.open("GET",document.location.protocol + "//" + document.location.host  + "/trading/show_market_info2.php?time=" + new Date() + "&tab="+ tab +"&lang=" + lang,true);
xmlhttpsumm.send();
if (rep == 1)
{
	setTimeout("ShowSummaryRep("+ rep +", '" + lang + "')",20000);
}
}


function ShowSummary(lang)
{
xmlhttpsumm = GetXmlHttpObject();
if (xmlhttpsumm==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 	
xmlhttpsumm.onreadystatechange=function()
  {
  if (xmlhttpsumm.readyState==4 && xmlhttpsumm.status==200)
    {
    document.getElementById("summarypanel").innerHTML=xmlhttpsumm.responseText;
	active_tab_summary(tab);
	}
	
  }
 
xmlhttpsumm.open("GET",document.location.protocol + "//" + document.location.host  + "/trading/show_market_info2.php?time=" + new Date() + "&tab="+ tab +"&lang=" + lang,true);
xmlhttpsumm.send();
ShowSummaryOnly(lang);
}


var old_tab = 1;
var old_tab2 = 1;

function changetab(tab1, cat1)
{
tab= tab1;
cat=cat1;
ShowSummary(website_lang);
}

function changetabRep(tab1, cat1)
{
tab= tab1;
cat=cat1;
ShowSummary(0,website_lang);
}


function active_tab_news(new_tab)
{
                if(old_tab == 1)
                {
                                
                                document.getElementById('img_1_' + old_tab).src = './includes-img/' + website_lang + '/tab_corner_top_left_disactive.gif';
                                document.getElementById('td_2_' + old_tab).style.background = 'url(./includes-img/tabs_repeat_disactive.gif)';
                                document.getElementById('td_2_' + old_tab).vAlign = "bottom";
                                document.getElementById('img_3_' + old_tab).src = './includes-img/' + website_lang + '/tabs_right_disactive.gif';
                                document.getElementById('td_color_' + website_lang).bgColor = "#6196D0";
                }
                else if(old_tab == 2)
                {
                                
                                document.getElementById('img_1_' + old_tab).src = './includes-img/' + website_lang + '/tabs_left_disactive.gif';
                                document.getElementById('td_2_' + old_tab).style.background = 'url(./includes-img/tabs_repeat_disactive.gif)';
                                document.getElementById('td_2_' + old_tab).vAlign = "bottom";
                                document.getElementById('img_3_' + old_tab).src = './includes-img/' + website_lang + '/tabs_right_disactive.gif';
                }
                else
                {
                                
                                document.getElementById('img_1_' + old_tab).src = './includes-img/' + website_lang + '/tabs_left_disactive.gif';
                                document.getElementById('td_2_' + old_tab).style.background = 'url(./includes-img/tabs_repeat_disactive.gif)';
                                document.getElementById('td_2_' + old_tab).vAlign = "bottom";
                                document.getElementById('img_3_' + old_tab).src = './includes-img/' + website_lang + '/tab_corner_top_right_disactive.gif';
                }

                if(new_tab == 1)
                {
                                
                                document.getElementById('img_1_' + new_tab).src = './includes-img/' + website_lang + '/tab_corner_top_left_active.gif';
                                document.getElementById('td_2_' + new_tab).style.background = 'url(./includes-img/tabs_repeat_active.gif)';
                                document.getElementById('td_2_' + new_tab).vAlign = "middle";
                                document.getElementById('img_3_' + new_tab).src = './includes-img/' + website_lang + '/tabs_right_active.gif';
                                document.getElementById('td_color_' + website_lang).bgColor = "#2558aa";
                }
                else if(new_tab == 2 )
                {
                                
                                document.getElementById('img_1_' + new_tab).src = './includes-img/' + website_lang + '/tabs_left_active.gif';
                                document.getElementById('td_2_' + new_tab).style.background = 'url(./includes-img/tabs_repeat_active.gif)';
                                document.getElementById('td_2_' + new_tab).vAlign = "middle";
                                document.getElementById('img_3_' + new_tab).src = './includes-img/' + website_lang + '/tabs_right_active.gif';
                }
                else
                {
                                
                                document.getElementById('img_1_' + new_tab).src = './includes-img/' + website_lang + '/tabs_left_active.gif';
                                document.getElementById('td_2_' + new_tab).style.background = 'url(./includes-img/tabs_repeat_active.gif)';
                                document.getElementById('td_2_' + new_tab).vAlign = "middle";
                                document.getElementById('img_3_' + new_tab).src = './includes-img/' + website_lang + '/tab_corner_top_right_active.gif';
                }

                document.getElementById('img_1_' + old_tab).style.cursor = 'pointer';
                document.getElementById('td_2_' + old_tab).style.cursor = 'pointer';
                document.getElementById('img_3_' + old_tab).style.cursor = 'pointer';
                document.getElementById('img_1_' + new_tab).style.cursor = 'default';
                document.getElementById('td_2_' + new_tab).style.cursor = 'default';
                document.getElementById('img_3_' + new_tab).style.cursor = 'default';

                old_tab = new_tab;
}

	
	
	
function active_tab_summary(new_tab)
{
	
	if(old_tab2 == 1)
	{
		
		document.getElementById('2_img_1_' + old_tab2).src = './includes-img/' + website_lang + '/tab_corner_top_left_disactive.gif';
		document.getElementById('2_td_2_' + old_tab2).style.background = 'url(./includes-img/tabs_repeat_disactive.gif)';
		document.getElementById('2_td_2_' + old_tab2).vAlign = "bottom";
		document.getElementById('2_img_3_' + old_tab2).src = './includes-img/' + website_lang + '/tabs_right_disactive.gif';
		document.getElementById('2_td_color_' + website_lang).bgColor = "#6196D0";
	}
	else if(old_tab2 == 2 || old_tab2 == 3)
	{
		
		document.getElementById('2_img_1_' + old_tab2).src = './includes-img/' + website_lang + '/tabs_left_disactive.gif';
		document.getElementById('2_td_2_' + old_tab2).style.background = 'url(./includes-img/tabs_repeat_disactive.gif)';
		document.getElementById('2_td_2_' + old_tab2).vAlign = "bottom";
		document.getElementById('2_img_3_' + old_tab2).src = './includes-img/' + website_lang + '/tabs_right_disactive.gif';
	}
	else
	{
		
		document.getElementById('2_img_1_' + old_tab2).src = './includes-img/' + website_lang + '/tabs_left_disactive.gif';
		document.getElementById('2_td_2_' + old_tab2).style.background = 'url(./includes-img/tabs_repeat_disactive.gif)';
		document.getElementById('2_td_2_' + old_tab2).vAlign = "bottom";
		document.getElementById('2_img_3_' + old_tab2).src = './includes-img/' + website_lang + '/tab_corner_top_right_disactive.gif';
	}

	if(new_tab == 1)
	{
		
		document.getElementById('2_img_1_' + new_tab).src = './includes-img/' + website_lang + '/tab_corner_top_left_active.gif';
		document.getElementById('2_td_2_' + new_tab).style.background = 'url(./includes-img/tabs_repeat_active.gif)';
		document.getElementById('2_td_2_' + new_tab).vAlign = "middle";
		document.getElementById('2_img_3_' + new_tab).src = './includes-img/' + website_lang + '/tabs_right_active.gif';
		document.getElementById('2_td_color_' + website_lang).bgColor = "#2558aa";
	}
	else if(new_tab == 2 || new_tab == 3)
	{
		
		document.getElementById('2_img_1_' + new_tab).src = './includes-img/' + website_lang + '/tabs_left_active.gif';
		document.getElementById('2_td_2_' + new_tab).style.background = 'url(./includes-img/tabs_repeat_active.gif)';
		document.getElementById('2_td_2_' + new_tab).vAlign = "middle";
		document.getElementById('2_img_3_' + new_tab).src = './includes-img/' + website_lang + '/tabs_right_active.gif';
	}
	else
	{
		
		document.getElementById('2_img_1_' + new_tab).src = './includes-img/' + website_lang + '/tabs_left_active.gif';
		document.getElementById('2_td_2_' + new_tab).style.background = 'url(./includes-img/tabs_repeat_active.gif)';
		document.getElementById('2_td_2_' + new_tab).vAlign = "middle";
		document.getElementById('2_img_3_' + new_tab).src = './includes-img/' + website_lang + '/tab_corner_top_right_active.gif';
	}

	document.getElementById('2_img_1_' + old_tab2).style.cursor = 'pointer';
	document.getElementById('2_td_2_' + old_tab2).style.cursor = 'pointer';
	document.getElementById('2_img_3_' + old_tab2).style.cursor = 'pointer';
	document.getElementById('2_img_1_' + new_tab).style.cursor = 'default';
	document.getElementById('2_td_2_' + new_tab).style.cursor = 'default';
	document.getElementById('2_img_3_' + new_tab).style.cursor = 'default';

	old_tab2 = new_tab;
	
}
