
function MM_openBrWindow(theURL,winName,features) { 

	window.open(theURL,winName,features);
}
function moreResources() {
	MM_openBrWindow('http://www.lyricsfreak.com/','lyrics freak','')
}
function getElement(id) {
	
	if (document.getElementById) { // test the most common method first. Most browsers won't get past this test  
		return document.getElementById(id);    
	} else if (document.all) { // test older versions of IE        
		return document.all[id];    
	} else if(document.layers) { // test older versions of Netscape        
		return document.layers[id];    
	} else { // not sure what to do...return null        
		return null;    
	}
}

function smallerFont() {

	var lyrics=getElement('lyrics');

	var fontSize=lyrics.style.fontSize.replace("px","");

	if(fontSize>10) {
		fontSize--;
	}
	lyrics.style.fontSize=fontSize+"px";
}

function largerFont() {
	var lyrics=getElement('lyrics');

	var fontSize=lyrics.style.fontSize.replace("px","");

	if(fontSize<25) {
		fontSize++;
	}
	lyrics.style.fontSize=fontSize+"px";
}

function validateSearchForm() {

	var subject=document.forms['searchForm'].subject.value;

	if(subject.length<3) {
		alert("You need to enter at least a 2 character word.");
		return false;
	} else {
		return true;
	}
}
function isEmpty(elem) {

	if(elem.value.replace(/^\s+|\s+$/g,"").length == 0){
		return true;
	} else {
		return false;
	}
}

function validateComment() {
	var status=true;
	if(isEmpty(document.getElementById('name'))) {
		alert("Please enter your name");
		status=false;
	}
	
	if(isEmpty(document.getElementById('comment'))) {
		alert("Please enter a comment");
		status= false;
	} 
	
	return status;
	
}


 // Copyright 2001 by www.CodeBelly.com
 // Do *not* remove this notice.
 function selectText(textAreaObj){
 	textAreaObj.focus();
 	textAreaObj.select();
 }

function alignLeft() {
	var lyrics=getElement('songTextCont');
	lyrics.style.textAlign="left";
}

function alignCenter() {
	var lyrics=getElement('songTextCont');
	lyrics.style.textAlign="center";
}

function alignRight() {
	var lyrics=getElement('songTextCont');
	lyrics.style.textAlign="right";
}

function doIpod() {
	var ipodText=getElement('ipodText');
	ipodText.innerHTML=""; //clear it first;
	var songTextCont=getElement('songTextCont');
	var strippedText=songTextCont.innerHTML;
	strippedText=strippedText.replace(/<br>/ig,"\n");

	var htmlObj="";
	htmlObj+= "<div class=\"close\"><a href=\"#\" onclick=\"noIpod();return false;\">x close</a></div>";
	htmlObj+= "Please copy the text below to get these lyrics for your IPOD.<br>";
	htmlObj+= "<textarea onclick=\"selectText(this)\">";
	htmlObj+=strippedText;
	htmlObj+="</textarea>";
	ipodText.innerHTML=htmlObj;
	
	ipodText.style.display="block";
	
}

function noIpod() {
	var ipodText=getElement('ipodText');
	ipodText.style.display="none";
}

function copyTextAreaCode() {
	var theTextArea=getElement('textAreaSongText');	
	var songTextCont=getElement('songTextCont');
	var theText=songTextCont.innerHTML;
	theTextArea.value=theText;
	theTextArea.focus();
 	theTextArea.select();
}

