var flashplayer = './scripts/player.swf';
// FLASH CODE FOR HOME PAGE VIDEO
var homeflashvars = {
	'file':'http://www.voicesandvisions.com/video/VandV_home.flv',
	'skin':'./scripts/skin/bluemetal.swf',
	'image':'./images/homevidpreview.jpg',
	'autostart':'false',
	'stretching':'fill'
};
var homeparams = {
	'allowfullscreen':'true',
	'allowscriptaccess':'always',
	'bgcolor':'#ffffff',
	'WMODE':'opaque'
};
var homeattributes = {
	'id':'videoDiv',
	'name':'videoDiv'
};

swfobject.embedSWF(flashplayer, 'videoDiv', '600', '442', '9', 'false', homeflashvars, homeparams, homeattributes);
//END

var aboutflashvars = {
	'file':'http://www.voicesandvisions.com/video/VandV_about.flv',
	'skin':'./scripts/skin/bluemetal.swf',
	'image':'./images/aboutvidpreview2.jpg',
	'autostart':'false',
	'stretching':'fill'
};
var aboutparams = {
	'allowfullscreen':'true',
	'allowscriptaccess':'always',
	'bgcolor':'#ffffff',
	'WMODE':'opaque'
};
var aboutattributes = {
	'id':'aboutVideoDiv',
	'name':'aboutVideoDiv'
};

swfobject.embedSWF(flashplayer, 'aboutVideoDiv', '600', '442', '9', 'false', aboutflashvars, aboutparams, aboutattributes);

var clientflashvars = {
	'file':'http://www.voicesandvisions.com/video/vandv_clients.flv',
	'skin':'./scripts/skin/bluemetal.swf',
	'image':'./images/clientvidpreview.jpg',
	'autostart':'false',
	'stretching':'fill'
};
var clientparams = {
	'allowfullscreen':'true',
	'allowscriptaccess':'always',
	'bgcolor':'#ffffff',
	'WMODE':'opaque'
};
var clientattributes = {
	'id':'clientVideoDiv',
	'name':'clientVideoDiv'
};

swfobject.embedSWF(flashplayer, 'clientVideoDiv', '600', '442', '9', 'false', clientflashvars, clientparams, clientattributes);

var ellenflashvars = {
	'file':'http://www.voicesandvisions.com/video/voices_bio_ellen.flv',
	'skin':'./scripts/skin/bluemetal.swf',
	'image':'./images/bio_pics_ellen.jpg',
	'autostart':'false',
	'stretching':'fill'
};
var ellenparams = {
	'allowfullscreen':'true',
	'allowscriptaccess':'always',
	'bgcolor':'#ffffff',
	'WMODE':'opaque'
};
var ellenattributes = {
	'id':'ellenVideoDiv',
	'name':'ellenVideoDiv'
};

swfobject.embedSWF(flashplayer, 'ellenVideoDiv', '307', '410', '9', 'false', ellenflashvars, ellenparams, ellenattributes);

var curtflashvars = {
	'file':'http://www.voicesandvisions.com/video/voices_bio_curt.flv',
	'skin':'./scripts/skin/bluemetal.swf',
	'image':'./images/bio_curt_video.jpg',
	'autostart':'false',
	'stretching':'fill'
};
var curtparams = {
	'allowfullscreen':'true',
	'allowscriptaccess':'always',
	'bgcolor':'#ffffff',
	'WMODE':'opaque'
};
var curtattributes = {
	'id':'curtVideoDiv',
	'name':'curtVideoDiv'
};

swfobject.embedSWF(flashplayer, 'curtVideoDiv', '307', '410', '9', 'false', curtflashvars, curtparams, curtattributes);

var krystalflashvars = {
	'file':'http://www.voicesandvisions.com/video/voices_bio_krystal.flv',
	'skin':'./scripts/skin/bluemetal.swf',
	'image':'./images/bio_pics_krystal.jpg',
	'autostart':'false',
	'stretching':'fill'
};
var krystalparams = {
	'allowfullscreen':'true',
	'allowscriptaccess':'always',
	'bgcolor':'#ffffff',
	'WMODE':'opaque'
};
var krystalattributes = {
	'id':'krystalVideoDiv',
	'name':'krystalVideoDiv'
};

