$(document).ready(function() {
 jQuery.fn.centerScreen = function(loaded) {
	var obj = this;
	if(!loaded) {
			obj.css('top', $(window).height()/2-this.height()/2+$(window).scrollTop());
			obj.css('left', $(window).width()/2-this.width()/2+$(window).scrollLeft());
		$(window).resize(function(){ obj.centerScreen(!loaded); });
	} else {
			obj.stop();
			obj.animate({ top: $(window).height()/2-this.height()/2, left: $(window).width()/2-this.width()/2}, 200, 'linear');
	}
 }
}); 
function showInquiryForm()
{
	$('#light').centerScreen();
	$('#light').show('slow');
	$('#fade').show();
	$('#submit').focus();

	return;
}
function hideDiv(){
	$("#light").hide('slow');
	$("#fade").hide();
}
function showBanner(id,title){
	
	$('#id').val(id);
	$('#title').val(title);
	$('#invalidmsg').html('');
	$('#product_addto_cart').centerScreen();
	$('#product_addto_cart').show('slow');
	$('#fade').show();
	return;
}
function hideBanner(){
	$("#product_addto_cart").hide('slow');
	$("#fade").hide();
}
function hideBanner1(){
	this.window.close();
}
function emailForm(){
var daReferrer = document.frm_banner;
var email = "info@oaces.us";
var cc = "Hariharan.Chandrasekharan@Honeywell.com";
var subject = $('#title').val();
var mailto_link = 'mailto:'+email+'?cc='+cc+'&subject=Password request for presentation - '+subject;
win = window.open(mailto_link,'emailWindow');
if (win && win.open &&!win.closed) win.close();
} 
function openBanner(sitePath){
	var id = $('#id').val();
	var title = $('#title').val();
	var pass = $('#password').val();
	var ajaxPath=sitePath+"/classes/class.common.manipulation.php";
	$.post(ajaxPath,{"action_type":"check_password","id":id,"password":pass}, function(data)
	{	
		result = data.split("!");	
		if(result[0] == "V"){
			win = window.open(sitePath+'/banner.php','banner','resizable=yes,scrollbars=yes,toolbar=no,status=no,menubar=no,fullscreen=yes');
			win.focus();
		}else if(result[0] == "X"){
			$('#invalidmsg').html('&nbsp;&nbsp;|&nbsp;&nbsp;You have enter wrong password');
			$('#password').val('');
		}
	});
}



