var xmlHttp;
var xmlHttp_2;
var xmlHttp_3;
var xmlHttp_4;
var xmlHttp_5;
var xmlHttp_6;
var xmlHttp_7;
var xmlHttp_8;

var xmlHttp_11;
var xmlHttp_12;
var xmlHttp_13;
var xmlHttp_14;
var xmlHttp_15;
var randomnumber;

function update_promobanner_top(page)
{	
var x = page;
	try
	{
		xmlHttp=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try { xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp.onreadystatechange=function()
	{
		if (xmlHttp.readyState==4)
		{
			if(strlen(xmlHttp.responseText) > 10){
			document.getElementById("televizor_10").innerHTML=xmlHttp.responseText;
			}
			setTimeout("update_promobanner('"+x+"')",110000);
		}
	}
	page2=str.page;
	randomnumber=Math.random()*100;
	//xmlHttp.open("GET","./banner.php?page="+randomnumber,true);
	xmlHttp.open("GET","./televizor4.php?page="+x+"&amp;rand="+randomnumber,true);
	xmlHttp.send(null);	
}
function update_quotes() {       //// ne se polzva ve4e
	var quotes = load("./quotes.htm?rand="+randomnumber);
	if (strlen(quotes)>10) {
		$("#quote_div").load("./quotes.htm?rand="+randomnumber);
	}
		var refreshId = setInterval(function() {
			if (strlen(quotes)>10) {
				$("#quote_div").load("./quotes.htm?rand="+randomnumber);
			}
		}, 5000);
}

function update_banner()
{	
	try
	{
		xmlHttp_6=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp_6=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try { xmlHttp_6=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp_6.onreadystatechange=function()
	{
		if (xmlHttp_6.readyState==4)
		{
			if(strlen(xmlHttp_6.responseText) > 10){
			document.getElementById("baner_top").innerHTML=xmlHttp_6.responseText;
			}
			setTimeout("update_banner()",60000);
		}
	}
	randomnumber=Math.random()*100;
	//xmlHttp_6.open("GET","./banner.php?page="+randomnumber,true);
	xmlHttp_6.open("GET","./top_banner.php?rand="+randomnumber,true);
	xmlHttp_6.send(null);	
}

function update_promobanner(page)
{	
var x = page;
	try
	{
		xmlHttp_8=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp_8=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try { xmlHttp_8=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp_8.onreadystatechange=function()
	{
		if (xmlHttp_8.readyState==4)
		{
		  if(strlen(xmlHttp_8.responseText) > 10){
			document.getElementById("televizor").innerHTML=xmlHttp_8.responseText;
            }
			setTimeout("update_promobanner('"+x+"')",110000);
		}
	}
	page2=str.page;
	randomnumber=Math.random()*100;
	xmlHttp_8.open("GET","./televizor3.php?page="+x+"&amp;rand="+randomnumber,true);
	xmlHttp_8.send(null);	
}

function update_daily_research(){
	res = (res==null) ? '' : res;	
	try{
		xmlHttp_2=new XMLHttpRequest();
	}catch (e){
		try{
			xmlHttp_2=new ActiveXObject("Msxml2.XMLHTTP");
		}catch (e){
			try { xmlHttp_2=new ActiveXObject("Microsoft.XMLHTTP");
			}catch (e){
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp_2.onreadystatechange=function(){
        if (xmlHttp_2.readyState==4){
           if(strlen(xmlHttp_2.responseText) > 10){
        	   if(document.getElementById("content_page")){	     
        		document.getElementById("content_page").innerHTML=xmlHttp_2.responseText;
        	   }
        	}
        	setTimeout("update_daily_research()",60000);		
        }
	}	
	xmlHttp_2.open("GET","http://www.varchevbrokers.com/research_new.php"+res,true);
	xmlHttp_2.send(null);
}


function update_daily_research_slow(){

    var divObj;
    if(divObj = document.getElementById("div_scroll")){
        var scroll  = (document.getElementById("div_scroll").scrollTop)*1;
        if(scroll >= 1000){
            setTimeout("update_daily_research_slow()",5000);
        }else{
            res = (res==null) ? '' : res;	
            try{
    		  xmlHttp_14=new XMLHttpRequest();
        	}catch (e){
        		try{
        			xmlHttp_14=new ActiveXObject("Msxml2.XMLHTTP");
        		}catch (e){
        			try { 
                        xmlHttp_14=new ActiveXObject("Microsoft.XMLHTTP");
        			}catch (e){
        				alert("Your browser does not support AJAX!"); return false;
        			}
        		}
        	}
        	xmlHttp_14.onreadystatechange=function(){
        		if (xmlHttp_14.readyState==4){			
        		   if(strlen(xmlHttp_14.responseText) > 10){
        			   if(document.getElementById("content_page")){
        			         document.getElementById("content_page").innerHTML=xmlHttp_14.responseText;
        			   }
        			}
        			setTimeout("update_daily_research_slow()",30000);
        		}
        	}	
        	xmlHttp_14.open("GET","http://www.varchevbrokers.com/research_new.php"+res,true);
        	xmlHttp_14.send(null);
        }
    }else{
        res = (res==null) ? '' : res;	
        try{
		  xmlHttp_14=new XMLHttpRequest();
    	}catch (e){
    		try{
    			xmlHttp_14=new ActiveXObject("Msxml2.XMLHTTP");
    		}catch (e){
    			try { 
                    xmlHttp_14=new ActiveXObject("Microsoft.XMLHTTP");
    			}catch (e){
    				alert("Your browser does not support AJAX!"); return false;
    			}
    		}
    	}
    	xmlHttp_14.onreadystatechange=function(){
    		if (xmlHttp_14.readyState==4){			
    		   if(strlen(xmlHttp_14.responseText) > 10){
    			   if(document.getElementById("content_page")){
    			         document.getElementById("content_page").innerHTML=xmlHttp_14.responseText;
    			   }
    			}
    			setTimeout("update_daily_research_slow()",60000);
    		}
    	}	
    	xmlHttp_14.open("GET","http://www.varchevbrokers.com/research_new.php"+res,true);
    	xmlHttp_14.send(null);	
    }
}
function update_daily_announcecontent()
{	
	res = (res==null) ? '' : res;	
	try
	{
		xmlHttp_3=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp_3=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try { xmlHttp_3=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp_3.onreadystatechange=function()
	{
		if (xmlHttp_3.readyState==4)
		{			
			if(strlen(xmlHttp_3.responseText) > 10){
			document.getElementById("announcecontent").innerHTML=xmlHttp_3.responseText;
			}
			setTimeout("update_daily_announcecontent()",120000);			
			//alert("updated");			
		}
	}	
	xmlHttp_3.open("GET","http://www.varchevbrokers.com/announcecontent.php"+res,true);
	xmlHttp_3.send(null);	
}
function update_daily_announcecontent_sub()
{	
	res = (res==null) ? '' : res;	
	try
	{
		xmlHttp_11=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp_11=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try { xmlHttp_11=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp_11.onreadystatechange=function()
	{
		if (xmlHttp_11.readyState==4)
		{			
			if(strlen(xmlHttp_11.responseText) > 10){
			document.getElementById("announcecontent_sub").innerHTML=xmlHttp_11.responseText;
			}
			setTimeout("update_daily_announcecontent_sub()",120000);			
			//alert("updated");			
		}
	}	
	xmlHttp_11.open("GET","http://www.varchevbrokers.com/announcecontent_sub.php"+res,true);
	xmlHttp_11.send(null);	
}
function update_top_ticker()
{	
	try
	{
		xmlHttp_12=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp_12=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try { xmlHttp_12=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp_12.onreadystatechange=function()
	{
		if (xmlHttp_12.readyState==4)
		{
			document.getElementById("top-ticker").innerHTML=xmlHttp_12.responseText;
			setTimeout("update_top_ticker()",120000);
		}
	}
	randomnumber=Math.random()*100;
	xmlHttp_12.open("GET","./top_ticker.php?rand="+randomnumber,true);
	xmlHttp_12.send(null);	
}
function update_bottom_ticker()
{	
	try
	{
		xmlHttp_13=new XMLHttpRequest();
	}
	catch (e)
	{
		try
		{
			xmlHttp_13=new ActiveXObject("Msxml2.XMLHTTP");
		}
		catch (e)
		{
			try { xmlHttp_13=new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch (e)
			{
				alert("Your browser does not support AJAX!"); return false;
			}
		}
	}
	xmlHttp_13.onreadystatechange=function()
	{
		if (xmlHttp_13.readyState==4)
		{
			document.getElementById("bottom-ticker").innerHTML=xmlHttp_13.responseText;
			setTimeout("update_bottom_ticker()",120000);
		}
	}
	randomnumber=Math.random()*100;
	xmlHttp_13.open("GET","./bottom_ticker.php?rand="+randomnumber,true);
	xmlHttp_13.send(null);	
}
