var recs = new Array();

var count = 0;
var del = 0;


function count_person(id)

{

	var id = document.getElementById(id).value;	

	alert(id);	
}

function SendPopup(member_id)

{

	window.open('/send_popup.php?to='+member_id, member_id, 'toolbar=no, resizable=no, status=yes, width=320, height=200');

}

function ForwardFriend(member_id)

{

	window.open('/forward_frnd.php?profile_id='+member_id, member_id, 'toolbar=no, resizable=no, status=yes, width=320, height=175');

}



function ReceivePopup(member_id)

{

	recs[member_id] = window.open('/receive_popup.php?from='+member_id, member_id, 'toolbar=no, scrollbars=yes, status=yes, resizable=no, width=320, height=150');

}

function ReceiveAlertPopup(alert_id)

{
	
	window.open('/receive_alert_popup.php?popup_alert_id='+alert_id, alert_id, 'toolbar=no, scrollbars=yes, status=yes, resizable=no, width=320, height=150');

}

function ReceiveSmily(member_id)

{

	recs[member_id] = window.open('/receive_smily.php?from='+member_id, member_id, 'toolbar=no, scrollbars=yes, status=yes, resizable=no, width=320, height=150');

}


function SendKiss(member_id)

{
	window.open('/send_kiss.php?to='+member_id, member_id, 'toolbar=no, resizable=no, status=yes, width=320, height=175');

}



function ReceiveKiss(member_id)

{
	recs[member_id] = window.open('/receive_kiss.php?from='+member_id, member_id, 'toolbar=no, scrollbars=yes, status=yes, resizable=no, width=320, height=150');

}


function SendEmotion(member_id)

{
	window.open('/send_emotions.php?to='+member_id, member_id, 'toolbar=no,scrollbars=yes, resizable=no, status=yes, width=350, height=450');

}

function SendChat(member_id)

{

alert("Your Chat Request has been Send...");

	ChatXmlHttp = GetScriptXmlHttpObject();


	if(ChatXmlHttp == null)

	{

		alert("Browser doesn't support HTTP Requests!");

		return;

	}

  var url = "/start_chat.php?chat_on=" + member_id ;
	ChatXmlHttp.open("GET",url,true);

	ChatXmlHttp.send(null);

}

function ReceiveChat(member)

{

count = 0 ;


    	var name=confirm(member + " wants to chat");
		if(name==true)
	  	{	
	  		st = 'A' ;
	  	}
		else
	  	{
			st = 'D' ; 
	   	}
	ChatAckXmlHttp = GetScriptXmlHttpObject();

	if(ChatAckXmlHttp == null)

	{

		alert("Browser doesn't support HTTP Requests!");

		return;

	}



	var url = "start_chat.php?ack=" + member+"&st="+st ;

	try{
	ChatAckXmlHttp.open("GET",url,true);

	ChatAckXmlHttp.send(null); 
	}
	catch (e){
		alert ('error= ' + e);
	}
}
function redirect ()
{
window.location.href = "http://www.buzz2hype.com/chat/";


}
function Starts_Chat(member_id,status)

{
	
	if(status == 'A' && member_id != '')
	 {
		ChatRepXmlHttp = GetScriptXmlHttpObject();
		if(ChatRepXmlHttp == null)
		{
			alert("Browser doesn't support HTTP Requests!");
			return;
		}
		var url = "start_chat.php?ack=" + member_id+"&start=start" ;
	
		ChatRepXmlHttp.open("GET",url,true);
		ChatRepXmlHttp.send(null); 

		recs[member_id] = redirect ();
	 }
	 else if(status == 'D' && member_id != '')
	   {
		   ChatRepXmlHttp = GetScriptXmlHttpObject();
		if(ChatRepXmlHttp == null)
		{
			alert("Browser doesn't support HTTP Requests!");
			return;
		}
		var url = "start_chat.php?ack=" + member_id+"&start=delet" ;
	// window.open("chat.php?ack=" + member_id+"&start=delet", member_id, 'toolbar=no, scrollbars=yes, status=yes, resizable=no, width=500, height=500'); 
	
		ChatRepXmlHttp.open("GET",url,true);
		ChatRepXmlHttp.send(null); 
		
   
		 alert(member_id+ " denies your request ");  
		}
	else if(status == 'S'  && member_id != '')
	   {
		   ChatRepXmlHttp = GetScriptXmlHttpObject();
			if(ChatRepXmlHttp == null)
			{
				alert("Browser doesn't support HTTP Requests!");
				return;
			}
			var url = "start_chat.php?ack=" + member_id+"&start=started" ;
		// window.open('chat.php?ack='+ member_id+'&start=started', member_id, 'toolbar=no, scrollbars=yes, status=yes, resizable=no, width=500, height=500'); 
		   ChatRepXmlHttp.open("GET",url,true);
			ChatRepXmlHttp.send(null); 

		recs[member_id] = redirect ();
        }

}

