var requiredInputs = new Array();
var optionalInputs = new Array();

function applyDefaultValue(elementid, val, required) {
	element = document.getElementById(elementid);
	element.value = val;
	element.onfocus = function() {
		if(this.value == val) {
			this.value = '';
		}
	}
	element.onblur = function() {
		if(this.value == '') {
			this.value = val;
		}
	}
	if (required == true) {
		requiredInputs[elementid] = val;
	} else {
		optionalInputs[elementid] = val;
	}	
}

function array_key_exists(key, arr) {
    // Checks if the given key or index exists in the array  
    // 
    // version: 1103.1210
    // discuss at: http://phpjs.org/functions/array_key_exists    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: Felix Geisendoerfer (http://www.debuggable.com/felix)
    // *     example 1: array_key_exists('kevin', {'kevin': 'van Zonneveld'});
    // *     returns 1: true
    // input sanitation 
	if (!arr || (arr.constructor !== Array && arr.constructor !== Object)) {
        return false;
    }
 
    return key in arr;
}

function in_array(needle, haystack, argStrict) {
    // Checks if the given value exists in the array  
    // 
    // version: 1103.1210
    // discuss at: http://phpjs.org/functions/in_array    // +   original by: Kevin van Zonneveld (http://kevin.vanzonneveld.net)
    // +   improved by: vlado houba
    // +   input by: Billy
    // +   bugfixed by: Brett Zamir (http://brett-zamir.me)
    // *     example 1: in_array('van', ['Kevin', 'van', 'Zonneveld']);    // *     returns 1: true
    // *     example 2: in_array('vlado', {0: 'Kevin', vlado: 'van', 1: 'Zonneveld'});
    // *     returns 2: false
    // *     example 3: in_array(1, ['1', '2', '3']);
    // *     returns 3: true    // *     example 3: in_array(1, ['1', '2', '3'], false);
    // *     returns 3: true
    // *     example 4: in_array(1, ['1', '2', '3'], true);
    // *     returns 4: false
    var key = '', strict = !! argStrict;
	
    if (strict) {
        for (key in haystack) {
            if (haystack[key] === needle) {
				return true;
            }
        }
    } else {
        for (key in haystack) {
			if (haystack[key] == needle) {
                return true;
            }
        }
    }
    return false;
}

$(window).load(function() {
	if($("#slider").length > 0) {
		$('#slider').nivoSlider({
			effect:'fade', // Specify sets like: 'fold,fade,sliceDown'
			slices:15, 
			boxCols:10, // For box animations
			boxRows:10, // For box animations
			animSpeed:500, // Slide transition speed
			pauseTime:3500, // How long each slide will show
			startSlide:0, // Set starting Slide (0 index)
			directionNav:false, // Next & Prev navigation
			controlNav:false, // 1,2,3... navigation
			keyboardNav:false, // Use left & right arrows
			pauseOnHover:false, // Stop animation while hovering
			manualAdvance:false, // Force manual transitions
			captionOpacity:0.8, // Universal caption opacity
		});
	}
});
