var xmlHttp
var xmlHttp1
var subtabid
var userid
function changefavs(id){
normalisefavs();
document.getElementById(id).className="TabbedPanelsTab TabbedPanelsTabSelected";
}
function normalisefavs(){
	for( var i=1; i<7; i++)
	{
    document.getElementById("sp_"+i).className="TabbedPanelsTab";
	}
}
function changefavs21(id){
normalisefavs21();
document.getElementById(id).className="TabbedPanelsTab TabbedPanelsTabSelected";
}
function normalisefavs21(){
	for( var i=1; i<3; i++)
	{
    document.getElementById("sp_"+i).className="TabbedPanelsTab";
	}
}

function addFavorite(str,user_id,membertype)
{
	 
	
	xmlHttp=GetXmlHttpObject()
 
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="addFavourite.php"
url=url+"?user_id="+user_id+"&fav="+str+"&type="+membertype
 xmlHttp.onreadystatechange=stateChanged_fav
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}

function stateChanged_fav() 
{ 
	if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
	 { 
	  //document.getElementById("addfoavouritetxt").innerHTML=xmlHttp.responseText

		 if(xmlHttp.responseText == '999')
		 {
			 alert('Sorry !! You can not add yourself to favourites');
		 }
		 else
		 {
		 var con = 1;//confirm(xmlHttp.responseText);
	  alert(xmlHttp.responseText )		 
		 }
	 
	 } 
}

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");
  }
 }
return xmlHttp;
}// JavaScript Document


function changefavsaa(id){
normalisefavsaa();
document.getElementById(id).className="TabbedPanelsTab TabbedPanelsTabSelected";
}
function normalisefavsaa(){
	for( var i=1; i<3; i++)
	{
    document.getElementById("aa_"+i).className="TabbedPanelsTab";
	}
}

 function showprofile1(id,struser,p_type)
 {
	 changefavsaa('aa_'+id)
 	xmlHttp=GetXmlHttpObject()
 
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="profile_tab.php"
url=url+"?user_id="+struser+"&type="+p_type
// alert(url)
xmlHttp.onreadystatechange=stateChanged21
xmlHttp.open("GET",url,true)
xmlHttp.send(null) 
 }

function stateChanged21() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	document.getElementById("profile_txt").style.display='none'
	document.getElementById("profile").innerHTML=xmlHttp.responseText
	//document.getElementById("profile_txt").innerHTML=xmlHttp.responseText
			//code for slide
			$(document).ready(function(){	
		$("#slider").easySlider({
			controlsBefore:	'<p id="controls2">',
			controlsAfter:	'</p>',	
			prevId: 'prevBtn2',
			nextId: 'nextBtn2'	
		});			
		});	
			//end of slide code
 
 } 
 else
 {
	document.getElementById("profile_txt").style.display='none'
	//document.getElementById("profile_txt").innerHTML="<div align='center'><img src='images/ajax-loader.gif'></div>"
	document.getElementById("profile").innerHTML="<div align='center'><img src='images/ajax-loader.gif'></div>"
 }
}





 function showprofile(iid,struser,p_type)
 {
	 subtabid=iid;
	 userid=struser;
	 //changefavs('sp_'+iid);
 	xmlHttp=GetXmlHttpObject()
 
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="profile_tab.php"
url=url+"?user_id="+struser+"&type="+p_type
xmlHttp.onreadystatechange=stateChanged2
xmlHttp.open("GET",url,true)
xmlHttp.send(null) 
 }

function stateChanged2() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 	document.getElementById("profile_txt").style.display='none'
	document.getElementById("profile").innerHTML=xmlHttp.responseText
	if(subtabid==4) makeactive_sub2(4,userid,'news');
	if(subtabid==5) makeactive_sub(4,userid,'news');
		
	//document.getElementById("profile_txt").innerHTML=xmlHttp.responseText
			//code for slide
			/* $(document).ready(function(){
				$("#parent1").wslide({
					width: 700,
					height: 200
				});
			});*/
			 //end of slide code
 
 } 
 else
 {
    document.getElementById("profile_txt").style.display='none'
	document.getElementById("profile").innerHTML="<div align='center'><img src='images/ajax-loader.gif'></div>"
	//document.getElementById("profile_txt").innerHTML="<div align='center'><img src='images/ajax-loader.gif'></div>"
 }
}


