function checkSearchValue(elm) {
			if (elm.form.queryText.value=="") {
				alert('You must enter some text to search for.');
				return false;
			}
			else {
				return true;
			}
		}
		
/* using at my-home.jsp */		
function submitFormForSelectedCommunity(form) {
			if (form.findCommunityId.value == 0) {
				alert('Please select a community.');
				return false;
			}
			else {
				var url = 'c/'+form.findCommunityId.value+'/home.do';
				form.action = url;
				form.submit();
			}
}
		
/* using at user-profile.jsp, 09/12/2009*/
function uploadUserPhoto(form) {

				var url = '/reg/upload-user-photo.do';
				form.action = url;
				form.submit();
		}
		
/* using at change-profile-picture.jsp, 16/12/2009 */
function updateSelectedAvatarPath(imagePath) {
				document.changepicture.avatarPath.value = imagePath;
				document.changepicture.avatar.value=true;
				document.changepicture.submit();
		}
		
/* using at update-profile-new.jsp, 16/12/2009 */
function updateAvatarPath(imagePath) {
				document.userprofile.avatarPath.value = imagePath;
				document.userprofile.avatar.value=true;
				document.userprofile.submit();
		}
	
/**
 *	Shyam, updated on 11/05/2009 related with issue no. 886
 *
 * This new method require because we are using same form on search site page for 
 * 1)Search and 2)Remove Selected actions.
 * So we need a functionality which decide at run time where need to submit the request.
 * Therefore added a new method 'checkSearchValueForSearchSite'. 
 * When user click on the 'Search' button then following java script method being called.
 *
 * In this method we will check that if user does not enter any text in search input field then we will show him a message and stop the form submmition.
 * Otherwise we will change the for action url and submit the request.
 *
 */	
 
function checkSearchValueForSearchSite(elm,url) {
			if (elm.form.queryText.value=="") {
				alert('You must enter some text to search for.');
				return false;
			}
			else {
				elm.form.action=url+"/srch/search-despatch.do";
				return true;
			}
		}
		
function checkTagTextValue(elm) {
			if (elm.form.selectedTag.value=="") {
				alert('Enter tagtext.');
				return false;
			}
			else {
				return true;
			}
		}

function largeFont() {
	document.getElementById('container').className = "large-font";
	createCookie("CoP-font-size","large",10);
}

function mediumFont() {
	document.getElementById('container').className = "medium-font";	
	createCookie("CoP-font-size","medium",10);
}

function smallFont() {
	document.getElementById('container').className = "small-font";
	createCookie("CoP-font-size","small",10);
}

function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}

window.addEvent('domready', function(){

	fontSize = readCookie("CoP-font-size");
	
	if(fontSize) if(fontSize.length>1) document.getElementById("container").className = fontSize + "-font";
	
	 //Shyam, 11/05/2009 [956,Durgesh]
	 //add print button globally
	 var list = $$('li.print');
	 list.some(function(element, index) {
	  element.innerHTML='<a href="javascript:print()">Print this page</a>'
	 });
	
});

/*
 * Shyam, 23/07/2009 [1181]
 */

function loadLicense(license) {
	document.getElementById('license_description_'+license).style.display = 'block';
}

/*
 * Shyam, 23/07/2009 [1181]
 */

function selectLicense(license) {
	for(var i = 0; i < 7; i++) {
		document.getElementById('license_description_'+i).style.display = 'none';
	}
							
	try {
			document.getElementById('license_description_'+license).style.display = 'block';
	} catch(e) { }
}


window.addEvent('domready', function(){
    var heading = document.getElementById('quick-access');
    if(heading==null) return;

    var list = document.getElementById('jumpToList');
    heading.onmouseover = function(){            	
	   list.style.display="block"; 
    };
    heading.onmouseout = function(){            	
	   list.style.display="none"; 
    };                                             
    return false;
});


