// JavaScript Document

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}


function validateField(fieldId, fieldType, required)
{
	fieldObj = document.getElementById(fieldId);

	if(fieldType == 'text' || fieldType == 'website')
	{	
		if(required == 1 && fieldObj.value == '')
		{
			fieldObj.setAttribute("class","InputTextError");
			fieldObj.setAttribute("className","InputTextError");
			fieldObj.focus();
			return false;					
		}
		else
		{
			fieldObj.setAttribute("class","InputTextValid");
			fieldObj.setAttribute("className","InputTextValid");
		}
	}

	else if(fieldType == 'email')
	{	
		if((required == 1 && fieldObj.value=='')  ||  (fieldObj.value!=''  && !validate_email(fieldObj.value)))
		{				
			fieldObj.setAttribute("class","InputTextError");
			fieldObj.setAttribute("className","InputTextError");
			fieldObj.focus();
			return false;					
		}
		else
		{
			fieldObj.setAttribute("class","InputTextValid");
			fieldObj.setAttribute("className","InputTextValid");
		}
	}
}


function validate_email(emailStr)
{		
	apos=emailStr.indexOf("@");
	dotpos=emailStr.lastIndexOf(".");
	
	if (apos<1 || dotpos-apos<2) 
	{
		return false;
	}
	else
	{
		return true;
	}
}






/******************************************
* DHTML Ad Box (By Matt Gabbert at http://www.nolag.com)
* Visit http://www.dynamicdrive.com/ for full script
* This notice must stay intact for use
******************************************/

adTime=20;  // seconds ad reminder is shown
chanceAd=1; // ad will be shown 1 in X times (put 1 for everytime)

adCount=0;

function initAd(){
	adDiv=eval('document.getElementById("BoxDiv").style');
	randAd=Math.ceil(Math.random()*chanceAd);
        adDiv.visibility="visible";
	if(randAd==1) showAd();
}

function showAd(){
if(adCount<adTime*10){
	adCount+=1;
	setTimeout("showAd()",100);
	}
else closeAd();
}

function closeAd(){
adDiv.display="none";
}

onload=initAd;
//End-->