function goAffiliate1(url) {
	window.open('http://www.amazon.com/gp/product/'+url,'new');
}

		function setOverlay() {
				var disableScreen=getElement('disableScreen');
				disableScreen.style.width=screen.width+"px";
				


				disableScreen.style.height="1500px";
				var screenWidth=screen.width;
				var videoOverlay=getElement('videoOverlay');
				var leftOffset=(screenWidth-600)/2;
				videoOverlay.style.left=leftOffset+"px";
		
			}
			
			function openOverLay() {
				var disableScreen=getElement('disableScreen');
				var videoOverlay=getElement('videoOverlay');
				disableScreen.style.display="block";
				videoOverlay.style.display="block";
				var theVideo=getElement('theVideo');
				theVideo.style.display="none";

			}
			
			function closeOverLay() {
				var disableScreen=getElement('disableScreen');
				var videoOverlay=getElement('videoOverlay');
				disableScreen.style.display="none";
				videoOverlay.style.display="none";
				var theVideo=getElement('theVideo');
				theVideo.style.display="block";
			}
			
			function showHideVideos() {
					
					var navDivVid=getElement('navDivVid');
					var curVis=navDivVid.style.display;
					if(curVis=="block") {
						navDivVid.style.display="none";
					} else {
						navDivVid.style.display="block";	
					}

			}
			
			function showHideGenre() {
					
					var navDivVid=getElement('navDivGenre');
					var curVis=navDivVid.style.display;
					if(curVis=="block") {
						navDivVid.style.display="none";
					} else {
						navDivVid.style.display="block";	
					}

			}
			
			var curGigya="divWildfirePost0";
			
			function showGigyaLink() {
				var theLink = getElement(curGigya);
				theLink.style.display="block";
				
			}
			function showGigyaLink2() {
				var theLink = getElement("divWildfirePostBot");
				theLink.style.display="block";
				
			}
			function hideGigya() {
				var block1 = getElement('divWildfirePost0');
				block1.style.display="none";
			}
			
			function toggleWidgetCode(id) {
				var videoFrame = getElement('videoFrame');
				var widgetFrame = getElement('widgetFrame');
				
				var vidCode = getElement('vidCode');
				var widgetCode = getElement('widgetCode');
				var vidPlusWid = getElement('vidPlusWid');

				hideGigya();

				videoFrame.style.display="none";
				widgetFrame.style.display="none";
				
				vidCode.style.display="none";
				widgetCode.style.display="none";
				vidPlusWid.style.display="none";
				
				if (id=="vidCode") {
					
					videoFrame.style.display="block";
					vidCode.style.display="block";
					getElement('wfCode').value=vidCode.value;
				}
				
				if (id=="widgetCode") {

					widgetFrame.style.display="block";
					widgetCode.style.display="block";
					getElement('wfCode').value=widgetCode.value;
					
				}
				
				if(id=="vidPlusWid") {
	
					videoFrame.style.display="block";
					widgetFrame.style.display="block";
					vidPlusWid.style.display="block";	
					getElement('wfCode').value=vidPlusWid.value;
			
				}
		
				var pconf={
  defaultContent: 'wfCode', 
  UIConfig: '<config><display showEmail="false" showPost="true" showBookmark="false" /></config>'
};
				Wildfire.initPost('167981', 'divWildfirePost0', 300, 250, pconf);
			}
			

	
			
function printBM() {
	document.write('<a href="http://www.addthis.com/bookmark.php" onclick="addthis_url   = location.href; addthis_title = document.title; return addthis_click(this);" target="_blank" rel="nofollow"><img src="http://s9.addthis.com/button2-bm.png" width="160" height="24" border="0" alt="AddThis Social Bookmark Button" /></a>');	
}

function printFanLinks(artistId,songId,vidId) {
	document.write('<div class="fanActions">');
	document.write('<strong>Community:</strong>&nbsp;');
	
	if(vidId!="") {
		document.write('<a href="/addFan.php?artist='+artistId+'&tag='+vidId+'" class="myPlaylist">Add to My Playlist</a>');	
		/*var currUrl=window.location.href;
		var vidUrl="/videos"+currUrl.replace("http://www.lyricsyoulove.com","");
		document.write('<a href="'+vidUrl+'" class="watchVid">Hi Res</a>');	*/
	}

	document.write('<a href="/addFan.php?artist='+artistId+'&tag='+songId+'" class="myFavs">Add to My Favs</a>');	

	document.write('<a href="/addFan.php?artist='+artistId+'" class="fanClub">Join Fanclub</a>');	

	document.write('</div>');
}
