$(document).ready(function() {

//When you click on a link with class of poplight and the href starts with a # 
$('a.modal-form-light[href^=#]').click(function() {
    var popID = $(this).attr('rel'); //Get Popup Name
  //  var popURL = $(this).attr('href'); //Get Popup href to define size

    //Pull Query & Variables from href URL
  //  var query= popURL.split('?');
   // var dim= query[1].split('&');
    var popWidth = 500;   

    //Fade in the Popup and add close button
    $('#' + popID).fadeIn().css({ 'width': Number( popWidth ) }).prepend('<a href="#" class="close"><img src="close_pop.png" class="btn_close" title="Close Window" alt="Close" /></a>');


    var popMargTop = ($('#' + popID).height() + 80) / 2;
    var popMargLeft = ($('#' + popID).width() + 80) / 2;

    //Apply Margin to Popup
    $('#' + popID).css({
        'margin-top' : -popMargTop,
        'margin-left' : -popMargLeft
    });

    //Fade in Background
    $('body').append('<div id="fade"></div>'); 
    $('#fade').css({'filter' : 'alpha(opacity=80)'}).fadeIn(); 

    return false;
});

//Close Popups and Fade Layer
$('a.close, #fade').live('click', function() { 
    $('#fade , .popup_block').fadeOut(function() {
        $('#fade, a.close').remove();  
    });
    return false;
});
	   
 $('#ej-slider').ejslider({ width: 700, height:315,hoverpause:true,titlespeed:500, navigation: true, delay: 6000 , effect: 'straight'});

});




