// code by sonali

// add photo for particular profile
	function addIndicator(div,$indicator,$ajaxcontentarea)
	{
		if(document.getElementById($indicator))
		{
			document.getElementById($indicator).style.display = "block";
			document.getElementById($ajaxcontentarea).style.display = "none";
		}
			
		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 = "Loading please wait.";
		}
	}
	
	function removeIndicator(div,$indicator,$ajaxcontentarea)
	{
		if(document.getElementById($indicator))
		{
			document.getElementById($indicator).style.display = "none";
			document.getElementById($ajaxcontentarea).style.display = "";
		}
		
		if(document.getElementById(div))
		{
			document.getElementById(div).style.height="0px";
			document.getElementById(div).innerHTML = "";
		}
	}

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

// 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 area_show_hide($show,$hide)
{
	if($show)
	{
		var area_show	= $show.split(",");
		for($i=0; $i<area_show.length; $i++)
		{
			document.getElementById(area_show[$i]).style.display = "";
		}
	}
	if($hide)
	{
		var area_hide	= $hide.split(",");
		for($i=0; $i<area_hide.length; $i++)
		{
			document.getElementById(area_hide[$i]).style.display = "none";
		}
	}
}

function tab_show_hide($show,$hide)
{
	var tab_show	= $show.split(",");
	for($i=0; $i<tab_show.length; $i++)
	{
		document.getElementById(tab_show[$i]).className = "active";
	}
	
	var tab_hide	= $hide.split(",");
	for($i=0; $i<tab_hide.length; $i++)
	{
		document.getElementById(tab_hide[$i]).className = "";
	}
}