function showTabFeature(tabno)
{
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="show_tab.php"
url=url+"?tab="+tabno
xmlHttp.onreadystatechange=stateChangedFeature
xmlHttp.open("GET",url,true)
xmlHttp.send(null) 		
show_other_tab(tabno)
}

function stateChangedFeature() 
{ 

if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	//document.getElementById("show_tab").style.display=''
	//document.getElementById("hide_tab").style.display='hidden'
	document.getElementById("hide_tab").innerHTML=xmlHttp.responseText

 } 
else
{
	document.getElementById("hide_tab").innerHTML="<div align='center' ><img src='images/ajax-loader.gif' ></div>"
}
}

function show_other_tab(str)
{
	
	xmlHttp1=GetXmlHttpObject()
 	if (xmlHttp1==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url1="show_tab_other.php"
url1=url1+"?tab="+str
xmlHttp1.onreadystatechange=stateChanged9
xmlHttp1.open("GET",url1,true)
xmlHttp1.send(null) 		

}
function stateChanged9() 
{ 
if (xmlHttp1.readyState==4 || xmlHttp1.readyState=="complete")
 { 
    document.getElementById("otherprofile").style.display=''
    document.getElementById("hide_tab_other").style.display='none'
 	document.getElementById("otherprofile").innerHTML=xmlHttp1.responseText
 } 
 else
 { 
 document.getElementById("otherprofile").style.display=''
 document.getElementById("hide_tab_other").style.display='none'
 document.getElementById("otherprofile").style.innerHTML="<div align='center'><img src='images/ajax-loader.gif'></div>"
	 
 }
}


 

function show_result(str,view,country_code)
{
 
	xmlHttp=GetXmlHttpObject()
	if (xmlHttp==null)
	 {
	 alert ("Browser does not support HTTP Request")
	 return
	 }
	var url="show_lesten.php"
	url=url+"?genere="+str+"&view="+view+"&country_code="+country_code
	 
	xmlHttp.onreadystatechange=stateChanged6
	xmlHttp.open("GET",url,true)
	xmlHttp.send(null) 		

}
function stateChanged6() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
 
 document.getElementById("search").style.display=''
 document.getElementById("search_result").style.display='none'
 	document.getElementById("search").innerHTML=xmlHttp.responseText

 
 } 
 else
 {document.getElementById("search").style.display=''
 document.getElementById("search_result").style.display='none'
 	document.getElementById("search").innerHTML="<div align='center'><img src='images/ajax-loader.gif'></div>"

 }
}

function change(id){
normalise();
document.getElementById(id).className="TabbedPanelsTab TabbedPanelsTabSelected";
}
function normalise(){
	for( var i=1; i<7; i++)
	{
   // document.getElementById("a_"+i).className="TabbedPanelsTab";
	}
}

function show_tab(str,uid)
{
	subtabid=str
	userid=uid
	//change('a_'+str); 
	xmlHttp=GetXmlHttpObject()
 	
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  }
  