swfobject.embedSWF(flashplayer, 'krystalVideoDiv', '307', '410', '9', 'false', krystalflashvars, krystalparams, krystalattributes);


//CODE for hover menus
$(document).ready(function () {
    $(".js #topmenu .menu ul li").eq(1).hoverIntent(
        //Mouseover, fadeIn the hidden hover class  
        function() {
            $(".js #topmenu .menu ul li ul:not(.current_page_child)").fadeIn('100'); 
        }, 
        //Mouseout, fadeOut the hover class
        function() {
            $(".js #topmenu .menu ul li ul:not(.current_page_child)").fadeOut('100');    
    });
});

//END

//CODE FOR TWITTER THINGY 
$(document).ready(function () {
	var onlyloadonce=0;
    $(".js #twitterico").hoverIntent(
        //Mouseover, fadeIn the hidden hover class  
        function() {
			if (onlyloadonce==0) { 
				$(".js #twitter").getTwitter({
					userName: "VoicesVisions",
					numTweets: 5,
					loaderText: "Loading tweets...",
					slideIn: true,
					showHeading: true,
					headingText: "Latest Tweets",
					showProfileLink: true
				});
	onlyloadonce=1;
	}
	else
	{
            $(".js ul#twitter_update_list").hide();
            $(".js #twitter").fadeIn('200').css('opacity',1); 
            $("ul#twitter_update_list").slideDown(500).delay('800');
	};
        }, 
        //Mouseout, fadeOut the hover class
        function() {
            $(".js #twitter").fadeOut('200');    
    }, 3000);
	$(".js #twitter").hoverIntent(
        //Mouseover, fadeIn the hidden hover class  
        function() {
            $(".js #twitter").stop().fadeIn('200').css('opacity',1).animate(); 
        }, 
        //Mouseout, fadeOut the hover class
        function() {
            $(".js #twitter").fadeOut('200');    
    });
});

//END
/*
$(document).ready(function () {
	  //Set Url of JSON data from the facebook graph api. make sure callback is set with a '?' to overcome the cross domain problems with JSON
      var url = "http://graph.facebook.com/Voices-Visions-Productions-Ltd/feed?limit=5&callback=?";
		
		//Use jQuery getJSON method to fetch the data from the url and then create our unordered list with the relevant data.
		$.getJSON(url,function(json){
		    var html = "<ul>";
				//loop through and within data array's retrieve the message variable.
		    	$.each(json.data,function(i,fb){
		      		html += "<li>" + fb.message + "</li>"; 
		    	});
		    html += "</ul>";
 
 
			//A little animation once fetched
			$('#facebookfeed').animate({opacity:0}, 500, function(){
 
					$('#facebookfeed').html(html);
 
																  });
 
		    $('#facebookfeed').animate({opacity:1}, 500);
		  
		});
 
 
});

*/

//
//
// JQUERY TWITTER
//
//
(function($) {
	/*
		jquery.twitter.js v1.0
		Last updated: 26 October 2008

		Created by Damien du Toit
		http://coda.co.za/blog/2008/10/26/jquery-plugin-for-twitter

		Licensed under a Creative Commons Attribution-Non-Commercial 3.0 Unported License
		http://creativecommons.org/licenses/by-nc/3.0/
	*/

	$.fn.getTwitter = function(options) {
		var o = $.extend({}, $.fn.getTwitter.defaults, options);
	
		// hide container element
		$(this).hide();
	
		// add heading to container element
		if (o.showHeading) {
			$(this).append('<h2>'+o.headingText+'</h2>');
		}

		// add twitter list to container element
		$(this).append('<ul id="twitter_update_list"><li></li></ul>');

		// hide twitter list
		$("ul#twitter_update_list").hide();

		// add preLoader to container element
		var pl = $('<p id="'+o.preloaderId+'">'+o.loaderText+'</p>');
		$(this).append(pl);

		// add Twitter profile link to container element
		if (o.showProfileLink) {
			$(this).append('<a id="profileLink" href="http://twitter.com/'+o.userName+'">Follow us on Twitter</a>');
		}

		// show container element
		$(this).show();
	
		$.getScript("http://twitter.com/javascripts/blogger.js");
		$.getScript("http://twitter.com/statuses/user_timeline/"+o.userName+".json?callback=twitterCallback2&count="+o.numTweets, function() {
			// remove preLoader from container element
			$(pl).remove();

			// show twitter list
			if (o.slideIn) {
				$("ul#twitter_update_list").slideDown(1000);
			}
			else {
				$("ul#twitter_update_list").show();
			}

			// give first list item a special class
			$("ul#twitter_update_list li:first").addClass("firstTweet");

			// give last list item a special class
			$("ul#twitter_update_list li:last").addClass("lastTweet");
		});
	};

	// plugin defaults
	$.fn.getTwitter.defaults = {
		userName: null,
		numTweets: 5,
		preloaderId: "preloader",
		loaderText: "Loading tweets...",
		slideIn: false,
		showHeading: true,
		headingText: "Latest Tweets",
		showProfileLink: true
	};
})(jQuery);



