//Ajax browser support
function GetXmlHttpObject() {
var xmlHttp=null;
try  {
  // Firefox, Opera 8.0+, Safari
  xmlHttp=new XMLHttpRequest();
  }
catch (e)  {
  // Internet Explorer
  try
    {
    xmlHttp=new ActiveXObject("Msxml2.XMLHTTP");
    }
  catch (e)  {
    xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
}
if (xmlHttp==null)  {
  	alert ("Your browser does not support AJAX!");
	return;
} else {
	return xmlHttp;
}
}

function d (strId) { 
	return document.getElementById(strId); 
}
function stripSlashes(str) {
	return str.replace(/\\/g, '');
}
function confirmDelete(type) {
	var agree = confirm("Are you sure you want delete this "+type+"?");
	if (agree)
		return true ;
	else
	return false ;
}

function addToFavorite(type,id) {
ajaxRequest = GetXmlHttpObject();

	ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 4){	
		d('favorite').innerHTML=ajaxRequest.responseText;
		}		
	}
	ajaxRequest.open("GET", "/includes/ajax.Common.php?addToFavorite="+id+"&type="+type, true);
	ajaxRequest.send(null); 
}
function subscribeToUser(id) {
ajaxRequest = GetXmlHttpObject();

	ajaxRequest.onreadystatechange = function(){
	if(ajaxRequest.readyState == 4){	
		d('subscribe').innerHTML=ajaxRequest.responseText;
		}		
	}
	ajaxRequest.open("GET", "/includes/ajax.Common.php?subscribeToUser="+id, true);
	ajaxRequest.send(null); 
}

function clearSearch(field){
	if (field.defaultValue==field.value) {
		field.value = "";
		document.forms['pasearch'].q.style.color="#1f5196";
		document.forms['pasearch'].q.style.fontWeight="bold";
	}
}
function checkValid() {
	if ((document.forms['pasearch'].q.value == document.forms['pasearch'].q.defaultValue) ||
		(document.forms['pasearch'].q.value == '')) {
		return false;
	}
	return true;
}
function showTab(tab) {
	d(tab).style.display="";
}
function hideTab(tab) {
	d(tab).style.display="none";
}