/**
 * Javascript init file
 * Initiates all javascript functionality used on this site
 *
 * @version 1.0
 * @copyright Sitemind Internet & Nieuwe Media, 18 February, 2010
 **/

/**
 * Internet Explorer does not have Array.indexOf implemented
 * 
 * @param {Mixed} obj The object to find
 * @return {Number} The index of obj or -1
 */
if(!Array.indexOf) {
	Array.prototype.indexOf = function(obj) {
		for(var i = 0; i < this.length; i++) {
			if(this[i] == obj) {
				return i;
			}
		}
		return -1;
	}
}

$(document).ready(function(){
	
    $("select").uniform();	
	
	/**
	 * Colorbox implementation
	 */
	if($("a[class='window-popup']").length) {
		$("a[class='window-popup']").colorbox({iframe:true, title:" ", width: '580px', height: '550px', initialWidth: '150px', initialHeight: '150px'});
	}
	if($("a[class~='hyves-popup']").length) {
		$("a[class~='hyves-popup']").colorbox({iframe:true, scrolling: true, title:" ", width: '580px', height: '500px', initialWidth: '150px', initialHeight: '150px'});
	}
	if($("a[class='image-popup']").length) {
		$("a[class='image-popup']").colorbox({title:" ", initialWidth: '150px', initialHeight: '150px'});
	}

	// initialize scrollable together with the navigator plugin
	$("#browsable").scrollable({circular: true}).navigator().autoscroll(5000);
	
	$(".work-link").click(function(){ window.location=$(this).find("a").attr("href");return false; });
	
	$('#show_hidden_items').click(function(){
		$('#hidden_items').slideDown('slow', function(){
			$('#show_hidden_items').slideUp('slow', function(){ $(this).remove()});
		});
		return false;
	});
	
	if($('#contact_message').length > 0) {
		$("textarea#contact_message").autoResize();
	}
	
});

