// JavaScript Document

//CONTACT FORM
function contactshow()
{
	new Effect.Appear('fader',{duration:.5, from: 0, to: 0.8});
	new Effect.Appear('contactForm',{duration:.5, from: 0, to: 1});
	
}

function contacthide()
{
	new Effect.Fade('fader',{duration:.5});
	if($('contactForm').style.display != 'none')
	{
		new Effect.Fade('contactForm',{duration:.5});
	} else if($('aniHolder').style.display != 'none')
	{
		new Effect.Fade('aniHolder',{duration:.5});
	}
	
}

function loader() {
	$('loader').innerHTML = '<img src="images/loading.gif">';
	new Effect.Appear('fader2',{duration: 0.5, from: 0, to: .8});
	new Effect.Appear('loader',{duration: 0.5, from: 0, to: 1});
	setTimeout('sendmail()',1000);
}
    
var http;
function sendmail() {
	
    var browser = navigator.appName;
	
    if(browser == "Microsoft Internet Explorer"){
        http = new ActiveXObject("Microsoft.XMLHTTP");
    }else{
        http = new XMLHttpRequest();
    }
	
	var msg = $('contactComments').value;
	var name = $('contactName').value;
	var email = $('contactEmail').value;
	var subject = 'Site Comments';
	document.contactform.contact.disabled=true;

    http.open('get', 'contact.php?name='+name+'&msg='+msg+'&email='+email+'&subject='+subject+'&action=send', true);
    http.onreadystatechange = handleResponse;
    http.send(null);
}

function handleResponse() {	
	
    if(http.readyState == 4){
        var response = http.responseText;
        var update = new Array();

        if(response.indexOf('|' != -1)) {
            update = response.split('|');
            $(update[0]).innerHTML = update[1];
			new Effect.Fade('fader2',{duration: 0.5, from: .8, to: 0});
			new Effect.Fade('loader',{duration: 0.5, from: 1, to: 0, afterFinish: function(){new Effect.BlindDown('sentAnswer',{duration: .5}); new Effect.BlindUp('contactHide',{duration: .5});}});
			
         
        }
	}
}



//VIDEO PLAYER 4 ANIMATIONS
function showAni(id)
{
		var browser = navigator.appName;
	
		if(browser == "Microsoft Internet Explorer"){
			http = new ActiveXObject("Microsoft.XMLHTTP");
		}else{
			http = new XMLHttpRequest();
		}
		http.open('get', 'xmlcreator.php?id='+id, true);
		http.send(null);
		
		new Effect.Appear('fader',{duration:.5, from: 0, to: 0.8});
		new Effect.Appear('aniHolder',{duration:.5, from: 0, to: 1});
}
