/*

This lib for cross browser handling taken from http://www.alistapart.com/articles/popuplinks

extended version is at http://v2studio.com/k/code/lib/





ARRAY EXTENSIONS



push(item [,...,item])

    Mimics standard push for IE5, which doesn't implement it.





find(value [, start])

    searches array for value starting at start (if start is not provided,

    searches from the beginning). returns value index if found, otherwise

    returns -1;





has(value)

    returns true if value is found in array, otherwise false;





FUNCTIONAL



map(list, func)

    traverses list, applying func to list, returning an array of values returned

    by func



    if func is not provided, the array item is returned itself. this is an easy

    way to transform fake arrays (e.g. the arguments object of a function or

    nodeList objects) into real javascript arrays.



    map also provides a safe way for traversing only an array's indexed items,

    ignoring its other properties. (as opposed to how for-in works)



    this is a simplified version of python's map. parameter order is different,

    only a single list (array) is accepted, and the parameters passed to func

    are different:

    func takes the current item, then, optionally, the current index and a

    reference to the list (so that func can modify list)





filter(list, func)

    returns an array of values in list for which func is true



    if func is not specified the values are evaluated themselves, that is,

    filter will return an array of the values in list which evaluate to true



    this is a similar to python's filter, but parameter order is inverted





DOM



getElem(elem)

    returns an element in document. elem can be the id of such element or the

    element itself (in which case the function does nothing, merely returning

    it)



    this function is useful to enable other functions to take either an    element

    directly or an element id as parameter.



    if elem is string and there's no element with such id, it throws an error.

    if elem is an object but not an Element, it's returned anyway





hasClass(elem, className)

    Checks the class list of element elem or element of id elem for className,

    if found, returns true, otherwise false.



    The tested element can have multiple space-separated classes. className must

    be a single class (i.e. can't be a list).





getElementsByClass(className [, tagName [, parentNode]])

    Returns elements having class className, optionally being a tag tagName

    (otherwise any tag), optionally being a descendant of parentNode (otherwise

    the whole document is searched)





DOM EVENTS



listen(event,elem,func)

    x-browser function to add event listeners



    listens for event on elem with func

    event is string denoting the event name without the on- prefix. e.g. 'click'

    elem is either the element object or the element's id

    func is the function to call when the event is triggered



    in IE, func is wrapped and this wrapper passes in a W3CDOM_Event (a faux

    simplified Event object)





mlisten(event, elem_list, func)

    same as listen but takes an element list (a NodeList, Array, etc) instead of

    an element.





W3CDOM_Event(currentTarget)

    is a faux Event constructor. it should be passed in IE when a function

    expects a real Event object. For now it only implements the currentTarget

    property and the preventDefault method.



    The currentTarget value must be passed as a paremeter at the moment    of

    construction.





MISC CLEANING-AFTER-MICROSOFT STUFF



isUndefined(v)

    returns true if [v] is not defined, false otherwise



    IE 5.0 does not support the undefined keyword, so we cannot do a direct

    comparison such as v===undefined.

*/



// ARRAY EXTENSIONS



if (!Array.prototype.push) Array.prototype.push = function() {

    for (var i=0; i<arguments.length; i++) this[this.length] = arguments[i];

    return this.length;

}



Array.prototype.find = function(value, start) {

    start = start || 0;

    for (var i=start; i<this.length; i++)

        if (this[i]==value)

            return i;

    return -1;

}



Array.prototype.has = function(value) {

    return this.find(value)!==-1;

}



// FUNCTIONAL



function map(list, func) {

    var result = [];

    func = func || function(v) {return v};

    for (var i=0; i < list.length; i++) result.push(func(list[i], i, list));

    return result;

}



function filter(list, func) {

    var result = [];

    func = func || function(v) {return v};

    map(list, function(v) { if (func(v)) result.push(v) } );

    return result;

}





// DOM



function getElem(elem) {

    if (document.getElementById) {

        if (typeof elem == "string") {

            elem = document.getElementById(elem);

            if (elem===null) throw 'cannot get element: element does not exist';

        } else if (typeof elem != "object") {

            throw 'cannot get element: invalid datatype';

        }

    } else throw 'cannot get element: unsupported DOM';

    return elem;

}



function hasClass(elem, className) {

    return getElem(elem).className.split(' ').has(className);

}



function getElementsByClass(className, tagName, parentNode) {

    parentNode = !isUndefined(parentNode)? getElem(parentNode) : document;

    if (isUndefined(tagName)) tagName = '*';

    return filter(parentNode.getElementsByTagName(tagName),

        function(elem) { return hasClass(elem, className) });

}





