//Drop down menu
$(document).ready(function() {
    $(function () {
        $('.dropdown').each(function () {
            $(this).parent().eq(0).hover(function () {
                $('.dropdown:eq(0)', this).stop().show();
                }, function () {
                    $('.dropdown:eq(0)', this).hide();
            });
        });
    });
});

var initValue = -1;
var isTransformed = false;

function calcHeight(iFrame)
{
    //find the height of the internal page
    var the_height=document.getElementById(iFrame).contentWindow.document.body.scrollHeight;


    if (initValue == -1){
        initValue = the_height;
    }

    if (!isTransformed){
        the_height = initValue;
    }

    //change the height of the iframe
    document.getElementById(iFrame).height=the_height;

    //alert(the_height);
    if (isTransformed){
        isTransformed = false;
    }
    else {
        isTransformed = true;
    }

}

//Form Slider
$("document").ready(function(){   
    $("#dollars-rabais-500").live('hover',function(e) 
	{
		if(e.type=='mouseover')
        {
		$(this).stop();
			$('.form-contents label, .form-contents input, .form-contents button').fadeOut(0);
			$('fieldset.form-contents').addClass('large-rabais');
			$('fieldset.form-contents').css('margin',"0 0 0 -80px");
			$("fieldset.bigform").show();
			$('fieldset.hidden').css({'visibility' : 'visible' , 'height' : '22px'});
			$(this).animate({
			    width: "614px"
			}, 300, function(){
				$('fieldset.form-contents').animate({
					width: "700px"
				}, 1,function(){
				    $('.form-contents label, .form-contents input, .form-contents button').fadeIn(0);
				    });				
				}
			);
    	}
    	else
    	{
			$(this).stop();
            $(".form-contents",this).hide().removeClass('large-rabais');
			$(this).hide();
			$('fieldset.hidden').css('visibility' , 'hidden');
			
			$(this).animate(
			{
            	width: "135px"
            }, 200, function() 
            {
                $('fieldset.form-contents').css('width',"auto").css('margin',"0 0 0 0");
                $(".bigform").fadeOut(function()
                {
                });
                $('.form-contents').show();
                $('fieldset.hidden').css({'visibility' : 'visible' , 'height' : '0px'});
                $(".form-contents").show().removeClass('large-rabais');
            });
    	}
    });
});
