function change_images(but1, c, but2, lc) //1 div buton, 2 change, 3 div logo, 4 logo change
{	
	document.all(but1).src=c; //c
	document.all(but2).src=lc; //lc
}

function restore_images(but1, r, but2, lr)	//1 div buton, 2restore, 3 div logo, 4 logo restore
{
	document.all(but1).src=r;
	document.all(but2).src=lr;
}

var userAgent = navigator.userAgent.toLowerCase();
var is_ie = userAgent.indexOf('msie') > -1;
var is_opera = userAgent.indexOf('opera') > -1;

function showOverlay ( visible )
{
    var overlay = $('overlay');

    if ( overlay ) {
        Element.setOpacity ( overlay, ( visible ? 50 : 0 ) );
        overlay.style.display = visible ? 'block' : 'none';
    } else {
        var overlay = document.body.appendChild ( document.createElement ( 'div' ) );
        overlay.id = 'overlay';
        Element.setOpacity ( overlay, 50 );
    }

    // for IE
    if ( is_ie ) {
        var selects = document.getElementsByTagName ( 'select' );
        for ( var i = 0; i < selects.length; ++i )
            selects[i].style.visibility = visible ? 'hidden' : 'visible';
    }
}

function ShowAlert ( str, title )
{
    showOverlay ( true );
    var alertBox = document.body.appendChild ( document.createElement ( 'div' ) );
    alertBox.id = 'alert_box';
    alertBox.style.visibility = 'hidden';
    alertBox.innerHTML = '<div class="top"><!-- --></div>' +
    '<div class="center">' +
        '<div class="left"><h1>' + (title?title:'Alert !') + '</h1></div>' +
        '<div class="right"><img src="images/x.gif" alt="Close" align="top" id="alert_close_button" /></div><div class="spacer"></div>' +
        '<p><div class="text">' + str + '</div></p>' +
		'<p><div class="logo"><input type="button" value="&nbsp;OK&nbsp;" id="alert_ok_button" /></div></p>' +
   '</div><div class="bottom"><!-- --></div>';
    alertBox.style.visibility = 'visible';
    Event.observe ( document, 'keypress', function ( event ) {
        event = event || window.event;
        if (event.keyCode == Event.KEY_ESC)
            hideAlert();
    });

    Event.observe ( $('alert_close_button'), 'click', hideAlert );
    Event.observe ( $('alert_ok_button'), 'click', hideAlert );
}

function ShowZoom ( img )
{
    showOverlay ( true );
    var imgBox = document.body.appendChild ( document.createElement ( 'div' ) );
    imgBox.id = 'image_box';
    imgBox.style.visibility = 'hidden';
    imgBox.innerHTML = '<div class="img_center">' +
		'<div class="right"><img src="images/x.gif" alt="Close" align="top" id="img_close_button" /></div><div class="spacer"></div>' +
        '<img src="' + img + '" id="pic"><div class="logo"></div>' +
   		'</div>';
    imgBox.style.visibility = 'visible';

    Event.observe ( document, 'keypress', function ( event ) {
        event = event || window.event;
        if ( event.keyCode == Event.KEY_ESC )
            hideZoom();
    });

    Event.observe ( $('img_close_button'), 'click', hideZoom );
}

function hideZoom ( )
{
    showOverlay ( false );
    var image_box = $('image_box');
    if ( image_box )
        document.body.removeChild ( $('image_box') );
}

function hideAlert ( )
{
    showOverlay ( false );
    var alert_box = $('alert_box');
    if ( alert_box )
        document.body.removeChild ( $('alert_box') );
}

function CheckName(){
	if (document.Contact.name.value=="")
	{
		ShowAlert('Name field is empty !');
		return true;
	}else{
		return false;
	}
	
}

function CheckEmail(){
	if (document.Contact.email.value=="")
	{
		ShowAlert('Plase enter your email Address');
		return true;
	}else{
		return false;
	}
}
function CheckEmail(){
	if (document.Contact.email.value=="")
	{
		ShowAlert('Plase enter your email address');
		return true;
	}else{
		return false;
	}
}

function CheckSubject(){
	if (document.Contact.subject.value=="")
	{
		ShowAlert('Subject field is empty !');
		return true;
	}else{
		return false;
	}
}

function CheckCode(){
	if (document.Contact.secure.value=="")
	{
		ShowAlert('Please type the code seen on the image to the right');
		return true;
	}else{
		return false;
	}
}

function CheckMessage(){
	if (document.Contact.message.value=="")
	{
		ShowAlert('You forgot the message');
		return true;
	}else{
		return false;
	}
}

function CheckContact(){
	if(CheckName()){ return false; }
	if(CheckEmail()){ return false; }
	if(CheckSubject()){ return false; }
	if(CheckCode()){ return false; }
	if(CheckMessage()){ return false;}
}