// DOM EVENTS



function listen(event, elem, func) {

    elem = getElem(elem);

    if (elem.addEventListener)  // W3C DOM

        elem.addEventListener(event,func,false);

    else if (elem.attachEvent)  // IE DOM

        elem.attachEvent('on'+event, function(){ func(new W3CDOM_Event(elem)) } );

        // for IE we use a wrapper function that passes in a simplified faux Event object.

    else throw 'cannot add event listener';

}



function mlisten(event, elem_list, func) {

    map(elem_list, function(elem) { listen(event, elem, func) } );

}



function W3CDOM_Event(currentTarget) {

    this.currentTarget  = currentTarget;

    this.preventDefault = function() { window.event.returnValue = false }

    return this;

}



// MISC CLEANING-AFTER-MICROSOFT STUFF

function isUndefined(v) {

    var undef;

    return v===undef;

}



//<--lib ends



//Our functions starts....



//Open popup. Can be called directly

function Popup(url, target, features)

{

	var theWindow = window.open(url, target, features);

	theWindow.focus();

	return theWindow;

}

//Holder for Popup(). As it's to be registered with event listener

function PopupHolder(e)

{

	Popup(e.currentTarget.getAttribute('href'), e.currentTarget.getAttribute('target') || J_POPUP_TARGET, J_POPUP_FEATURES);

	e.preventDefault();

}

//show balloon. Can be called directly

function ShowBalloon(objA, x, y)

{

	gTmp_ATitle = objA.title; //preserve the title in global var

	objA.title = ''; //empty it, so that it won't popup

	var tmp_title = 'Help', tmp_desc = gTmp_ATitle, pos_colon; //safe init

	//e.g., gTmp_ATitle = 'Help: Help is a help...'

	if ((pos_colon=gTmp_ATitle.indexOf(':')) !=-1 )

		{

			tmp_title = gTmp_ATitle.substring(0, pos_colon);

			tmp_desc = gTmp_ATitle.substring(pos_colon+1);

		}

	var balloon = document.getElementById(J_BALLOON);

	balloon.className = J_CLSBALLOON;

	balloon.style.display = 'inline';

	balloon.style.width = J_BALLOONWIDTH + 'px';

	balloon.style.top = y + 'px';

	balloon.style.left = x + 'px';

	balloon.innerHTML = '<span class="' + J_CLSBALLOONTITTLE + '">'+ tmp_title +'<\/span><div class="' + J_CLSBALLOONDESC + '">'+ tmp_desc + '<\/div>';

	return true;

}

//Holder for ShowBalloon(). As it's to be registered with event listener

function ShowBalloonHolder(e)

{

	var posx = 0, posy = 0;

	if (e.pageX || e.pageY) //Moz

		{

			posx = e.pageX;

			posy = e.pageY;

		}

	 else if (event.clientX || event.clientY) //IE. Note: event.x not working fine

		{

			posx = event.clientX + document.body.scrollLeft;

			posy = event.clientY + document.body.scrollTop;

		}

	//Note: using the x, y as it is cause the div to flicker in certain border points in FF (IE, Opera works find).

	ShowBalloon(e.currentTarget, posx+J_BALLOONPOSADJX, posy+J_BALLOONPOSADJY);

	e.preventDefault();

}

//Hides balloon.

function HideBalloon(objA)

{

	var balloon = document.getElementById(J_BALLOON);

	balloon.style.display = 'none';

	objA.title = gTmp_ATitle; //re-assign

}

//Holder for HideBaloon. As it's to be registered with event listener

function HideBalloonHolder(e)

{

	HideBalloon(e.currentTarget);

	e.preventDefault();

}



//code execution starts here...



//global vars

var gTmp_ATitle; //temp variable to hold and swap title attributes

//global constants. Used to change behaviors quickly

//presumably IE doesn't support const on strings

var J_BALLOON = 'balloon'; //balloon id

var J_CLSHELP = 'clsHelp';

var J_CLSBALLOON = 'clsBalloon';

var J_CLSBALLOONTITTLE = 'clsBalloonTittle';

var J_CLSBALLOONDESC = 'clsBalloonDesc';

var J_BALLOONPOSADJX = 10;

var J_BALLOONPOSADJY = 10;

var J_POPUP_FEATURES = 'location=0,statusbar=0,menubar=0,width=400,height=300,top=200,left=200';

var J_POPUP_TARGET = 'help';

var J_BALLOONWIDTH = 160;



