//javascript function to return the date and time
//this will make the call to the ajax url unique
function Datetime() {
	var datum= new Date().getTime();
	return datum;
}



//javascript function to rturn xml http object

function getXMLHTTP() { //fuction to return the xml http object
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				req = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
	}
////////////////////////////////////////////////////////////////////////
//javascript function to return menu's for the choosen language
//used to populate the language pulldown in 
//		-	list_articles.php
//		-
////////////////////////////////////////////////////////////////////////

function getMenu(strURL)
    {         
     var req = getXMLHTTP(); // fuction to get xmlhttp object
     if (req)
     {
      req.onreadystatechange = function()
     {
      if (req.readyState == 4) { //data is retrieved from server
       if (req.status == 200) { // which reprents ok status                    
         document.getElementById('menudropdown').innerHTML=req.responseText;
      }
      else
      { 
         alert("There was a problem while using XMLHTTP:\n");
      }
      }            
      }        
    req.open("GET", strURL, true); //open url using get method
    req.send(null);
     }
    }

////////////////////////////////////////////////////////////////////////
//javascript function to image object for the choosen language
//used to show the flag in 
//		-	list_articles.php
//		-
////////////////////////////////////////////////////////////////////////

function getFlag(strURL)
	    {         
     var req = getXMLHTTP(); // fuction to get xmlhttp object
     if (req)
     {
      req.onreadystatechange = function()
     {
      if (req.readyState == 4) { //data is retrieved from server
       if (req.status == 200) { // which reprents ok status                    
         document.getElementById('flag').innerHTML=req.responseText;
      }
      else
      { 
         alert("There was a problem while using XMLHTTP:\n");
      }
      }            
      }        
    req.open("GET", strURL, true); //open url using get method
    req.send(null);
     }
    }

////////////////////////////////////////////////////////////////////////
//javascript function to return articles's for the choosen language and choosen menu
//used to: populate the articles list in 
//used on following pages
//		-	list_articles.php
//		-
//variable in: 
//
////////////////////////////////////////////////////////////////////////

function getArticles(strURL)
	    {         
     var req = getXMLHTTP(); // fuction to get xmlhttp object
     if (req)
     {
      req.onreadystatechange = function()
     {
      if (req.readyState == 4) { //data is retrieved from server
       if (req.status == 200) { // which reprents ok status                    
         document.getElementById('articles').innerHTML=req.responseText;
      }
      else
      { 
         alert("There was a problem while using XMLHTTP:\n");
      }
      }            
      }        
    req.open("GET", strURL, true); //open url using get method
    req.send(null);
     }
    }

////////////////////////////////////////////////////////////////////////
// generic javascript function to return content from php file given to
// change content's of divobject given
// used on following pages
//		-	list_menus.php
//		-
//variable in: 	strURL - The url to call, including query fields
//				divID - The ID of the div that must be changed.
////////////////////////////////////////////////////////////////////////
function getDivContent(strURL,divID)
	    {         
     var req = getXMLHTTP(); // fuction to get xmlhttp object
     if (req)
     {
      req.onreadystatechange = function()
     {
      if (req.readyState == 4) { //data is retrieved from server
       if (req.status == 200) { // which reprents ok status                    
         document.getElementById(divID).innerHTML=req.responseText;
      }
      else
      { 
         alert("There was a problem while using XMLHTTP:\n");
      }
      }            
      }        
    req.open("GET", strURL, true); //open url using get method
    req.send(null);
     }
    }
	
function moveToURL(strURL)
	{
		window.location = strURL ;
	}
	

