// checks the message textbox to determine if it has exceeded the maximum length
function CheckTextLength(textArea, maxLength)
{		
	if (maxLength == 0)
		maxLength = 150;

	if(textArea.value.length > maxLength )
	{
		alert("Please shorten your message to a maximum length of " + maxLength + " characters or about 15 - 20 words.");		
		//Commented by Sudeshna
		/*textArea.value = "";*/
		textArea.focus();
	}			
}		

/*
 * Prevents user from entering more than specific number of characters in a textbox/textarea
 */
function LimitTextLength(textArea, maxLength)
{		
	if (maxLength == 0)
		maxLength = 150;

	if(textArea.value.length > maxLength )
	{		
		textArea.value = textArea.value.substring(0, maxLength);
		textArea.focus();
	}			
}		

function Sethiddenloginvalue(val)
	{
		var _f = document.forms[0];
		for (i=0;i<_f.elements.length;i++)
		{
			if (_f.elements[i].id.indexOf('hidden_login') != -1)
				_f.elements[i].value=val;
			}
	}

function isEnter(e,FieldName)
{
	if (e.keyCode == 13)
		gosearch(FieldName);
	return true;
}

function search_GoToURL(url)
{
	if (url!="") document.location.href= url;
}

function openPopup(url, name, popupWidth, popupHeight) {
	var winl = (screen.width - popupWidth) / 2;
	var wint = (screen.height - popupHeight) / 2;
	var name2 = name.replace(' ','');
	name2=name2.replace('-','');
		
	newWindow = open(url, name2, ("toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=no,resizable=yes,copyhistory=no,top=" + wint + ",left=" + winl + ",width=" + popupWidth + ",height=" + popupHeight + "\""));
	newWindow.focus();
}

function openPopupWScroll(url, name, popupWidth, popupHeight) {
	var winl = (screen.width - popupWidth) / 2;
	var wint = (screen.height - popupHeight) / 2;
	var name2 = name.replace(' ','');
	name2=name2.replace('-','');
		
	newWindow = open(url, name2, ("toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=yes,copyhistory=no,top=" + wint + ",left=" + winl + ",width=" + popupWidth + ",height=" + popupHeight + "\""));
	newWindow.focus();
}

function changeOpenerURL(thisWindow,url) {
	thisWindow.opener.location.href=url;
	thisWindow.focus();
	
}

function register() {
	openPopup('../popup/mailinglist.aspx','register', 480,400)
}

var SalonURL="";
function AddWebSiteURL(url,className,urlName){
	SalonURL = '<a href="' + url + '" target="_blank" class="' + className + '">' + urlName + '"</a>"';  
}
function AddWebSiteURLImage(url,className,imgName,altName){
	SalonURL = '<a href="' + url + '" target="_blank" class="' + className + '"><img src="' + imgName + '" border="0" alt="' + altName + '"></a>"';  
}




function WriteProperties(haircare, styling, color, men,Certified_Haircolorist)
{
	var strReturn = "";
	if (haircare == "True" || haircare == "-1")
		strReturn = "haircare";
	if(styling == "True" || styling == "-1")
		strReturn = addPlus(strReturn,"styling");
	if (color == "True" || color == "-1")
		strReturn = addPlus(strReturn,"color");
	if (men == "True" || men == "-1")
		strReturn = addPlus(strReturn,"men");
	if (Certified_Haircolorist == "True" || Certified_Haircolorist == "-1"){
		strReturn = addPlus(strReturn,"certified hair colorist");
		
	}
	return strReturn;
}

function WritePropertiesFR(haircare, styling, color, men,Certified_Haircolorist)
{
	var strReturn = "";
	if (haircare == "True" || haircare == "-1")
		strReturn = "soins capillaires";
	if(styling == "True" || styling == "-1")
		strReturn = addPlus(strReturn,"coiffure");
	if (color == "True" || color == "-1")
		strReturn = addPlus(strReturn,"coloration");
	if (men == "True" || men == "-1")
		strReturn = addPlus(strReturn,"homme");
	
	if (Certified_Haircolorist == "True" || Certified_Haircolorist == "-1")
		strReturn = addPlus(strReturn,"coloriste certifi&eacute; redken");
	return strReturn;
}

function addPlus(strCurrent, strAdd){
	if (strCurrent != "")
		strCurrent = strCurrent + " + " + strAdd;
	else
		strCurrent = strAdd;
	
	return strCurrent;
}
