var images = new Array();

function imageLoader()
{
    images[0] = new Image();
    images[0].src = 'images/bigbuttonroll.jpg';
    images[1] = new Image();
    images[1].src = 'images/bigbutton.jpg';
    images[2] = new Image();
    images[2].src = 'images/freetrial.jpg';
    images[3] = new Image();
    images[3].src = 'images/freetrialroll.jpg';
    images[4] = new Image();
    images[4].src = 'images/freetrialbutton.jpg';
    images[5] = new Image();
    images[5].src = 'images/freetrialbuttonr.jpg';
    images[6] = new Image();
    images[6].src = 'images/watchdemobutton.jpg';
    images[7] = new Image();
    images[7].src = 'images/watchdemobuttonr.jpg';
    images[8] = new Image();
    images[8].src = 'images/joinnowbutton.jpg';
    images[9] = new Image();
    images[9].src = 'images/joinnowbuttonr.jpg';
}

function buttonOver(divId,buttonId,imageId)
{
    document.getElementById(divId).style.backgroundImage = "url(" + images[imageId].src + ")";
	if ( document.getElementById("buttonLink"+buttonId) ) document.getElementById("buttonLink"+buttonId).className = 'buttonlink texthighlight';
}

function buttonOut(divId,buttonId,imageId)
{
    document.getElementById(divId).style.backgroundImage = "url(" + images[imageId].src + ")";
	if ( document.getElementById("buttonLink"+buttonId) ) document.getElementById("buttonLink"+buttonId).className = 'buttonlink textnormal';
}

function menuOver(menuId)
{
	if ( document.getElementById(menuId) )
	{
		if ( menuId == 'option1' )
			document.getElementById(menuId).className = 'leftmenuitemtophighlight'
		else
			document.getElementById(menuId).className = 'leftmenuitemhighlight' ;
	}
}

function menuOut(menuId)
{
	if ( document.getElementById(menuId) )
	{
		if ( menuId == 'option1' )
			document.getElementById(menuId).className = 'leftmenuitemtop'
		else
			document.getElementById(menuId).className = 'leftmenuitem' ;
	}
}

function viewDemo(vidId)
{
	var x = window.open("http://www.resales-online.com/video/resales" + vidId + ".html",
							"winDemo", "left=5,top=5,width=1000,height=750,scrollbars=yes" );
}

function checkAllSpaces( strVal )
{
	var spCount = 0 ;

	for ( i = 0;  i < strVal.length;  i++ )
	{
		var ch = strVal.charAt(i);
		
        if ( ch == " ")
		{
			spCount++;
		}
	}
  
	if ( spCount == strVal.length )
	{
		return true;
	}
	else
	{
		return false;
	}
}

function checkFields()
{
	if ( checkAllSpaces( document.Contact.CompanyName.value ) == true )
	{
	  alert("Please enter your Company Name.  ")
	  document.Contact.CompanyName.focus()
	  return false
	}

	if ( checkAllSpaces( document.Contact.ContactPerson.value ) == true )
	{
	  alert("Please enter your Name ")
	  document.Contact.ContactPerson.focus()
	  return false
	}

	if ( checkAllSpaces( document.Contact.PhoneNumber.value ) == true )
	{
	  alert("Please enter your Phone Number")
	  document.Contact.PhoneNumber.focus()
	  return false
	}

	if ( checkAllSpaces( document.Contact.EmailAddress.value ) == true )
	{
	  alert("Please enter your Email Address ")
	  document.Contact.EmailAddress.focus()
	  return false
	}

	if ( document.Contact.CompanyCif )
	{
		if ( checkAllSpaces( document.Contact.CompanyCif.value ) == true )
		{
		  alert("Please enter your Company CIF or Personal NIE Number ")
		  document.Contact.CompanyCif.focus()
		  return false
		}
	}

	return true
}

function loginButton(DOLsystem)
{
	if ( checkAllSpaces( document.Login.UserName.value ) == true )
	{
	  alert("Please enter your UserName ")
	  document.Login.UserName.focus()
	  return false
	}

	if ( checkAllSpaces( document.Login.UserPass.value ) == true )
	{
	  alert("Please enter your Password ")
	  document.Login.UserPass.focus()
	  return false
	}

	var x = document.Login.UserName.value ;
	document.Login.UserName.value = "" ;
	var y = document.Login.UserPass.value ;
	document.Login.UserPass.value = "" ;

	MyString = new String(x);
	if ( MyString.indexOf(".") == -1 )
	{
		var newWin = window.open("http://www.developments-online.com/"+DOLsystem+"/UserLoginValidate.asp?P1="+x+"&P2="+y+"&P3=0", "winDevOnline", "top=0, left=0, width=800, height=550, titlebar=no, location=0, menubar=0, status=1, resizable=1");
	}
	else
	{
		document.location = "http://www.developments-online.com/"+DOLsystem+"/UserLoginValidate.asp?P1="+x+"&P2="+y+"&P3=0";
	}

}
