/**
 * Plugins for entire website activity
 *
 * @author		Gimi
 * @copyright	2009 MyGOV 1.0
 * @version		1.0
 * @since		2009.10.26
 */

/**
 * ViewPort Object - get the width / height / scroll infromation
 *
 * @param  string width - the viewPort width
 * @param  string height - the viewPort height
 * @param  string vScroll - the viewPort scroll
 */
viewPort = {
	offset : 20,
	width : $(window).width(),
	height : $(window).height(),
	vScroll : $(document).scrollTop(),
	hScroll : $(document).scrollLeft()
};


/**
 * Display div on page
 *
 * @param  string sDivID - the div ID that should be displayed
 * @return void
 */
function showDiv(sDivID, varEsc) {
	if (varEsc == null || varEsc === 'undefined') {
		varEsc = true;
	}
	
	$("#" + sDivID).overlay({ 
		top : 100,
	 	
	    expose: {
	        color: '#000',
	        loadSpeed: 100,
	        opacity: 0.5
	    },
	    
	    closeOnEsc: varEsc,
	    closeOnClick: false,
	    oneInstance: false, 
	    api: true
	}).load();
}


/**
 * Close div
 *
 * @param  string sDivID - the div ID that should be closed
 * @return void
 */
function hideDiv(sDivID) {
	$('#' + sDivID).overlay().close();
}


/**
 * Check the existing of a value in JS object
 *
 * @param  	string val - the object value
 * @param	object oObj - the object used to find
 * @return 	void
 */
function inObj(val, oObj) {
	for (i in oObj) {
		if (i == val) {
			return 1;
		}
	}
	
	return 0;
}