// HOVER INTENT
(function($){$.fn.hoverIntent=function(f,g){var cfg={sensitivity:7,interval:100,timeout:0};cfg=$.extend(cfg,g?{over:f,out:g}:f);var cX,cY,pX,pY;var track=function(ev){cX=ev.pageX;cY=ev.pageY};var compare=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);if((Math.abs(pX-cX)+Math.abs(pY-cY))<cfg.sensitivity){$(ob).unbind("mousemove",track);ob.hoverIntent_s=1;return cfg.over.apply(ob,[ev])}else{pX=cX;pY=cY;ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}};var delay=function(ev,ob){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t);ob.hoverIntent_s=0;return cfg.out.apply(ob,[ev])};var handleHover=function(e){var ev=jQuery.extend({},e);var ob=this;if(ob.hoverIntent_t){ob.hoverIntent_t=clearTimeout(ob.hoverIntent_t)}if(e.type=="mouseenter"){pX=ev.pageX;pY=ev.pageY;$(ob).bind("mousemove",track);if(ob.hoverIntent_s!=1){ob.hoverIntent_t=setTimeout(function(){compare(ev,ob)},cfg.interval)}}else{$(ob).unbind("mousemove",track);if(ob.hoverIntent_s==1){ob.hoverIntent_t=setTimeout(function(){delay(ev,ob)},cfg.timeout)}}};return this.bind('mouseenter',handleHover).bind('mouseleave',handleHover)}})(jQuery);
//END

// jQuery SWFObject v1.1.1 MIT/GPL @jon_neal
// http://jquery.thewikies.com/swfobject
(function(f,h,i){function k(a,c){var b=(a[0]||0)-(c[0]||0);return b>0||!b&&a.length>0&&k(a.slice(1),c.slice(1))}function l(a){if(typeof a!=g)return a;var c=[],b="";for(var d in a){b=typeof a[d]==g?l(a[d]):[d,m?encodeURI(a[d]):a[d]].join("=");c.push(b)}return c.join("&")}function n(a){var c=[];for(var b in a)a[b]&&c.push([b,'="',a[b],'"'].join(""));return c.join(" ")}function o(a){var c=[];for(var b in a)c.push(['<param name="',b,'" value="',l(a[b]),'" />'].join(""));return c.join("")}var g="object",m=true;try{var j=i.description||function(){return(new i("ShockwaveFlash.ShockwaveFlash")).GetVariable("$version")}()}catch(p){j="Unavailable"}var e=j.match(/\d+/g)||[0];f[h]={available:e[0]>0,activeX:i&&!i.name,version:{original:j,array:e,string:e.join("."),major:parseInt(e[0],10)||0,minor:parseInt(e[1],10)||0,release:parseInt(e[2],10)||0},hasVersion:function(a){a=/string|number/.test(typeof a)?a.toString().split("."):/object/.test(typeof a)?[a.major,a.minor]:a||[0,0];return k(e,a)},encodeParams:true,expressInstall:"expressInstall.swf",expressInstallIsActive:false,create:function(a){if(!a.swf||this.expressInstallIsActive||!this.available&&!a.hasVersionFail)return false;if(!this.hasVersion(a.hasVersion||1)){this.expressInstallIsActive=true;if(typeof a.hasVersionFail=="function")if(!a.hasVersionFail.apply(a))return false;a={swf:a.expressInstall||this.expressInstall,height:137,width:214,flashvars:{MMredirectURL:location.href,MMplayerType:this.activeX?"ActiveX":"PlugIn",MMdoctitle:document.title.slice(0,47)+" - Flash Player Installation"}}}attrs={data:a.swf,type:"application/x-shockwave-flash",id:a.id||"flash_"+Math.floor(Math.random()*999999999),width:a.width||320,height:a.height||180,style:a.style||""};m=typeof a.useEncode!=="undefined"?a.useEncode:this.encodeParams;a.movie=a.swf;a.wmode=a.wmode||"opaque";delete a.fallback;delete a.hasVersion;delete a.hasVersionFail;delete a.height;delete a.id;delete a.swf;delete a.useEncode;delete a.width;var c=document.createElement("div");c.innerHTML=["<object ",n(attrs),">",o(a),"</object>"].join("");return c.firstChild}};f.fn[h]=function(a){var c=this.find(g).andSelf().filter(g);/string|object/.test(typeof a)&&this.each(function(){var b=f(this),d;a=typeof a==g?a:{swf:a};a.fallback=this;if(d=f[h].create(a)){b.children().remove();b.html(d)}});typeof a=="function"&&c.each(function(){var b=this;b.jsInteractionTimeoutMs=b.jsInteractionTimeoutMs||0;if(b.jsInteractionTimeoutMs<660)b.clientWidth||b.clientHeight?a.call(b):setTimeout(function(){f(b)[h](a)},b.jsInteractionTimeoutMs+66)});return c}})(jQuery,"flash",navigator.plugins["Shockwave Flash"]||window.ActiveXObject);
//END

