
// ------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------

function OpenInformationForm(pURL)
	{
	try{
		window.opener.location=pURL;
		window.close();
		}
	catch( er ){
		window.open(pURL,"_blank");
		}

	}

function returnObjById( id ) 
{ 
	if (document.all != 'null' && document.all != 'undefined' && document.all) 
		{
        var returnVar = document.all[id]; 
        }
    else if (document.getElementById) 
        var returnVar = document.getElementById(id); 
    else if (document.layers) 
        var returnVar = document.layers[id]; 

    return returnVar; 
} 


function ValidateFields()
	{
	frmObj = returnObjById('form1'); //document.form1;
	
	var txteMail = '';
	var txtName = '';
	
	for (i=0; i < frmObj.length ; i++)
		{
		if (frmObj[i].type=='text')
			{
			v = frmObj[i].value;
			if (v == '' || v == 'EMAIL'  || v == 'NAME' )
				{
				window.alert("Please, fill this form with valid information. Thank you.");
				return;
				}
				
			if (frmObj[i].name=='email')		
				txteMail = v;
			if (frmObj[i].name=='name')		
				txtName = v;
			}
		}	
		
	if (trim(txteMail) != '' && trim(txtName) != '' )
		{
		//window.open('thankyou.asp?e='+escape(txteMail)+'&n='+escape(txtName),"ThankYouWin","scrollbars=0,height=350,width=400,status=0,top=20,left=10,toolbar=0,menubar=0,location=0,resizable=0",true); 
		frmObj.submit();
		}
	else
		{
		window.alert("Please, fill this form with valid information. Thank you.");
		}
	
	}

// ------------------------------------------------------------------------------------------------------------------
function frmGO(e)
{
	var whichCode = (window.Event) ? e.which : e.keyCode;
	
	if (whichCode == 13) ValidateFields();
	
	return true;
	//window.alert(whichCode);
}
// ------------------------------------------------------------------------------------------------------------------

function trim(curString)
{
	for(i=0; i<curString.length; )
	{
		if(curString.charAt(i)==" ")
			curString=curString.substring(i+1, curString.length);
		else
			break;
	}

	for(i=curString.length-1; i>=0; i=curString.length-1)
	{
		if(curString.charAt(i)==" ")
			curString=curString.substring(0,i);
		else
			break;
	}
	
	return curString;
}

// ------------------------------------------------------------------------------------------------------------------


function TextAreaExpand(MiTextArea,cRows)
	{ // onfocus onblur
	MiTextArea.rows=cRows;
	}

// ------------------------------------------------------------------------------------------------------------------

function ChecklenTextArea(MiTextArea,MiMaxLen)
	{
	mitextt = MiTextArea.innerHTML;
	if (mitextt.length > MiMaxLen)
		{
		mitextt = mitextt.substring(0,MiMaxLen);
		MiTextArea.innerHTML = mitextt;
		}
	}
	

// ------------------------------------------------------------------------------------------------------------------

function isCharDate(s)
{
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9")) && c!="/") return false;
    }
    return true;
}

// ------------------------------------------------------------------------------------------------------------------

function isCharTime(s)
{
	var i;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (((c < "0") || (c > "9")) && c!=":") return false;
    }
    return true;
}

// ------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------
// ------------------------------------------------------------------------------------------------------------------
