Array.prototype.findIdx = function(value){
for(var i=0; i < this.length; i++){
if(this[i] == value){
return i;
}}}


function updateBiographyData(){
	document.editBiography.siteMasterBiography.value = "true"
	document.editBiography.submit();
}

function sharePost(){
	/*alert('pooja')
	if(type == "event"){document.getElementById("modalShareEvent").style.display = "inline"}
	else if (type == "news"){document.getElementById("modalShareNews").style.display = "inline"}
	else if (type == "audio"){document.getElementById("modalShareAudio").style.display = "inline"}
	else if (type == "photo"){document.getElementById("modalSharePhoto").style.display = "inline"}
	else if (type == "video"){document.getElementById("modalShareVideo").style.display = "inline"}*/
	scroll(0,0);
	document.getElementById("modalShare").style.display = "inline"

}

function sharePostPag(path,title){
	document.shareEmail.shareLink.value = path
	document.getElementById("googleLink").href = 'http://www.google.com/bookmarks/mark?op=edit&bkmk=' + escape(path) + '&title=' + escape(title)	
document.getElementById("redditLink").href = 'http://reddit.com/submit?url=' + escape(path) + '&title=' + escape(title)	
document.getElementById("buzzLink").href = 'http://buzz.yahoo.com/submit?submitUrl=' + escape(path) + '&submitHeadline=' +escape(title)	
document.getElementById("linkagogoLink").href = 'http://www.linkagogo.com/go/AddNoPopup?title=' + escape(title) + '&url=' + escape(path)	
document.getElementById("simpyLink").href = 'http://simpy.com/simpy/LinkAdd.do?note=' + escape(title) + '&href=' + escape(path)	
document.getElementById("deliciousLink").href = 'http://del.icio.us/post?url='  + escape(path) + '&title=' + escape(title)
document.getElementById("linkedInLink").href = 'http://www.linkedin.com/shareArticle?mini=true&url=' + escape(path) + '&title=' + escape(title) + '&ro=false&summary=&source=' 	
document.getElementById("squidooLink").href = 'http://www.squidoo.com/lensmaster/bookmark?' + escape(path)
document.getElementById("diggLink").href = 'http://digg.com/submit?url=' + escape(path) + '&title=' + escape(title) 	
document.getElementById("liveLink").href = 'https://favorites.live.com/quickadd.aspx?url=' + escape(path) + '&title=' + escape(title) 
document.getElementById("stumbleUponLink").href = 'http://www.stumbleupon.com/submit?url=' + escape(path) + '&title=' + escape(title) 	
document.getElementById("diigoLink").href = 'http://www.diigo.com/post?url=' + escape(path) + '&title=' + escape(title) 	
document.getElementById("mixxLink").href = 'http://www.mixx.com/submit?page_url='+ escape(path) 
document.getElementById("technoratiLink").href = 'http://technorati.com/faves?add='+ escape(path)
document.getElementById("facebookLink").href = 'http://www.facebook.com/sharer.php?u=' + escape(path) + '&t=' + escape(title)	
document.getElementById("myspaceLink").href = 'http://www.myspace.com/Modules/PostTo/Pages/?l=3&u=' + escape(path) + '&t=' + escape(title)	
document.getElementById("twitterLink").href = 'http://twitter.com/home?status=' +escape(path)	
document.getElementById("feedMeLinksLink").href ='http://feedmelinks.com/categorize?from=toolbar&op=submit&name=' +  escape(title) + '&url= ' + escape(path)	
document.getElementById("netvouzLink").href = 'http://www.netvouz.com/action/submitBookmark?url=' + escape(path) + '&title=' + escape(title) +'&popup=no' 	
document.getElementById("yahooLink").href = 'http://myweb2.search.yahoo.com/myresults/bookmarklet?t=' + escape(title) + '&u=' + escape(path)	
document.getElementById("furlLink").href = 'http://www.furl.net/storeIt.jsp?t=' + escape(title) + '&u=' + escape(path)
document.getElementById("newsvineLink").href = 'http://www.newsvine.com/_wine/save?popoff=0&u=' + escape(path) + '&h=' + escape(title)
	/*alert('pooja')
	if(type == "event"){document.getElementById("modalShareEvent").style.display = "inline"}
	else if (type == "news"){document.getElementById("modalShareNews").style.display = "inline"}
	else if (type == "audio"){document.getElementById("modalShareAudio").style.display = "inline"}
	else if (type == "photo"){document.getElementById("modalSharePhoto").style.display = "inline"}
	else if (type == "video"){document.getElementById("modalShareVideo").style.display = "inline"}*/
	scroll(0,0);
	document.getElementById("modalSharePag").style.display = "inline"

}