// Konami CODE
var Konami=function(){var a={addEvent:function(b,c,d,e){if(b.addEventListener)b.addEventListener(c,d,false);else if(b.attachEvent){b["e"+c+d]=d;b[c+d]=function(){b["e"+c+d](window.event,e)};b.attachEvent("on"+c,b[c+d])}},input:"",pattern:"3838404037393739666513",load:function(b){this.addEvent(document,"keydown",function(c,d){if(d)a=d;a.input+=c?c.keyCode:event.keyCode;if(a.input.length>a.pattern.length)a.input=a.input.substr(a.input.length-a.pattern.length);if(a.input==a.pattern){a.code(b);a.input=
""}},this);this.iphone.load(b)},code:function(b){window.location=b},iphone:{start_x:0,start_y:0,stop_x:0,stop_y:0,tap:false,capture:false,orig_keys:"",keys:["UP","UP","DOWN","DOWN","LEFT","RIGHT","LEFT","RIGHT","TAP","TAP","TAP"],code:function(b){a.code(b)},load:function(b){orig_keys=this.keys;a.addEvent(document,"touchmove",function(c){if(c.touches.length==1&&a.iphone.capture==true){c=c.touches[0];a.iphone.stop_x=c.pageX;a.iphone.stop_y=c.pageY;a.iphone.tap=false;a.iphone.capture=false;a.iphone.check_direction()}});
a.addEvent(document,"touchend",function(){a.iphone.tap==true&&a.iphone.check_direction(b)},false);a.addEvent(document,"touchstart",function(c){a.iphone.start_x=c.changedTouches[0].pageX;a.iphone.start_y=c.changedTouches[0].pageY;a.iphone.tap=true;a.iphone.capture=true})},check_direction:function(b){x_magnitude=Math.abs(this.start_x-this.stop_x);y_magnitude=Math.abs(this.start_y-this.stop_y);x=this.start_x-this.stop_x<0?"RIGHT":"LEFT";y=this.start_y-this.stop_y<0?"DOWN":"UP";result=x_magnitude>y_magnitude?
x:y;result=this.tap==true?"TAP":result;if(result==this.keys[0])this.keys=this.keys.slice(1,this.keys.length);if(this.keys.length==0){this.keys=this.orig_keys;this.code(b)}}}};return a};


$(document).ready(function () {
	konami = new Konami()
	//konami.pattern = "383838383838383838383838"
	konami.code = function() {
		$('.js #toasty').css('background-image', 'url("' + './images/Toasty_mk3.png' + '")');
		$(".js #toasty").delay(200).animate({width:'toggle'},300,function(){
      $(".js #toasty").delay(250).animate({width:'toggle'},300);
      });
		}
	konami.load()
});
// Konami CODE END
