/* 
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */


	//init variables
	var me;
	var img = new Image();
	var linker;

	//getting id of swf for external interface interaction
	function getID( swfID ){
		 if(navigator.appName.indexOf("Microsoft") != -1){
			  me = window[swfID];
		 }else{
			  me = document[swfID];
		 }
	}

	//external interface javascript to actionscript call
	function js_to_as( str ){
		 $(function(){
		 	me.onChange(str);
			if ($('#temp').height() > 322) {
				$(img).fadeOut();
				window.setTimeout(hideWorkSub, 1500);
			}
		 });
	}

	//external interface actionscript output to jquery animation
	//***animates flash container to new height and displays image passed from flash xml parse
        function general_JS_call(str, link){
          linker = link;
          $(function(){
                scrollWin();
                if ($('#temp').height() <= 322) {
                        $('#temp').animate({height:450}, 500, function(){addImage(str);});
                }
                else {
                        addImage(str);
                }
          });
	}


        function scrollWin(){
            $('html, body').animate({
            scrollTop: $("#flash-wrapper").offset().top + 120
            }, 500);
        }


	function addImage(str) {
		$(function(){
                        $("#temp img").hide();
			$(img).load(function () {
				$('#temp').removeClass('loading').append(this);
				$(this).fadeIn();
			})

			.error(function () {
				alert ('sorry, this image cannot load at this time');
			})

			.attr('src', str);
                        $("#temp").unbind();
                        if (linker == "#"){
                            //do nothing
                        }
                        else if (linker == "prompt") {
                            $("#temp").click(function(){
                                $.fancybox(
		'<h2>This site is currently in development. Check back soon.</h2>',
		{
        		'autoDimensions'	: false,
			'width'         		: 350,
			'height'        		: 40,
			'transitionIn'		: 'none',
			'transitionOut'		: 'none'
		}
	);

                            });
                        }
                        else {
                             $("#temp").click(function(){window.open(linker,"new")});
                        }
		 })
	}

	//shrink flash container replace image div so it doesnt display image.
	function hideWorkSub () {
		$(function(){
			$('#temp').animate({height:0}, 1000, function(){});
	 	});
	}

	//top navigation rollover animation plugin integration
        $(function() {
            $("#1, #2, #3").lavaLamp({
                            fx: "backout",
                            speed: 700,
                            click: function(event, menuItem) {
                                    return false;
                            }
            });
	});

        $(document).ready(function(){


            $(".iframe").fancybox();


            $("#hidr").click (function () {
                    hideWorkSub();
            });


        });

        $(function(){
            $(".facebook").mouseover(function(){
                    $(this).animate({
                        backgroundPosition: '(0px -78px)'
                      });
           });
            $(".facebook").mouseout(function(){
                    $(this).animate({
                        backgroundPosition: '(0px 0px)'
                      });
           });


            $(".twitter").mouseover(function(){
                    $(this).animate({
                        backgroundPosition: '(0px 0px)'
                      });
           });
            $(".twitter").mouseout(function(){
                    $(this).animate({
                        backgroundPosition: '(0px -98px)'
                      });
           });


            $(".l-columns .image-container img").hover(function(){
                    $(this).parent().animate({
                        backgroundPosition: '(0px -81px)'
                      });
            });

            $(".l-columns .image-container img").mouseout(function(){
                    $(this).parent().animate({
                        backgroundPosition: '(0px 0px)'
                      });
            });
        });


