
	var myLinkItems, pagina,isNoFollow;
	myLinkItems = document.location.href.split("/");
	pagina = myLinkItems[myLinkItems.length -1];	
	
function NoFollowString(nofollow){
    var myhref = document.location.href;
    var myhrefelem = myhref.split("/");
    var pagina = myhrefelem[myhrefelem.length - 1];
    if (pagina.toLowerCase() == "homepage.aspx") nofollow = nofollow.replace("rel='nofollow'","");
    return nofollow;
}

function validateEmail(elementValue){   
   var emailPattern = /^[a-zA-Z0-9._-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/;   
   return emailPattern.test(elementValue);
}  

function LTrim( value ) {
	
	var re = /\s*((\S+\s*)*)/;
	return value.replace(re, "$1");
	
}

function RTrim( value ) {
	
	var re = /((\s*\S+)*)\s*/;
	return value.replace(re, "$1");
	
}

function trim( value ) {
	
	return LTrim(RTrim(value));
	
}



function textboxChangingFocus(mytextbox, mytext){
	if (mytextbox.value == mytext){
		mytextbox.value = "";
	}
}

function textboxChangingLostFocus(mytextbox, mytext){
	if (trim(mytextbox.value) == "") {
		mytextbox.value = mytext;
	}
}



function isNoFollow(valField){
    myisNoFollow = "";
    if (pagina.toLowerCase() != "homepage.aspx") {
        if (valField == "Yes"){
            myisNoFollow = "rel='nofollow'";
        }
    }
//    alert("con nofollow option = " + valField + " stampo " + myisNoFollow);
return myisNoFollow;
}


function formatParag(lim1, lim2){
	/*var myD
	for(var i = 1; i<=lim1;i++){
		for(var j = 0; j <lim2; j++){
			myD = $("#prebottomlinksdesc"+i+""+j);
			document.write(myD.height());
			//$("#prebottomlinks"+i+""+j).height() = $("#prebottomlinksdesc"+i+""+j).height();
		}
	}*/
}



function openFS(myUrl){
	window.open(myUrl,'', 'height=' + (window.screen.height-60) + ', width=' + (window.screen.width-9) + ', top=0, left=0, scrollbars=1');
	return;
}

String.prototype.capitalize = function(){ //v1.0
    return this.replace(/\w+/g, function(a){
        return a.charAt(0).toUpperCase() + a.substr(1).toLowerCase();
    });
};


function signup(){
	var emailset = $("#youremail").val();
	if(validateEmail(emailset)){
				window.open('/gl_en/sign-up.aspx?email='+ emailset,'Sign_up_MSC_Cruises_specials','status=1,width=500,height=250,toolbar=0,resizable=0');
	}else{
				window.open('/gl_en/sign-up.aspx?email=NN','Sign_up_MSC_Cruises_specials','status=1,width=500,height=250,toolbar=0,resizable=0');
	}
}

function daysInMonth(month, year) {
var dd = new Date(year, month, 0);
return dd.getDate();
}
