// JavaScript Document
function col(obj, Colore) {
	obj.style.backgroundColor=Colore
	obj.style.cursor='hand'
}


function myGo(wichForm){
	var fValue = wichForm.country.options[wichForm.country.selectedIndex].value;

	if (fValue != ""){
		// document.location = 'do_goto_results.php?countryid='+fValue;

		secondi=0
		indirizzo="do_goto_results.php?countryid="+fValue
		setTimeout("location=indirizzo",secondi*1000)

	}else{
		alert("Selezionare una destinazione\nSelect a country");
	}
}



function ValidateMail(strEmail){
	var bIsValid = true;
	if (String(strEmail).length < 6) bIsValid = false;
	if (strEmail.search(" ") != -1) bIsValid = false;
	if (strEmail.indexOf("@") < 1) bIsValid = false;
	if (strEmail.lastIndexOf('.')<strEmail.lastIndexOf('@')||strEmail.lastIndexOf('.')==-1) bIsValid = false;
	if (strEmail.lastIndexOf('.') == (strEmail.length)-1) bIsValid = false;
	if (strEmail.lastIndexOf('.') == strEmail.lastIndexOf('@')+1) bIsValid = false;
	return(bIsValid);
}

function IsValidate(){
      var giorno = regform.giorno_nascita.value; 
      var mese = regform.mese_nascita.value;
      var anno = regform.anno_nascita.value;
	  var flag = true;
	  if (giorno != "-1" && mese != "-1" && anno != "-1"){
		// CONTROLLA CHE NON SI IMMETTA GIORNI MAGGIORI DI 28 PER FEBBRAIO E MAGGIORI DI 30 PER APRILE,GIUGNO,SETTEMBRE,NOVEMBRE //
		if(giorno > 28 && mese == 2) flag = false;
		if(giorno > 30 && (mese ==  4 || mese ==  6 || mese ==  9 || mese ==  11)) flag = false;
		if(mese ==  2 && giorno == 29){
        if(((anno % 4 == 0) && (anno % 100 != 0)) || (anno % 400 == 0)) flag = true;
		}
	  }
      return flag;
}


function LTrim(str)
{
	var whitespace = new String(" \t\n\r");
	var s = new String(str);
	if (whitespace.indexOf(s.charAt(0)) != -1) {
	   var j=0, i = s.length;
	   while (j < i && whitespace.indexOf(s.charAt(j)) != -1)
	      j++;
	   s = s.substring(j, i);
	}
	return s;
}

function RTrim(str)
{
   var whitespace = new String(" \t\n\r");
   var s = new String(str);
   if (whitespace.indexOf(s.charAt(s.length-1)) != -1) {
      var i = s.length - 1;
      while (i >= 0 && whitespace.indexOf(s.charAt(i)) != -1)
         i--;
      s = s.substring(0, i+1);
   }
   return s;
}

function Trim(str)
{
   return RTrim(LTrim(str));
}



function OpenWin(PageName, W, H){
	window.open (PageName, "mywindow","location=0,status=0,scrollbars=1, width="+W+",height="+H+"");
}


function deleteAnnuncio(itemId){

	if(confirm("Sei sicuro di voler cancellare l'annuncio?\nDo you confirm the deletion of the announce?")) {
		document.location="do_delete_annuncio.php?annid="+itemId;
	
	} else {
		return false;
	}

}


function deleteVideo(itemId){

	if(confirm("Sei sicuro di voler cancellare il video?\nDo you confirm the deletion of the video?")) {
		document.location="do_delete_video.php?vid="+itemId;
	
	} else {
		return false;
	}

}


function deleteMyBookmark(itemId){

	if(confirm("Sei sicuro di voler cancellare il video dai preferiti?\nDo you confirm the deletion of the video from bookmarks?")) {
		document.location="do_delete_mybookmarks.php?itemid="+itemId;
	
	} else {
		return false;
	}

}


function voteVideo(vote, itemId){
	if (itemId > 0 && itemId != "" && itemId != undefined){
		document.location="do_set_video_vote.php?vid="+itemId+"&vote="+vote;
	}
}


function deleteVideoFoto(itemId, videoId){

	if(confirm("Sei sicuro di voler cancellare la foto?\nDo you confirm the deletion of the photo?")) {
		document.location="do_delete_video_foto.php?fid="+itemId+"&vid="+videoId;
	
	} else {
		return false;
	}

}