<!--

// Checks if radio button is checked.
function checkRadio(form1) {
  var flag = false;

  for (var i=0; i<form1.gift.length; i++) {
    if (form1.gift[i].checked == true) {
      flag = true;
    }
  }

  if (!flag) {    // Radio is not checked.
    alert("Please, check a radio!");
  }

  return flag;
};


function CleanSubmit(id){
  var titl  = _i(id).value;
  titl=titl.replace(/\'/gi,"");
  titl=titl.replace(/\"/gi,"");
  titl=titl.replace(/\|/gi,"");
  titl=titl.replace(/\`/gi,"");
  titl=titl.replace(/\//gi,"");
  //alert(titl);
  _i(id).value  = titl;
};

function LoadPopUpData(dttoload,title,cstype,codx){

	    // setvanme action ID-to pri close
	       _i('JavActionId').innerHTML =cstype;
	    // setvame backgrounda
	       _i('glasspane').className = 'glasspaneactive';
	   // setvame title-a
	       _i('popuptitle').innerHTML = title;
		// zarejdame dannite v containera
		   _i('popupdanni').innerHTML = dttoload;
		// setvame z-indexa
		   _i('info').style.zIndex = 100000000;
		// praim go visible
		xpos = _i('MouseX').value;
		ypos = _i('MouseY').value;

		_i('info').style.position='absolute';
		_i('info').style.top=ypos;
		_i('info').style.left=xpos;
		_i('info').style.display='block';
};

function GetInfo(id) {
  if (_i("s_"+id).innerHTML==""){
    var form = "form_"+id;
    formobj = _i(form);
    //alert("a"+id +formobj);
    formobj.submit();
  }
  else if(_i("s_"+id).innerHTML==1) {
    TagToTip(id, BORDERWIDTH, 0, BGCOLOR, '');
	/*_i(id).style.display='block';
    xpos = _i('MouseX').value;
    ypos = _i('MouseY').value;
    xpos = parseInt(xpos) + 20;
    ypos = parseInt(ypos) + 20;
    var sY = window.screenY;
    alert(sY);
    if(ypos>500){
    	ypos = parseInt(ypos) - 40 - parseInt(_i(id).offsetHeight);
    }
    
	  _i(id).style.position='absolute';
	  _i(id).style.top=ypos;
	  _i(id).style.left=xpos;*/
  }else{
    return false;
  }
};

function TimeHide(id){
	_i(id).style.display='none';
};

/////////////////////////////////////////////////////////////////////////////////
function CHG_IMAGE(id,image){
	document.getElementById(id).src = image;
};

/////////////////////////////////////////////////////////////////////////////////
// validate the inserted emails and correct the errors 
function MultipleEmailsValidation(form_object,errors_string) {
	if (!form_object.email)
	{ 
		alert("Insert Email!");

	} else {
	    /* get the input field value */
		var emails  = form_object.email.value;
        var subject = form_object.subject.value;
        var body    = form_object.body.value;
        var errors  = errors_string.split("|!|");
		/* test for empty emails*/
		if (emails.length == 0) {
		  document.getElementById("wrong_emails").innerHTML = "<font color='red'>" + errors[0] + "</font>";
          document.getElementById("empty_subject").innerHTML = "";
          document.getElementById("empty_body").innerHTML    = "";
		  return false;
		} else if (subject.length == 0) {
		  document.getElementById("wrong_emails").innerHTML = "";
          document.getElementById("empty_subject").innerHTML = "<font color='red'>" + errors[0] + "</font>";
          document.getElementById("empty_body").innerHTML    = "";

		  return false;
		} else if (body.length == 0) {
		  document.getElementById("wrong_emails").innerHTML  = "";
          document.getElementById("empty_subject").innerHTML = "";
          document.getElementById("empty_body").innerHTML    = "<font color='red'>" + errors[0] + "</font>";
		  return false;
		} 
		/* replace all the extra characters with ! */
		var regex = /(<|>|,|;|\'|\"|\ )+/gi;
		emails = emails.replace(regex,"!");
        /* split the results */
        var emails_array = emails.split("!");
		
		emails = "";
		var wrong_emails = "";

		for (var i = 0; i < emails_array.length; i++) {   
			/* filter the results by having @ */
			if (emails_array[i].search(/@/) > -1) { 
			  /* put the valid results in a string "emails" , separated by "," */
			  if (validate_email(emails_array[i])) {
				emails = emails + "," +  emails_array[i]; 
			  }
			  /* put the wrong results in a string "wrong_emails", separated by "," */
			  else {
				 wrong_emails = wrong_emails + "," +  emails_array[i];
			 }
			}
		}
		/* remove the extra "," at the begining */
        emails = emails.substring(1);
        wrong_emails = wrong_emails.substring(1);
		/* put the clear result back in the form */
	    form_object.email.value = emails;
		/* put the wrong results in a <div> above */
		if (wrong_emails.length > 0) {
	      document.getElementById("wrong_emails").innerHTML = "<font color='red'>" + errors[1] + ": " + wrong_emails + "</font>";
		  return false;
		}
		if (emails.length == 0 && wrong_emails.length == 0 ) {
		  document.getElementById("wrong_emails").innerHTML = "<font color='red'>" + errors[1] + "</font>";
		  return false;
		}
		
	}

}
/////////////////////////////////////////////////////////////////////////////////////
function validate_email(address) {
   var reg = /^([A-Za-z0-9_\-\.])+\@([A-Za-z0-9_\-\.])+\.([A-Za-z]{2,4})$/;
   if(reg.test(address) == false) {
      return false;
   } 
   return true;
}
function ShowEditForm(folder_id) {
 document.getElementById("text_" + folder_id).style.display = 'none';
 document.getElementById("input_" + folder_id).style.display = 'block';
 document.getElementById("action_" + folder_id).style.display = 'none';
 document.getElementById("save_button_" + folder_id).style.display = 'block';

}
-->
