// JavaScript Document
var MOZ = (typeof document.implementation != 'undefined') && (typeof document.implementation.createDocument != 'undefined'); 
var IE = (typeof window.ActiveXObject != 'undefined'); 
var http_request=false;
var target;

function expand_div(obj)
{
	obj.rows = 15;
}

function reduce_div(obj)
{
	obj.rows = 5;
}


function mAjax_news(tg, func) 
{ 

if (navigator.appName == "Microsoft Internet Explorer") 
    {	
    var html =' <html>\n'; 
        html+=' <scr'+'ipt type="text/javascript">\n'; 
        html+=' parent.send_get_news("'+tg+'");\n'; 
        html+=' </scr'+'ipt>\n'; 
        html+=' </html>';         
		amehistory.document.open(); 
		amehistory.document.write(html);
		amehistory.document.close();
    } 
else 
    { 
    amehistory.location.href = "response.php?link="+tg + "&func=" + func; 
    } 

} 

function send_get_news(tg) {
	var url="news.php";		
	var parameters = "";//"action=get_product&select_product="+select_product+"&quantity_product="+quantity_product+"&s_country="+s_country;

        if (MOZ) { // Mozilla
            http_request = new XMLHttpRequest();
            if (http_request.overrideMimeType) {
                http_request.overrideMimeType('text/xml');
            }
        }else if (IE) { // IE
            try {
                http_request = new ActiveXObject("Msxml2.XMLHTTP");
            } catch (e) {
                try {
                    http_request = new ActiveXObject("Microsoft.XMLHTTP");
                } catch (e) {}
            }
        }

         if (!http_request) 
		 {
	         alert('Sorry. Cannot create XMLHTTP instance so we can not add data ');
		     return false;
		 }
      
	  target=tg;
      http_request.onreadystatechange = showResult;
	  http_request.open('POST', url, true);
      http_request.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
      http_request.setRequestHeader("Content-length", parameters.length);
      http_request.setRequestHeader("Connection", "close");
      http_request.send(parameters);
	  document.getElementById("status").style.display = "block";
	  document.getElementById("right_data_1").style.display = "none";
	  document.getElementById("right_data").style.display = "block";

}

function showResult()
   // target name of div who get the result
   {
      if (http_request.readyState == 4) {
		  document.getElementById("status").style.display = "none";
         if (http_request.status == 200) {
            result = http_request.responseText;
            document.getElementById(target).innerHTML = result;            
         } else {
            document.getElementById(target).innerHTML ="<font color='red'><b>There was a problem with the connection</b></font>";
         }
      }
}