listen('load',

		window,

		function()

		{

			//create balloon div...

			var balloon = document.createElement('div');

			balloon.id = J_BALLOON;

			document.body.appendChild(balloon);

			//listen...

			mlisten('mouseover', getElementsByClass(J_CLSHELP,'a'), ShowBalloonHolder);

			mlisten('mouseout', getElementsByClass(J_CLSHELP,'a'), HideBalloonHolder);

			mlisten('click', getElementsByClass(J_CLSHELP,'a'), PopupHolder);

		}

	);



//	====Need cssQuery and Behaviour====



/**

 * @author		rajesh_04ag02

 * @copyright	Copyright (c) 2005-2006 {@link http://www.agriya.com Agriya Infoway}

 * @version		SVN: $Id: script.js 1309 2008-04-09 09:57:05Z sivaprakash_24ag07 $

 * @todo		Possibly replace help tips' libs with Behaviour

 */



//oh my, holy hack http://groups.google.com/group/comp.lang.javascript/msg/923c83ebf78b818a

//CSS2 browsers require 'table-row-group' to display tbody tag properly

//Note: if IE display.style is set to 'table-row-group', it will bug with "Error: Could not get the display property. Invalid argument."

var display_tbl_block = (document.all) ? 'block' : 'table-row-group';

var catch_rules =

	{

		//for admin/depositPlans.php toggling of options...

		'#adminuserProfilesEdit #usr_status' : function(element)

		{

			document.getElementById("activate_user_block").style.display = (element.value=="0-Ok") ? display_tbl_block : 'none';

			//onchange show it only for appropriate values...

			element.onchange = function()

			{

				document.getElementById("activate_user_block").style.display = (this.value=="0-Ok") ? display_tbl_block : 'none';

			}

		}

	};

//Behaviour.register(catch_rules);



//set the Email id to parent window through select from the child window

	function setEmailString(frmName, parentId, objName, typeName, charLength, parentMemberNameId, parentMemberCustID, extractName)

		{



			var frmObj = document.forms[frmName];

			var len = frmObj.elements.length;

			var custName = document.getElementsByName(extractName);

			var emailCustid = '';

			var emailName = '';



			for(i=0; i < len; i++) //>

				{

				 	varName = frmObj.elements[i].name;

				 	subName = varName.substring(0,charLength);

				 	if (subName == objName && frmObj.elements[i].type == typeName  && frmObj.elements[i].checked == true)

				 		{

				 			extractNameID = extractName+ '['+frmObj.elements[i].value +']';

							if (emailName == '')

								emailName = frmObj.elements[extractNameID].value;

							else

								emailName += ','+ frmObj.elements[extractNameID].value;





							if (emailCustid == '')

								emailCustid = frmObj.elements[i].value;

							else

								emailCustid += ','+ frmObj.elements[i].value;

						}

				 }



			window.opener.document.forms[parentId].elements[parentMemberNameId].value = emailName;

			window.opener.document.forms[parentId].elements[parentMemberCustID].value = emailCustid;

			window.opener.focus();

			window.close();

		}

function popupOldData(parentId, elementId, objName, frmName, previousElement)

	{



		listValue = window.opener.document.forms[parentId].elements[elementId].value;

		listValueArr = listValue.split(',');

		objectArr = document.getElementsByName(objName);

		listValueCnt = listValueArr.length;

		objectCnt = objectArr.length;

		for(i=0; i<= listValueCnt; i++)

			{

				for(j=0; j< objectCnt; j++)

					{

						if (listValueArr[i] == objectArr[j].value )

							objectArr[j].checked = true;

					}

			}



		len = document.forms[frmName].elements.length;

		for(i=0; i< len; i++)

			{

				if (document.forms[frmName].elements[i].name == previousElement)

					document.forms[frmName].elements[i].value = listValue;

			}

	}

function searchAlpha( frmName, elementName, val, changeName)

	{

		len = document.forms[frmName].elements.length;

		for(i=0; i< len; i++)

			{

				if (document.forms[frmName].elements[i].name == elementName)

					document.forms[frmName].elements[i].value = val;

				if (document.forms[frmName].elements[i].name == changeName)

					document.forms[frmName].elements[i].value = 1;

			}

		document.forms[frmName].submit();

	}

function PopupCv(url)