var url="show_profile.php";
url=url+"?q="+str+"&uid="+uid;
url=url+"&sid="+Math.random();
xmlHttp.onreadystatechange=stateChanged3;
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
	
}
function stateChanged3() 
{ 
if (xmlHttp.readyState==4)
{ 
  document.getElementById("accountProfile").style.display = 'none' 
  document.getElementById("txtProfile").innerHTML=xmlHttp.responseText;
	if(subtabid==3){ makeactive_sub(4,'news');}
	if(subtabid==4){makeactive_sub2(1,'news');}
	if(subtabid==5){makeactive_sub3(2)}

}
else
{
document.getElementById("accountProfile").style.display = '' 
document.getElementById("accountProfile").innerHTML="<table style='float:left'><tr><td> <img src='images/ajax-loader.gif'></td></tr></table>"

}

}

 function changefavsg(id){
					
  normalisefavsg();
document.getElementById(id).className="TabbedPanelsTab TabbedPanelsTabSelected";
}
function normalisefavsg(){
	for( var i=1; i<4; i++)
	{
    document.getElementById("gg_"+i).className="TabbedPanelsTab";
	}
}  
function showgallery(str,type,uid)
{
	    
 		xmlHttp=GetXmlHttpObject()
 	
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="show_gallery.php";
url=url+"?q="+str+"&type="+type+"&uid="+uid;
xmlHttp.onreadystatechange=stateChanged11;
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}
 function stateChanged11() 
{   
	if (xmlHttp.readyState==4)
	{ 	 
		//document.getElementById("profile_txt").style.display = 'none' 
 		
		document.getElementById("showpic").style.display = 'none' 
		document.getElementById('profile_txt').style.display = 'none';	
		document.getElementById("profile_show").style.display='';
		document.getElementById("profile_show").innerHTML=xmlHttp.responseText;
		//initialize();
	}
	else
	{
		document.getElementById("showpic").style.display = 'none' 
		document.getElementById('profile_txt').style.display = 'none';	
		document.getElementById("profile_show").style.display='';
		document.getElementById("profile_show").innerHTML="<div align='center' class=left><img src='images/ajax-loader.gif'></div>"
	}
}


function check_code(str)
{
 		xmlHttp=GetXmlHttpObject()
 	 
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="chcek_code.php";
url=url+"?q="+str
url=url+"&sid="+Math.random();

xmlHttp.onreadystatechange=stateChanged15;
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}
 function stateChanged15() 
{ 
if (xmlHttp.readyState==4)
{ 
  
 document.getElementById("code_text").innerHTML=xmlHttp.responseText;
}
}

function changefavsr(id){
normalisefavsr();
document.getElementById(id).className="TabbedPanelsTab TabbedPanelsTabSelected";
}
function normalisefavsr(){
	for( var i=1; i<3; i++)
	{
    document.getElementById("sr_"+i).className="TabbedPanelsTab";
	}
}

function showRelease(sr,str,type)
{
 		xmlHttp=GetXmlHttpObject()
 	 
if (xmlHttp==null)
  {
  alert ("Your browser does not support AJAX!");
  return;
  } 
var url="show_release.php";
url=url+"?q="+str+"&type="+type
url=url+"&sid="+Math.random();
 
xmlHttp.onreadystatechange=stateChanged16;
xmlHttp.open("GET",url,true);
xmlHttp.send(null)
}
 function stateChanged16() 
{ 
if (xmlHttp.readyState==4)
{ 
 document.getElementById("profile").style.display='none';  
 document.getElementById("profile_txt").innerHTML=xmlHttp.responseText;
}
else
{ document.getElementById("profile").style.display='none';  
 document.getElementById("profile_txt").innerHTML="<div align='center' class=left><img src='images/ajax-loader.gif'></div>";
}
}

/////////////////////////////////////// MAP CODES //////////////////////////////////
 var map = null;
    var geocoder = null;

    function initialize() {
	
      if (GBrowserIsCompatible()) {
        map = new GMap2(document.getElementById("map_canvas"));
        map.setCenter(new GLatLng(37.4419, -122.1419), 13);
        geocoder = new GClientGeocoder();
      }
	  showAddress('India , Gurgaon');
    }

    function showAddress(address) {
	
      if (geocoder) {
        geocoder.getLatLng(
          address,
          function(point) {
            if (!point) {
              alert(address + " not found");
            } else {
              map.setCenter(point, 13);
              //var marker = new GMarker(point);
              //map.addOverlay(marker);
              //marker.openInfoWindowHtml(address);
            }
          }
        );
      }
    }

