$(document).ready( function() {
	text = new Array();
	$("input[type='text']").each(function(){
		$(this).attr("ik", $(this).val());
	}).click(function(){
		if($(this).attr("value") == $(this).attr('ik')){
			$(this).attr("value", "");
		}
	}).blur(function(){
		if($(this).attr("value") == ""){
			$(this).attr("value", $(this).attr('ik'));
		}
	});
	var isiPad = navigator.userAgent.match(/iPad/i) != null;
	var isPhone = navigator.userAgent.match(/iPhone/i) != null;
	var isPod = navigator.userAgent.match(/iPod/i) != null;
	if(!isiPad && !isPhone && !isPod){
		$(".item").hover( function() {
			$(this).addClass("active");
		}, function() {
			$(this).removeClass("active");
		}).click( function() {
			url = $(this).find("a").attr("href");
			location.href = url;
		});
		var selectedId = 0;
		if($("#selected")){
			selectedId = parseInt($("#selected").text());
		}
		if(selectedId > 0){
			$("#mapHover"+selectedId).css("display", "block");
		}
		$("area").hover(function(){
			id = $(this).attr("alt");
			$(".maphover").css("display", "none");
			$("#mapHover"+id).css("display", "block");
			$("#worldLink"+id).addClass("hover");
		}, function(){
			$("#worldLink"+id).removeClass("hover");
			$(".maphover").css("display", "none");
			if(selectedId){
				$("#mapHover"+selectedId).css("display", "block");
			}
		});
		$(".worldLink").hover(function(){
			$(this).addClass("hover");
			id = $(this).attr("alt");
			$(".maphover").css("display", "none");
			$("#mapHover"+id).css("display", "block");
		}, function(){
			$(this).removeClass("hover");
			$(".maphover").css("display", "none");
			if(selectedId){
				$("#mapHover"+selectedId).css("display", "block");
			}
		});
	}
	$("#fileupload").customInputFile({
    	filename: "#fileup"
    }).hover(function(){
		css("cursor", "pointer");
	});
	$("#checkboxes>span").click(function(){
		input = $(this).find("input");
		checked = input.attr("checked");
		if(checked == 'checked'){
			input.removeAttr("checked");
		}else{
			input.attr("checked", "checked");
		}
	});
});
