var msgMandatoryNotBlank = "Mandatory(*) information not allow blank.";
function ConfirmMessage(lnk,msg){
	if (confirm(msg)){
		window.location.href = lnk;
	}
}

var submitFlag = true;
function resetFlag(){
	submitFlag = true;
}

function submitFrm(frm){
	if (submitFlag == true){
		document.forms[frm].flgSubmit.value = true;
		document.forms[frm].submit();
	}
}

function validateBlank(frm,arrC){
	var flg = false;
	for(var i=0;i<arrC.length;i++){
		var tVal = document.forms[frm].elements[arrC[i]].value;
		if(tVal.length<1){
			flg = true;
			break;
		}
	}
	if (flg){
		alert (msgMandatoryNotBlank);
		submitFlag = false;
	}
}

function optionTransfer(frm, cmbSrc, cmbTrg){
	var tv = document.forms[frm].elements[cmbSrc].value;
	var idx = document.forms[frm].elements[cmbSrc].selectedIndex;
	if (idx==-1)
		return false;
	var tLen = document.forms[frm].elements[cmbTrg].options.length;
	var sLen = document.forms[frm].elements[cmbSrc].options.length;
	var tt = document.forms[frm].elements[cmbSrc].options[idx].text;
	document.forms[frm].elements[cmbTrg].options[tLen] = new Option(tt,tv);
	if (idx<sLen){
		for (var i=(idx+1); i<sLen; i++){
			document.forms[frm].elements[cmbSrc].options[i-1].value = document.forms[frm].elements[cmbSrc].options[i].value;
			document.forms[frm].elements[cmbSrc].options[i-1].text = document.forms[frm].elements[cmbSrc].options[i].text;
		}
	}
	document.forms[frm].elements[cmbSrc].options.length -= 1;
}

function addHidden(frm,cmb){
	var eleFrm = document.getElementById(frm);
	for (i=0;i<document.forms[frm].elements[cmb].options.length;i++){
		var tHid = document.createElement("input");
		tHid.type = "hidden";
		tHid.name = cmb+"_hid["+i+"]";
		tHid.value = document.forms[frm].elements[cmb].options[i].value;
		eleFrm.appendChild(tHid);
	}
}

function openPopup(loc,tit,wid,hig){
	window.open(loc,tit,'toolbar=0,location=0,directories=0,status=1,menubar=0,scrollbars=yes,resizable=yes,width='+wid+',height='+hig);
}

/** Function to check whether given string is really empty or not */
function isblank(s)
{
	for(var i=0; i < s.length; i++)
	{
		var c=s.charAt(i);

		if((c != ' ') && (c != "\n") && (c != "\t"))
			return false;
	}
	return true;
}

/** Function which checks whether given email is valid or not */
function emailInvalid(s)
{
	if(s.match(/^\w+([\.\+]?[-]{0,2}\w+)*[\.]?[-]?@\w+([\.-]?\w+)*(\.\w{2,4})+$/i))
		return true;
	else
		return false;
}

/** Function to check city values */
function checkCity(s)
{
	if(!s.match(/^[0-9a-zA-ZåÅäÄöÖüÜÁÀÉÈÒÓÙÚáàèéòóùúÝìíýÌÍ_´:\s\,-]{1,250}$/))
		return false;
	else
		return true;
}
/** Function to check zip values */
function checkZip(s)
{
	if(!s.match(/^[0-9a-zA-Z]{1,250}$/))
		return false;
	else
		return true;
}

/** Function to check phone,fax,mobile for finland country */
function checkphone(s)
{
	if(!s.match(/^[0-9\s\+-]{1,25}$/) )
		return false;
	else
		return true;
}

/** Function to check phone,fax,mobile for finland country */
function check(s)
{
	if(!s.match(/^[0-9\s\+-]{5,25}$/) )
		return false;
	else
		return true;
}

function showHide()
{
	document.getElementById("facilities").style.display="block";
}

function showHide2()
{
	document.getElementById("about-us").style.display="block";
}
function showHide1()
{
	document.getElementById("facilities").style.display="none";
	document.getElementById("about-us").style.display="none";
}