//START ADD FAN
function addFan(profileID,fanID){
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");

var fanReturn = profileVar.addFan(profileID,fanID);

document.getElementById('becomeAFan1').style.display = 'none';
document.getElementById('becomeAFan2').style.display = 'none';
document.getElementById('removeFan1').style.display = '';
document.getElementById('removeFan2').style.display = '';

window.location.href=window.location;

//document.getElementById('firstFan').innerHTML = '<a href="profile.cfm?id='+fanID+'&profile=yes"><img src="'+fanReturn.DATA[0][fanReturn.COLUMNS.findIdx("IMAGE")]+'.jpg" width="54" height="54" style="border:1px solid #9ea9b9;"/></a>';

}
//END ADD FAN

//START ADD FRIEND
function addFriend(profileID,friendID,approved){
	
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");
var friendReturn = profileVar.addFriend(profileID,friendID,approved);

document.getElementById('becomeAFriend1').style.display = 'none';
document.getElementById('becomeAFriend2').style.display = 'none';
//document.getElementById('removeFriend1').style.display = '';
//document.getElementById('removeFriend2').style.display = '';

window.location.href=window.location;

//document.getElementById('firstFan').innerHTML = '<a href="profile.cfm?id='+fanID+'&profile=yes"><img src="'+fanReturn.DATA[0][fanReturn.COLUMNS.findIdx("IMAGE")]+'.jpg" width="54" height="54" style="border:1px solid #9ea9b9;"/></a>';

}
//END ADD FRIEND

//START ACCEPT FRIEND
function acceptFriend1(profileID,friendID){
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");

var friendReturn = profileVar.acceptFriend(profileID,friendID,'true');
window.location.href=window.location;

//document.getElementById('firstFan').innerHTML = '<a href="profile.cfm?id='+fanID+'&profile=yes"><img src="'+fanReturn.DATA[0][fanReturn.COLUMNS.findIdx("IMAGE")]+'.jpg" width="54" height="54" style="border:1px solid #9ea9b9;"/></a>';

}
//END ACCEPT FRIEND

//START DECLINE FRIEND
function declineFriend(profileID,friendID){
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");

var friendReturn = profileVar.declineFriend(profileID,friendID);
window.location.href=window.location;

//document.getElementById('firstFan').innerHTML = '<a href="profile.cfm?id='+fanID+'&profile=yes"><img src="'+fanReturn.DATA[0][fanReturn.COLUMNS.findIdx("IMAGE")]+'.jpg" width="54" height="54" style="border:1px solid #9ea9b9;"/></a>';

}

//END DECLINE FRIEND
//START REMOVE FAN
function removeFan(profileID,fanID){
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");

profileVar.removeFan(profileID,fanID);

document.getElementById('becomeAFan1').style.display = '';
document.getElementById('becomeAFan2').style.display = '';
document.getElementById('removeFan1').style.display = 'none';
document.getElementById('removeFan2').style.display = 'none';

window.location.href=window.location;


}
//END REMOVE FAN

//START REMOVE FRIEND
function removeFriend(profileID,friendID){
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");

profileVar.removeFriend(profileID,friendID);

window.location.href=window.location;


}

//END REMOVE FRIEND




//START REMOVE ITEM
function removeItem(div,type,id){

var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");

	if(confirm("Do you really want to Delete this?")){
		profileVar.removeItem(type,id);
		document.getElementById(div).style.display = 'none';
	}

}
//END REMOVE ITEM





//START ADD FAVORITES
function addFavorite(type,id,userType,userId,favType){
//Define variables
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");

profileVar.addFavorite(type,id);
if(type == 'audio'){
	if(favType == 'audio'){
		pagination(1,'favoriteActionAudio',type,'','','0',userType,'no',userId);
	}else{
		pagination(1,'favoriteActionAlbum',type,'','','0',userType,'no',userId);
	}
}else{
pagination(1,'favoriteAction',type,'','','0',userType,'no',userId);
}
}
//START ADD FAVORITES





//START REMOVE FAVORITES
function removeFavorite(type,id,userType,userId,favType){
//Define variables
var profileVar = new profileClass;
profileVar.setHTTPMethod("POST");
profileVar.removeFavorite(type,id);
if(type == 'audio'){
	if(favType == 'audio'){
		pagination(1,'favoriteActionAudio',type,'','','0',userType,'no',userId);
	}else{
		pagination(1,'favoriteActionAlbum',type,'','','0',userType,'no',userId);
	}
}else{
pagination(1,'favoriteAction',type,'','','0',userType,'no',userId);
}

}
//START REMOVE FAVORITES