{

	var theWindow=window.open(url,'cvprofile','height=700,width=850,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

function PopupMembers(url)

{

	var theWindow = window.open(url,'members','height=400,width=760');

	theWindow.focus();

	return theWindow;

}



function PopupProfile(url)

{

	var theWindow = window.open(url,'userprofile','height=500,width=800,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

function PopupFP(url)

{

	var theWindow = window.open(url,'Message','height=550,width=850,scrollbars=auto');

	theWindow.focus();

	return theWindow;

}

function PopupPm(url)

{

	var theWindow = window.open(url,'Message','height=550,width=750,scrollbars=auto');

	theWindow.focus();

	return theWindow;

}



function PopProfileView(url)

{

	var theWindow = window.open(url,'Profile','height=700,width=1000,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}



function PopupNetwork(url)

{

	var theWindow = window.open(url,'Message','height=500,width=550,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}



function PopupEditForum(url)

{

	var theWindow = window.open(url,'editforum','height=600,width=600');

	theWindow.focus();

	return theWindow;

}

function PopupEditArticle(url)

{

	var theWindow = window.open(url,'userprofile','height=800,width=800,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}



function PopupAbuse(url)

{

	var theWindow = window.open(url,'abuse','height=325,width=425');

	theWindow.focus();

	return theWindow;

}



function PopupDetachForum(url)

{

	var theWindow = window.open(url,'detachforum','height=700,width=400,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

function PopupAdminDetach(url)

{

	var theWindow = window.open(url,'detachforum','height=700,width=700,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

// called in composeMessage.php, replyMessage.php, forwardMessage.php

function PopupInsertAddress(url)

{

	var theWindow = window.open(url,null,'height=1000,width=400,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

function PopupConnection(url)

{

	var theWindow = window.open(url,null,'height=600,width=800,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

function PopupConnectionForNewAddedFriend(url)

{

	var theWindow = window.open(url);

	theWindow.focus();

	return theWindow;

}


function PopUpLogin(url)

{

	var theWindow = window.open(url,'login','height=500,width=500,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

function PopUpUsage(url)

{

	var theWindow = window.open(url,'login','height=500,width=500,scrollbars=yes');

	theWindow.focus();

	return theWindow;

}

function PopUpUsageFull(url)

{

	var theWindow = window.open(url,'full','');

	theWindow.focus();

	return theWindow;

}

function PopAbuse(url)

{

	var theWindow = window.open(url,'login','');

	theWindow.focus();

	return theWindow;

}

function PopBanner(url)

{

	var theWindow = window.open(url,'login','menubar=no,toolbar=no');

	theWindow.focus();

	return theWindow;

}



// Function to select all check boxes

// called in inboxMessages.php, sentMessages.php, savedMessages.php, trashMessages.php

function selectAll(thisForm)

	{

		for (var i=0; i<thisForm.elements.length; i++)

			{

				if (thisForm.elements[i].type == "checkbox")

					{

						if(thisForm.checkall.checked)

							{

								thisForm.elements[i].checked=true;

							}

							else

								{

									thisForm.elements[i].checked=false;

								}

					}

			}

	}

// Funtion to get all selected emails and pass the value to the opener window

// called in composeMessage.php, replyMessage.php, forwardMessage.php

function exit ()

{

	id_to_populate='';

	name_to_populate='';

	id_count = document.getElementsByName('check[]');

	name_count = document.getElementsByName('names[]');

	for (var j = 0; j < id_count.length; j++)

		{

			if(id_count[j].checked)

				{

					id_to_populate =  id_to_populate + id_count[j].value+', ';

					name_to_populate =  name_to_populate + name_count[j].value+', ';

				}

		}

	opener.document.form_show_network.select_id.value = id_to_populate;

	opener.document.form_show_network.select_names.value = name_to_populate;

	self.close();

	return false;

}

// funtion to get the selecte emails to next pages

// called in composeMessage.php, replyMessage.php, forwardMessage.php

function storeSelectedIds()

{

	id_to_populate='';

	name_to_populate='';

	list_to_populate='';

	is_list = document.form_network.lists;

	id_count = document.getElementsByName('check[]');

	name_id_count = document.getElementsByName('names[]');

	for (var j = 0; j < id_count.length; j++)

		{

			if(id_count[j].checked)

				{

					id_to_populate =  id_to_populate + id_count[j].value+', ';

					name_to_populate =  name_to_populate + name_id_count[j].value+', ';

				}



		}

	document.page_nav.previous_selected_ids.value = id_to_populate;

	document.page_nav.previous_selected_names.value = name_to_populate;

	document.form_network.previous_selected_ids.value = id_to_populate;

	document.form_network.previous_selected_names.value = name_to_populate;

	//alert(document.form_network.previous_selected_ids.value);

	//alert(document.form_network.previous_selected_names.value);

}

//Funtion which called storeSelectedIds funtion and then submit the page with given URL

function storeAndSubmit(listval)

{

	storeSelectedIds();

	document.form_network.letter.value = '';

	document.form_network.lists.value = listval;

	//document.page_nav.lists.value = listval;

}

//To setfocus to subject textbox

//Funtions called in composeMessage.php, forwardMessage.php

function setSubjectFocus(thisForm)

{

	thisForm.subject.focus();

}

function showLetter(let)

{

	storeSelectedIds();

	document.form_network.letter.value = let;

	document.page_nav.start.value = 0;

	document.form_network.submit();

}

function PopupBlogSettings(url)

{

	var theWindow = window.open(url,'blogsettings','height=300,width=400');

	theWindow.focus();

	return theWindow;

}

function storeOpenerIds()

{

	document.form_network.previous_selected_ids.value = opener.document.form_show_network.select_id.value;

	document.form_network.previous_selected_names.value = opener.document.form_show_network.select_names.value;

}



// Functions for the PROFILE() in application top





function call_ajax_profile(div_id, count, path)

{

	new AGR_ajax(path,'show_table_profile', div_id);

}

function show_table_profile(data, div_id)

{

	data = unescape(data);

	var obj = document.getElementById(div_id);

//	alert(data);

	obj.innerHTML = data;

}



function changeProfilelayerChat(count, custid)

{

/*

	var parid

	parid = "hiddenIdToClose" + count;

	alert(parid);

	var hidden = document.getElementById(parid);

	alert(hidden);

	hidden.innerHTML = "<input type='hidden' name='closeid' id='closeid' value='"+count+"' />";

	alert(hidden.innerHTML);

	*/

	//popup_blocks_arr = popup_blocks.split(',');

//	var popup_blocks_length = popup_blocks_arr.length;

	//popup_blocks_length = popup_blocks_length;



	//for(var i=0;i<popup_blocks_length;i++)

	//	{

		//	if(obj = document.getElementById('selProfilePopup'+popup_blocks_arr[i]))

			///	{

					//if(obj.style.display=='block')

					//	{

							//obj.style.display='none';

					//	}

				//}

		//}

	//alert(popup_blocks);

	//backgnd effect



	/*var bcgid = document.getElementById("selProfileLayer");

	bcgid.style.MozOpacity = 0.7;

	bcgid.style.Opacity = 0.7;

	bcgid.style.filter = "Alpha(Opacity=70)";*/



	// end

	last_open_popup = 'selProfilePopup'+count;

	var id = "selProfilePopup" + count;

	var c = document.getElementById(id);

	c.innerHTML = "";

	call_ajax_profile('selProfilePopup'+count, count, 'ajaxMemberDetails.php?custid='+custid+'&count='+count);

	var closeid = document.getElementById("closeid");



	if (closeid == null || closeid == undefined)

		{}

	else

	{

		var valclose = closeid.value;

		var id = "selProfilePopup" + valclose;

		var a = document.getElementById(id);

		//alert(a.innerHTML);

		a.style.display = "none";

		id = "hiddenIdToClose" + valclose;

		var hidden = document.getElementById(id);

		hidden.innerHTML = "";



	}

	id = "hiddenIdToClose" + count;

	//alert(id);

	var hidden = document.getElementById(id);

	//alert(hidden);

	c.style.display = "inline";

}





//var last_open_popup = '';

function changeProfilelayer(count, custid)

{

/*

	var parid

	parid = "hiddenIdToClose" + count;

	alert(parid);

	var hidden = document.getElementById(parid);

	alert(hidden);

	hidden.innerHTML = "<input type='hidden' name='closeid' id='closeid' value='"+count+"' />";

	alert(hidden.innerHTML);

	*/

	popup_blocks_arr = popup_blocks.split(',');

	var popup_blocks_length = popup_blocks_arr.length;

	popup_blocks_length = popup_blocks_length;



	for(var i=0;i<popup_blocks_length;i++)

		{

			if(obj = document.getElementById('selProfilePopup'+popup_blocks_arr[i]))

				{

					//if(obj.style.display=='block')

					//	{

							obj.style.display='none';

					//	}

				}

		}

	//alert(popup_blocks);

	//backgnd effect



	/*var bcgid = document.getElementById("selProfileLayer");

	bcgid.style.MozOpacity = 0.7;

	bcgid.style.Opacity = 0.7;

	bcgid.style.filter = "Alpha(Opacity=70)";*/



	// end

	last_open_popup = 'selProfilePopup'+count;

	var id = "selProfilePopup" + count;

	var c = document.getElementById(id);

	c.innerHTML = "";

	call_ajax_profile('selProfilePopup'+count, count, 'ajaxMemberDetails.php?custid='+custid+'&count='+count);

	var closeid = document.getElementById("closeid");



	if (closeid == null || closeid == undefined)

		{}

	else

	{

		var valclose = closeid.value;

		var id = "selProfilePopup" + valclose;

		var a = document.getElementById(id);

		//alert(a.innerHTML);

		a.style.display = "none";

		id = "hiddenIdToClose" + valclose;

		var hidden = document.getElementById(id);

		hidden.innerHTML = "";



	}

	id = "hiddenIdToClose" + count;

	//alert(id);

	var hidden = document.getElementById(id);

	//alert(hidden);

	c.style.display = "inline";

}

function hideProfilelayer(count)

{

	/*var bcgid = parent.document.getElementById("selProfileLayer");

	bcgid.style.MozOpacity = 1;

	bcgid.style.Opacity = 1;

	bcgid.style.filter = "Alpha(Opacity=10)";*/

	id = "hiddenIdToClose" + count;

	var hidden = parent.document.getElementById(id);

	hidden.innerHTML = "";



	var id = "selProfilePopup" + count;

	var a = parent.document.getElementById(id);

	a.style.display = "none";

}

function hideProfilelayerchat(count)

{

	/*var bcgid = parent.document.getElementById("selProfileLayer");

	bcgid.style.MozOpacity = 1;

	bcgid.style.Opacity = 1;

	bcgid.style.filter = "Alpha(Opacity=10)";*/

	id = "hiddenIdToClose" + count;

	var hidden = parent.document.getElementById(id);

	hidden.innerHTML = "";



	var id = "selProfileContent";

	var a = parent.document.getElementById(id);

	a.style.display = "none";

}



function hideMessagelayer()

{

	var id = "selMessageContent";

	var a = parent.document.getElementById(id);

	a.style.display = "none";

}

function changeProfilesub(a,b)

{

	var id = "selProfileBio"+b;

	var bio = document.getElementById(id);

	id = "selProfileProfession"+b;

	var prof = document.getElementById(id);

	id = "selProfileMacInterest"+b

	var mac = document.getElementById(id);

	id = "selProfileSchools"+b;

	var school = document.getElementById(id);

	//id = "selProfileGroups"+b;

	//var group = document.getElementById(id);

	id = "selProfileBioFull"+b;

	var bioFull = document.getElementById(id);

	id = "selProfileMacInterestFull"+b;

	var macFull = document.getElementById(id);

	id = "selProfileSchoolsFull"+b;

	var schoolFull = document.getElementById(id);

	//id = "selProfileGroupsFull"+b;

	//var groupFull = document.getElementById(id);

	bio.style.display = "none";

	prof.style.display = "none";

	mac.style.display = "none";

	school.style.display = "none";

	//group.style.display = "none";

	bioFull.style.display = "none";

	macFull.style.display = "none";

	schoolFull.style.display = "none";

	//groupFull.style.display = "none";

	if(a == 1)

		bio.style.display = "block";

	else if(a == 2)

		mac.style.display = "block";

	else if(a == 3)

		school.style.display = "block";

	else if(a == 4)

		group.style.display = "block";

	else if(a == 5)

		bioFull.style.display = "block";

	else if(a == 6)

		macFull.style.display = "block";

	else if(a == 7)

		schoolFull.style.display = "block";

	else if(a == 8)

		groupFull.style.display = "block";

	else if(a == 9)

		prof.style.display = "block";

	id = "selInterestNav"+b;

	var nav = document.getElementById(id);

	if((a == 1) || (a == 5))

		{

			nav.innerHTML = "<ul><li class=\"clsProfileBio\" id=\"selActiveProfileLink\" onclick=\"changeProfilesub(1,"+b+");\"><a href=\"javascript: var dummy = 0;\">Bio</a></li><li class=\"clsProfileProfession\" onClick=\"changeProfilesub(9,"+b+");\"><a href=\"javascript: var dummy = 0;\">Education</a></li><li class=\"clsProfileMacInterest\" onclick=\"changeProfilesub(2,"+b+");\"><a href=\"javascript: var dummy = 0;\">Profession</a></li><li class=\"clsProfileSchools\" onclick=\"changeProfilesub(3,"+b+");\"><a href=\"javascript: var dummy = 0;\">Schools</a></li></ul>";

		}

	else if((a == 2) || (a == 6))

		{

			nav.innerHTML = "<ul><li class=\"clsProfileBio\" onclick=\"changeProfilesub(1,"+b+");\"><a href=\"javascript: var dummy = 0;\">Bio</a></li><li class=\"clsProfileProfession\" onClick=\"changeProfilesub(9,"+b+");\"><a href=\"javascript: var dummy = 0;\">Education</a></li><li class=\"clsProfileMacInterest\" id=\"selActiveProfileLink\" onclick=\"changeProfilesub(2,"+b+");\"><a href=\"javascript: var dummy = 0;\">Profession</a></li><li class=\"clsProfileSchools\" onclick=\"changeProfilesub(3,"+b+");\"><a href=\"javascript: var dummy = 0;\">Schools</a></li></ul>";

		}

	else if((a == 3) || (a == 7))

		{

			nav.innerHTML = "<ul><li class=\"clsProfileBio\" onclick=\"changeProfilesub(1,"+b+");\"><a href=\"javascript: var dummy = 0;\">Bio</a></li><li class=\"clsProfileProfession\" onClick=\"changeProfilesub(9,"+b+");\"><a href=\"javascript: var dummy = 0;\">Education</a></li><li class=\"clsProfileMacInterest\" onclick=\"changeProfilesub(2,"+b+");\"><a href=\"javascript: var dummy = 0;\">Profession</a></li><li class=\"clsProfileSchools\" id=\"selActiveProfileLink\" onclick=\"changeProfilesub(3,"+b+");\"><a href=\"javascript: var dummy = 0;\">Schools</a></li></ul>";

		}

	else if((a == 4) || (a == 8))

		{

			nav.innerHTML = "<ul><li class=\"clsProfileBio\" onclick=\"changeProfilesub(1,"+b+");\"><a href=\"javascript: var dummy = 0;\">Bio</a></li><li class=\"clsProfileProfession\" onClick=\"changeProfilesub(9,"+b+");\"><a href=\"javascript: var dummy = 0;\">Education</a></li><li class=\"clsProfileMacInterest\" onclick=\"changeProfilesub(2,"+b+");\"><a href=\"javascript: var dummy = 0;\">Profession</a></li><li class=\"clsProfileSchools\" onclick=\"changeProfilesub(3,"+b+");\"><a href=\"javascript: var dummy = 0;\">Schools</a></li></ul>";

		}

	else if((a == 9))

		{

			nav.innerHTML = "<ul><li class=\"clsProfileBio\" onclick=\"changeProfilesub(1,"+b+");\"><a href=\"javascript: var dummy = 0;\">Bio</a></li><li class=\"clsProfileProfession\" id=\"selActiveProfileLink\" onClick=\"changeProfilesub(9,"+b+");\"><a href=\"javascript: var dummy = 0;\">Education</a></li><li class=\"clsProfileMacInterest\" onclick=\"changeProfilesub(2,"+b+");\"><a href=\"javascript: var dummy = 0;\">Profession</a></li><li class=\"clsProfileSchools\" onclick=\"changeProfilesub(3,"+b+");\"><a href=\"javascript: var dummy = 0;\">Schools</a></li></ul>";

		}

}





function call_lost_password_form()

	{

		document.getElementById('lostPwd').style.display='';

		new AGR_ajax('forgotPassword_ajax.php','show_lost_password_form', 'lostPwd');

	}



function show_lost_password_form(data, div_id)

	{

		data = unescape(data);

		var obj = document.getElementById(div_id);

		obj.innerHTML = data;

	}

function call_close_popup_submit()

	{

		document.getElementById('lostPwd').style.display='none';

	}

function call_lost_password_submit()

	{

		var username = document.getElementById('username').value;

		new AGR_ajax('forgotPassword_ajax.php?username='+username+'&forgot_submit=forgot_submit','show_lost_password_form', 'lostPwd');

	}



var data;

var div_id;

var replace_word = "check||||||||||valid||||||||login";

var find_word = "heck||||||||||valid||||||||login";

function AGR_xml(url, cmd)

	{

		if(url.length<=0 || cmd.length<=0)

			{

				alert("Error: Unable to Found the URL");return false;

			}

		this.url = url;

		this.cmd = cmd;

		this.result = "";

		this.req = null;

		if (window.XMLHttpRequest)

			{

				var req = new XMLHttpRequest();

				if (req.overrideMimeType)

					{

						req.overrideMimeType('text/html');

				 	}

			}

			else if (window.ActiveXObject)

				{

					req = new ActiveXObject("Microsoft.XMLHTTP");

				}

		this.req = req;

		return true;

	}



function AGR_post_xml(url,cmd, fieldValues)

	{

		this.output = "NoRecords";

		var x = new AGR_xml(url,cmd);

		x.popen();

		try

			{

				x.req.onreadystatechange = function()

					{

						if (x.req.readyState==4)

							{

								if(x.req.status==200)

									{

										if(x.req.responseText)

											{

												x.result = escape(x.req.responseText);

												x.getOp();

											}

									}

							}

					}

			}

		catch(e){}

		x.psend(AGR_getURI(fieldValues));

		return true;

	}



function AGR_ajax(url,cmd,div_id)

	{

		this.output = "NoRecords";

		var x = new AGR_xml(url,cmd);

		x.opens();

		try

			{

				x.req.onreadystatechange = function()

					{

						if (x.req.readyState==4)

							{

								if(x.req.status==200)

									{

										if(x.req.responseText)

											{

												x.result = escape(x.req.responseText);

												x.getOp(div_id);

											}

									}

							}

					}

			}

		catch(e){}

		x.sends();

	}



AGR_xml.prototype.opens = function()

	{

		this.req.open("GET", this.url, true);

	}



AGR_xml.prototype.sends = function()

	{

		this.req.send(null);

	}



AGR_xml.prototype.popen = function()

	{

		this.req.open("POST", this.url, true);

	}



AGR_xml.prototype.psend = function(p)

	{

		this.req.setRequestHeader("Content-Type","application/x-www-form-urlencoded; charset=UTF-8");

		this.req.setRequestHeader("Content-length",p.length);

		this.req.send(unescape(p));

	}



AGR_xml.prototype.getOp=function(div_id)

	{

		if(arguments.length>1)

			{

				//this.cmd = arguments[0];

				//alert(this.cmd+"(\""+this.result+"\",\""+div_id+"\")");

			}

			eval(this.cmd+"(\""+this.result+"\",\""+div_id+"\")");return;

		//eval(this.cmd+"(\""+this.result+"\")");

	}

function showMassInvitation()

    {

		if(document.getElementById('sendmassinvitation').style.display == 'block')

            {

                document.getElementById('sendmassinvitation').style.display = 'none';

            }

        else

            document.getElementById('sendmassinvitation').style.display = 'block';

    }



function showGroupInvitation()

    {

		if(document.getElementById('sendgroupinvitation').style.display == 'block')

            {

                document.getElementById('sendgroupinvitation').style.display = 'none';

            }

        else

            document.getElementById('sendgroupinvitation').style.display = 'block';

    }



function addSelectOption(theSelSrc, theSelDesc, theSelSrc2, theTextWithKey, theSelectedRemove)

{

  var SrcId = document.getElementById(theSelSrc);

  for (var Srci=0; Srci < SrcId.options.length; Srci++) {

	  var objOptionadd = true;

 	  if (SrcId.options[Srci].selected)  {

		  var theText = SrcId.options[Srci].text;

		  var theValue = SrcId.options[Srci].value;



		  if (theSelSrc2)

		  {

			  var Src2Id = document.getElementById(theSelSrc2);

			  if (Src2Id.selectedIndex >= 0)  {

				  var theText2 = Src2Id.options[Src2Id.selectedIndex].text;

				  var theValue2 = Src2Id.options[Src2Id.selectedIndex].value;



				  theText = theText + ' - ' + theText2;

				  theValue = theValue + ' - ' + theValue2;

			  } else {

				  alert("Please select the source 2 fields");

				  return false;

			  }

		  }

		  //For checking the value already added or not...

		  for (var i=0; i < document.getElementById(theSelDesc).options.length; i++) {

				if(document.getElementById(theSelDesc).options[i].value == theValue)

					objOptionadd = false;

			}



		  if (objOptionadd)	{

			  if (theTextWithKey == true)

					theText = theValue + " - " + theText;

			  var newOpt = new Option(theText, theValue);

			  var selLength = document.getElementById(theSelDesc).length;

			  document.getElementById(theSelDesc).options[selLength] = newOpt;

		  }

	  }

   }



	if (theSelectedRemove){

	   for (var Srci=0; Srci < SrcId.options.length; Srci++) {

		  if (SrcId.options[Srci].selected)  {

				SrcId.options[Srci] = null;

				Srci--;

		  }

		}

	}

}



function deleteSelectOption(theSel, theSelSrc)

{

    var selLength = theSel.length;

	for (var i=0; i < selLength; i++) {

		if (theSel.options[i]) {

			if (theSel.options[i].selected) {

				if (theSelSrc) {

					var selSrcLength = theSelSrc.length;

					theSelSrc.options[selSrcLength] = new Option(theSel.options[i].text, theSel.options[i].value);

				}

				theSel.options[i] = null;

				i--;

			}

		}

	}



}



function getes()

{

	var selLength = document.forminvite.introid2.length;

	for(var i= selLength-1; i >= 0; i--)

	{

	document.forminvite.introid2.options[i].selected='true';

	}

}

// End of functions