function up_replaceAlpha( strIn )
{
	var strOut = "";
	for( var i = 0 ; i < strIn.length ; i++ )
	{
		var cChar = strIn.charAt(i);
		if( ( cChar >= 'A' && cChar <= 'Z' )
			|| ( cChar >= 'a' && cChar <= 'z' )
			|| ( cChar >= '0' && cChar <= '9' ) )
		{
			strOut += cChar;
		}
		else
		{
			strOut += "_";
		}
	}
	
	return strOut;
}

function GetScriptXmlHttpObject()
{
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;
}

function SetOpacity(obj, value)

{

	obj.style.MozOpacity = value/10;

	obj.style.KhtmlOpacity = value/10;

	obj.style.opacity = value/10;

	obj.style.filter = 'alpha(opacity=' + value*10 + ')';

}
function Fade(objid, start, end, sec)

{

	if(start == null)

		start = 0;

	if(end == null)

		end = 10;

	if(sec == null)

		sec = 2500;

	

	var speed = Math.round(sec/100);

	var timer = 0;

	

	obj = document.getElementById(objid);

	

	SetOpacity(obj, start);

	obj.style.display = 'block';

	if(start <= 0)

		start = 1;

	

	if(start < end)

	{

		for(i=start*10; i<=end*10; i++)

		{

			val = i/10;

			TIMER = setTimeout("_opac('" + objid + "', " + val + ")", (timer * speed));

			timer++;

		}

	}

	else if(start > end)

	{

		for(i=start*10; i>=end*10; i--)

		{

			val = i/10;

			TIMER = setTimeout("_opac('" + objid + "', " + val + ")", (timer * speed));

			timer++;

		}

	}

}



function _opac(id, value)

{

	obj = document.getElementById(id);

	SetOpacity(obj, value);

	if(value == 0)

		obj.style.display = 'none';

}



function SendFlash(member)

{
	try{
	FlashfXmlHttp = GetScriptXmlHttpObject()
	}
	catch (e)	{
		alert ('error= ' + e);
	}
//alert ('flash= ' + FlashXmlHttp);
	if(FlashfXmlHttp == null)

	{

		alert("Browser doesn't support HTTP Requests!");

		return;

	}

	
	var url = "/flash.php?flash_on=" + member;
	//alert ('url= ' + url);
	FlashfXmlHttp.open("GET",url,true);

	FlashfXmlHttp.send(null);


	alert("FLASHED...");

}



function ReceiveFlash(member)

{

	alert(member + " has flashed on you");

	FlashAckXmlHttp = GetScriptXmlHttpObject()

	if(FlashAckXmlHttp == null)

	{

		alert("Browser doesn't support HTTP Requests!");

		return;

	}

	

	var url = "flash.php?ack=" + member;

	

	FlashAckXmlHttp.open("GET",url,true);

	FlashAckXmlHttp.send(null);

}

function Flash()

{

	document.getElementById('flash').style.left = ((screen.width - document.getElementById('flash_img').style.width) / 2) - 50;

	document.getElementById('flash').style.top = ((screen.height - document.getElementById('flash_img').style.height) / 2) - (document.body.scrollTop + 200);

	FadeFor('flash', 0, 7.5, 2500, 2500, 5000);

}



function checkmultipalselection(id,value)

{

	var val = document.getElementById(id).options[document.getElementById(id).selectedIndex].value;

	var index = document.getElementById(id).selectedIndex;

	if(val == '')

	{

		document.getElementById(id).selected = false

		document.getElementById(id).selectedIndex = 0;

	}


}