/* add release tracks */

function AddReleaseTracks(no)
{
 	xmlHttp=GetXmlHttpObject()
 
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="addreltracks.php"
url=url+"?no="+no
 
xmlHttp.onreadystatechange=stateChanged_reltracks
xmlHttp.open("GET",url,true)
xmlHttp.send(null) 
 }

function stateChanged_reltracks() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
	document.getElementById("trackslist").innerHTML=xmlHttp.responseText
	//code for slide
 } 
 else
 {
	 document.getElementById("trackslist").innerHTML="<div align='center' class=left><img src='images/ajax-loader.gif'></div>"
 }
}
/* --------------------*/

/* Forum threads */

function ShowThread(no,id)
{
 	xmlHttp=GetXmlHttpObject()
 
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url="threads.php"
url=url+"?no="+no
url=url+"&id="+id
xmlHttp.onreadystatechange=stateChanged_forum
xmlHttp.open("GET",url,true)
xmlHttp.send(null) 
 }

function stateChanged_forum() 
{ 
if (xmlHttp.readyState==4 || xmlHttp.readyState=="complete")
 { 
    document.getElementById("profile_sub_tab_show").style.display='none'
    document.getElementById("profile_sub_tab_hide").innerHTML=xmlHttp.responseText
 }
 else
 { 
	document.getElementById("profile_sub_tab_show").style.display='none'
	document.getElementById("profile_sub_tab_hide").innerHTML="<div align='center'  class=left><img src='images/ajax-loader.gif'></div>"
 }

}
/* --------------------*/

/*****************************************
********* dialog box *****************
*****************************************/
var ALERT_TITLE = "ElectricMotel.com";
var ALERT_BUTTON_TEXT = "Ok";
 
if(document.getElementById) {
	window.alert = function(txt) {
		createCustomAlert(txt);
	}
}
 
function createCustomAlert(txt) {
	d = document;
 
	if(d.getElementById("modalContainer")) return;
 
	mObj = d.getElementsByTagName("body")[0].appendChild(d.createElement("div"));
	mObj.id = "modalContainer";
	mObj.style.height = d.documentElement.scrollHeight + "px";
	
	alertObj = mObj.appendChild(d.createElement("div"));
	alertObj.id = "alertBox";
	if(d.all && !window.opera) alertObj.style.top = document.documentElement.scrollTop + "px";
	alertObj.style.left = (d.documentElement.scrollWidth - alertObj.offsetWidth)/2 + "px";
	alertObj.style.visiblity="visible";
 
	h1 = alertObj.appendChild(d.createElement("h1"));
	h1.appendChild(d.createTextNode(ALERT_TITLE));
 
	msg = alertObj.appendChild(d.createElement("p"));
	//msg.appendChild(d.createTextNode(txt));
	msg.innerHTML = txt;
 
	//btn = alertObj.appendChild(d.createElement("a"));
	//btn.id = "closeBtn";
	//btn.appendChild(d.createTextNode(ALERT_BUTTON_TEXT));
	//btn.href = "#";
	//btn.focus();
	//btn.onclick = function() { removeCustomAlert();return false; }
 
	alertObj.style.display = "block";
	setTimeout ( "removeCustomAlert()", 3000);
}
 
function removeCustomAlert() {
	document.getElementsByTagName("body")[0].removeChild(document.getElementById("modalContainer"));
}


/*****************************************
********* end of dialog box *****************
*****************************************/

 function ShowHide(i,tot){
	for(a=1;a<=tot;a++){
		document.getElementById("box"+a).style.display="none";
		document.getElementById("box"+a).style.visibility="hidden";
		//document.getElementById("box"+a).style.vis="none";
	}
	document.getElementById("box"+i).style.display="block";
	document.getElementById("box"+i).style.visibility="visible";
} 