
function toggle(obj) {
	var el	 = document.getElementById(obj);
	var elh  = document.getElementById(obj+'hide');
 	if ( el.style.display != 'none' ) {
		elh.style.display='block';
		el.style.display = 'none';
		
		
	}
	else {
		elh.style.display='none';
		el.style.display = 'block';
		
	}
}


function ajaxpage(url,containerid,area_display){
	
	
	var key_value=document.getElementById(containerid);
	var url=url+"&key="+containerid;
	//alert(url);
	
var page_request = false;
	//document.getElementById('loading').style.display='block';
	if (window.XMLHttpRequest){ // if Mozilla, Safari etc
		page_request = new XMLHttpRequest()
	}
	else if (window.ActiveXObject){ // if IE
		try {
			page_request = new ActiveXObject("Msxml2.XMLHTTP")
		} 
		catch (e){
			try{
				page_request = new ActiveXObject("Microsoft.XMLHTTP")
			}
			catch (e){
				alert('Please Modify Your browser to the latest version.');
			}
		}
	}
	else{
		return false
	}
	
page_request.onreadystatechange=function(){
	loadpage(page_request, containerid,area_display)
}



	
page_request.open('GET', url, true)
page_request.send(null)
}


function loadpage(page_request,containerid,area_display){
	
	if (page_request.readyState == 4 && (page_request.status==200 || window.location.href.indexOf("http")==-1))
		{
		
		document.getElementById(area_display).innerHTML=page_request.responseText;
		document.getElementById(area_display).style.display="";
		
		}
	}
	
function ajaxpage_close(area)
{
	document.getElementById(area).style.display = 'none'
}
	
// code by sonali

// add photo for particular profile
	function addIndicator(div,$indicator)
	{
		if(document.getElementById($indicator))
			document.getElementById($indicator).style.display = "block";
			
		if(document.getElementById(div))
		{
			document.getElementById(div).style.height="20px";
			//document.getElementById(div).style.backgroundImage = "url(images/indicator.gif);"; 
			//document.getElementById(div).style.background-repeat = "no-repeat";
			document.getElementById(div).innerHTML = "";
		}
	}
	
	function removeIndicator(div,$indicator)
	{
		if(document.getElementById($indicator))
			document.getElementById($indicator).style.display = "none";
		
		if(document.getElementById(div))
		{
			document.getElementById(div).style.height="0px";
			document.getElementById(div).innerHTML = "";
		}
	}

	
// START : create the HTTP Object 
	function getHTTPObject() 
	{ 
		var xmlhttp; 
		

		if(window.XMLHttpRequest)
		{ 
			xmlhttp = new XMLHttpRequest(); 
		} 
		else if (window.ActiveXObject)
		{ 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
			if (!xmlhttp)
			{ 
				xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
			} 
		} 
		return xmlhttp; 
	} 
	
	//var http = getHTTPObject();
	// END : create the HTTP Object 
	


function showAjax($page,$ajaxcontentarea,$http,$ajax_status,$indicator)
{
	var $http, $ajax_status;
	
	if($http==null) 			$http = "http";
	if($ajax_status==null)		$ajax_status = "ajax_status";
	if($indicator==null)		$indicator = "indicator";
	
	//alert($page);
	$http = getHTTPObject();
	addIndicator($ajax_status,$indicator);
	document.getElementById($ajaxcontentarea).style.display = "none";
	var serverPage = $page;	//"ajax/tools_profile_views.php?flag="+flag+"&error="+error;
	$http.open("GET", serverPage);
	$http.onreadystatechange = function() 
	{
		if ($http.readyState == 4 && $http.status == 200) 
		{
		   document.getElementById($ajaxcontentarea).innerHTML =$http.responseText;
		   //alert("aaaaaaaaaaaaaaa");
		   removeIndicator($ajax_status,$indicator);
		   document.getElementById($ajaxcontentarea).style.display = "";

		}
	}
	$http.send(null);
}		
	
	