window.addEvent('domready', function(){	

	$('start_conversation').addEvent('click', function(event) {
		var blackboxpos = 1100;
		var BlackBoxScrollTop = document.body.scrollTop;

		if (BlackBoxScrollTop == 0) {
		   	if (window.pageYOffset)
	      			BlackBoxScrollTop = window.pageYOffset;
		        else
	   			BlackBoxScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
		}
	
		BlackBoxScrollTop = BlackBoxScrollTop + 15;	
		var screenwidth = document.documentElement.clientWidth;		
		var screenheight = document.documentElement.clientHeight;
		var whiteboxpos = (screenwidth / 2) - 385;
	
		//$('shadow_content').setStyle('width', screenwidth);
		//$('shadow_content').setStyle('height', blackboxpos);
		$('white_content').setStyle('left', whiteboxpos);
		$('white_content').setStyle('top', BlackBoxScrollTop);
		
		var myRequest = new Request({
			url: '/start-conversation.phtml',
			method: 'get',
			onSuccess: function(responseText, responseXML) {
				$('white_content').set('html', responseText);
			}
		});
		
		myRequest.get();
		
		//$('shadow_content').setStyle('display', 'block');
		$('white_content').setStyle('display', 'block');

	});
	

}); 

function close_conversation() {
	$('white_content').setStyle('display', 'none');
	return false;
}

function check_conversation_data() {
	var cust_name = $('cust_name').get('value');
	var cust_email = $('cust_email').get('value');
	var cust_phone = $('cust_phone').get('value');

	if (cust_name.trim() == '' || cust_email.trim() == '' || cust_phone.trim() == '') {
		alert('Please complete all the require fields marked with *');
		return false;	
	}

	return true;

}

function play_video() {
	var blackboxpos = 1100;
	var BlackBoxScrollTop = document.body.scrollTop;

	if (BlackBoxScrollTop == 0) {
	   	if (window.pageYOffset)
			BlackBoxScrollTop = window.pageYOffset;
	        else
			BlackBoxScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}

	BlackBoxScrollTop = BlackBoxScrollTop + 15;	
	
	
	var screenwidth = document.documentElement.clientWidth;		
	var screenheight = document.documentElement.clientHeight;
	var whiteboxpos = (screenwidth / 2) - 385;

	$('white_content').setStyle('left', whiteboxpos);
	$('white_content').setStyle('top', BlackBoxScrollTop);
	$('white_content').setStyle('height', '550px');
	
	$('white_content').set('html', '<center><object width="640" height="505"><param name="movie" value="http://www.youtube.com/v/gflB9hO4ZuE?fs=1&amp;hl=en_US&amp;autoplay=1"></param><param name="allowFullScreen" value="true"></param><param name="allowscriptaccess" value="always"></param><embed src="http://www.youtube.com/v/gflB9hO4ZuE?fs=1&amp;hl=en_US&amp;autoplay=1" type="application/x-shockwave-flash" allowscriptaccess="always" allowfullscreen="true" width="640" height="505"></embed></object></center><table width="650"><tr><td align="right"><a href="#" onclick="close_video(); return false;"><img src="/images/button.phtml?text=Close" border="0"></a></td></tr></table>');
	$('white_content').setStyle('display', 'block');
}

function play_video_two() {
	var blackboxpos = 1100;
	var BlackBoxScrollTop = document.body.scrollTop;

	if (BlackBoxScrollTop == 0) {
	   	if (window.pageYOffset)
			BlackBoxScrollTop = window.pageYOffset;
	        else
			BlackBoxScrollTop = (document.body.parentElement) ? document.body.parentElement.scrollTop : 0;
	}

	BlackBoxScrollTop = BlackBoxScrollTop + 15;	
	
	
	var screenwidth = document.documentElement.clientWidth;		
	var screenheight = document.documentElement.clientHeight;
	var whiteboxpos = (screenwidth / 2) - 385;

	$('white_content').setStyle('left', whiteboxpos);
	$('white_content').setStyle('top', BlackBoxScrollTop);
	$('white_content').setStyle('height', '400px');
	
	$('white_content').set('html', '<center><embed src="http://www.videodesk.net/embed/player.swf" allowscriptaccess="always" allowfullscreen="true" flashvars="height=310&amp;width=510&amp;file=http://www.videodesk.net/flv/45137/movie_1.flv&amp;searchbar=false&amp;repeat=list&amp;image=http://www.videodesk.net/flv/45137/1105.jpg&amp;volume=50&amp;autostart=true" height="310" width="520"><br><br><table width="650"><tr><td align="right"><a href="#" onclick="close_video(); return false;"><img src="/images/button.phtml?text=Close" border="0"></a></td></tr></table>');
	$('white_content').setStyle('display', 'block');
}

function close_video() {
	$('white_content').set('html', '');
	$('white_content').setStyle('display', 'none');
}

