﻿// JScript File

function buttonchange(id, img_src){
    document[id].src = img_src
}

function createrequest(){
    var req;
    try{
        req = new XMLHttpRequest();
    }
    catch(e)
    {
        try{
			    req = new ActiveXObject("Msxml2.XMLHTTP");
		   } 
		   catch (e) 
		   {
		    try{
				    req = new ActiveXObject("Microsoft.XMLHTTP");
			    } 
			    catch (e)
			    {
				    // Something went wrong
				   //alert("Sorry Your Browser may not support AJAX Content You Need To Have IE5 Or Above");
				    //return false;
				    //return true;
			      }
		    }
    }
    return req;
}



function home(){

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!


	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "result"){
                        document.getElementById('datacell').innerHTML=intstring;
                    }
                }
			 }
			return true;
		}
		else
		{
			return false;
		}

    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "ajax.aspx?com=home&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function aboutus(){

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!


	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "result"){
                        document.getElementById('datacell').innerHTML=intstring;
                    }
                }
			 }
			return true;
		}
		else
		{
			return false;
		}

    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "ajax.aspx?com=aboutus&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function structure(){

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!


	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "result"){
                        document.getElementById('datacell').innerHTML=intstring;
                    }
                }
			 }
			return true;
		}
		else
		{
			return false;
		}

    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "ajax.aspx?com=structure&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function news(){

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!


	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "result"){
                        document.getElementById('datacell').innerHTML=intstring;
                    }
                }
			 }
			return true;
		}
		else
		{
			return false;
		}

    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "ajax.aspx?com=news&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function contact(){

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!


	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "result"){
                        document.getElementById('datacell').innerHTML=intstring;
                    }
                }
			 }
			return true;
		}
		else
		{
			return false;
		}

    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "ajax.aspx?com=contact&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function links(){

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!


	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "result"){
                        document.getElementById('datacell').innerHTML=intstring;
                    }
                }
			 }
			return true;
		}
		else
		{
			return false;
		}

    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "ajax.aspx?com=links&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

function gala(){

var ajaxRequest = createrequest();  // The variable that makes Ajax possible!


	// Create a function that will receive data sent from the server
	
    function handleresponse(){
		if(ajaxRequest.readyState == 4 && ajaxRequest.status == 200){
		    var response = ajaxRequest.responseText;
		    //alert(response);
		    response=response.substring(0,response.indexOf("<!DOCTYPE")-4);
        
            if(response=="")
            {
                window.location.reload();
            }
            else
            {
                var arr=response.split("~")
                
                for(var i=0;i<arr.length;i++)
                {
                    var table = arr[i].split("|");
                    var tablestring = table[0];
                    var intstring = table[1];
                    if (tablestring == "result"){
                        document.getElementById('datacell').innerHTML=intstring;
                    }
                }
			 }
			return true;
		}
		else
		{
			return false;
		}

    }
    myRand=parseInt(Math.random()*99999999);    
    var url = "ajax.aspx?com=gala&rnd=" + myRand;
	ajaxRequest.open("GET", url, true);
	ajaxRequest.onreadystatechange = handleresponse;
	ajaxRequest.send(null);
}

