//initilize namespace
Atrinsic = {}

jQuery.preloadImages = function()
{
  for(var i = 0; i<arguments.length; i++)
  {
    jQuery("<img>").attr("src", arguments[i]);
  }
}

function openVid(theVideo){
	$(document).ready(function(){
		 var thePath = "media/video?theVideo=/img/" + theVideo;
		tb_show("Video",thePath +"&modal=true&width=700&height=545",null,null);
	});
}

Atrinsic.submit_contact_form = function() {

    $('#send').click(function() {

        $.post("/submit",$("#contact-form").serialize(),function(data){
             if (data == 1) {
                 $("#contactWrap").html('<h5 id="contactBulletHeader">Contact </h5><p>469 7th Avenue  | New York, NY | 10018 | 212.273.1141</p><p class="blueCopy"><br>Thank you for your submission.  Someone will contact you shortly.</p>');
              } else {
                $("#errorFields").html(data);
                $("#errorFields").fadeIn('fast');
              }
            } 
        );   


      }
    );
}   

Atrinsic.submit_investor_form = function() {

    $('#inv-send').click(function() {
        $.post("/investorsubmit",$("#investor-form").serialize(),function(data){
             if (data == 1) {
                 $("#contactWrap").html('<p class="blueCopy"><br>Thank you for your submission.  Someone will contact you shortly.</p>');
              } else {
                $("#errorFields").html(data);
                $("#errorFields").fadeIn('fast');
              }
            } 
        );   


      }
    );
}   

Atrinsic.submit_mediakit_form = function() {

    $('#sendKit').click(function() {    	
        $.post("/mediakitsubmit",$("#mediakitForm").serialize(),function(data){
             if (data == 1) {
                 $("#formWrap").html('<p class="blueCopy"><br>Thank you for your submission.<br>Your download will begin shortly.<br>Click <a href="http://www.atrinsic.com/interactive/dwlmediakit" target="_blank">here</a> to download the file.</p>');
         		window.location.replace('http://www.atrinsic.com/interactive/dwlmediakit');                 
             } else {
                $("#errorFields").html(data);
                $("#errorFields").fadeIn('fast');
              }
            } 
        );   


      }
    );
}

Atrinsic.leadership_menu = function() {

    $("#leadership-link").click(function() {
        $("#leadership-subnav").slideToggle('fast');
    });

}


$currentActive = 'landingPage';

Atrinsic.leadership_trigger = function() {

    $(".leadership-trigger").hover(function() {
        $(this).css('color','#656565');
        $(this).css('text-decoration','underline');

    }, function() {
        $(this).css('color','#000000');
        $(this).css('text-decoration','none');
    }
    );
    

    $(".leadership-trigger").click(function() {
    	fadeThisLeader = $(this).attr('value');
        $("#"+$currentActive).fadeOut('fast',function(){
          $("#"+fadeThisLeader).fadeIn('fast');
        });
       $currentActive = $(this).attr('value');
   
    });

}

Atrinsic.easy_slider = function() {

	$("#slider").easySlider({
		prevText: '<span class="slide-buttons previous"><img src="../img/previous_property.png"> Previous Property</span>',
		nextText: '<span class="slide-buttons next">Next Property <img src="../img/next_property.png"></span>',
		orientation: 'horizontal'
	});
}

