// JavaScript Document

jQuery.fn.fixedLeft = function(){
return this.each(function(){
var element = jQuery(this);
centerElement();
jQuery(window).bind('resize',function(){
centerElement();
});			
function centerElement(){
var elementWidth = jQuery(element).outerWidth();
var elementHeight = jQuery(element).outerHeight();
var windowWidth = jQuery(window).width();
var windowHeight = jQuery(window).height();				
var X2 = windowWidth/2 - elementWidth/2;
var Y2 = windowHeight/2 - elementHeight/2;			
jQuery(element).css({'left':0,'top':Y2,'position':'fixed'});
}});}

jQuery.fn.fixedCenter = function(){
return this.each(function(){
var element = jQuery(this);
centerElement();
jQuery(window).bind('resize',function(){
centerElement();
});			
function centerElement(){
var elementWidth = jQuery(element).outerWidth();
var elementHeight = jQuery(element).outerHeight();
var windowWidth = jQuery(window).width();
var windowHeight = jQuery(window).height();				
var X2 = windowWidth/2 - elementWidth/2;
var Y2 = windowHeight/2 - elementHeight/2;			
jQuery(element).css({'left':X2,'top':Y2,'position':'fixed'});
}});}


$(document).ready(function() {

var loaderimg = "<img src='img/loader.gif' width='15' height='15'/>";

$.fn.pause = function(duration) {$(this).animate({ dummy: 1 }, duration);return this;};

$('.smallh').empty().hide().html("Share This Page Here ->").show(500);
$('#menu_links').hide();



$('#topbtn').fixedLeft();
$('#topbtn').click(function(){
$('html, body').animate({scrollTop:0}, 'slow');
return false;
});


/// open/close faq menu
$('#menu_faq').click(function(){
$('#menu_links').css({'visibility':'visible'}).slideToggle();
});
///


/// tbox_out
$('#tbox_outer').hide();
$('#tbox1').hide();
$('#tbox2').hide();
$('#tbox3').hide();
$('#tbox_outer').pause(1100).slideDown(500);
$('#tbox1').pause(1600).fadeIn(500);
$('#tbox2').pause(2100).fadeIn(500);
$('#tbox3').pause(2600).fadeIn(500);
///


///
$("#center_float").hide();
$("#blackout").hide();

$("#tbox1").click(function(){
$("#blackout").css({'visibility':'visible'}).fadeIn(500);		
$("#center_float").fixedCenter().show();
$("#center_float_title").html("Free Consultation Request");
$("#center_float_inner").html(loaderimg);
$("#center_float_inner").load("forms/freeconsultation/index.php");
});

$("#tbox2").click(function(){
$("#blackout").css({'visibility':'visible'}).fadeIn(500);
$("#center_float").fixedCenter().show();
$("#center_float_title").html("Request a Tri-Merge Credit Report");
$("#center_float_inner").html(loaderimg);
$("#center_float_inner").load("forms/requestreport/index.php");
});

$("#tbox3").click(function(){
$("#blackout").css({'visibility':'visible'}).fadeIn(500);
$("#center_float").fixedCenter().show();
$("#center_float_title").html("My Account");
$("#center_float_inner").html(loaderimg);
$("#center_float_inner").load("Admin/index.php");
});

$("#center_close").click(function(){	
$("#adminbox").css({"width":"676px","height":"100%"});
$("#center_float").css({"width":"700px","height":"425px"}).fadeOut(500);
$("#center_float_inner").css({"width":"676px","height":"369px"});
$("#blackout").fadeOut(500);
});
///




});
