(function() {
try {
if(!ognc.exists) { throw "ogncObjUndefined"}

//Commonly used functions/helpers
ognc.utils = 
{
	
	/*Universal function to get parameter from url srting */
	getParameter : function(aP){var qS = new String(location.search.substring(1,location.search.length));var p = qS.split("&");var val = "";if(aP){for(i=0;i<p.length;i++){if(p[i].split( "=" )[0] == aP){val = p[i].split( "=" )[1];}}return val;}},
	
	getBaseUrl: function() {
		var urlparser = document.createElement('a');
		urlparser.href = window.location;
		return urlparser.protocol + "//" + urlparser.hostname + ((urlparser.port)? ":" + urlparser.port : "" );
	},

    nocacheRandom: function(){
        var axel = Math.random() + "";
        var ord = axel * 1000000000000000000;
        return ord;
    },
    
    new_window: function(options) {
			options.name	= options.name || "kotex_"+(new Date()).getMilliseconds();
			options.replace	= options.replace || false;
			options.width	= options.width || 1024;
			options.height	= options.height || 768;
			options.left	= options.left || (screen.availWidth - options.width) / 2;
			options.top		= options.top || ((screen.availHeight - options.height) / 2) - 40;
			
			var window_features = [];

			window_features.push("width=" + options.width);
			window_features.push("height=" + options.height);
			window_features.push("left=" + options.left);
			window_features.push("top=" + options.top);

			if (options.directories)	{ window_features.push("directories=" + options.directories); }
			if (options.location)		{ window_features.push("location=" + options.location); }
			if (options.menubar)		{ window_features.push("menubar=" + options.menubar); }
			if (options.resizable)		{ window_features.push("resizable=" + options.resizable); }
			if (options.scrollbars)		{ window_features.push("scrollbars=" + options.scrollbars); }
			if (options.status)			{ window_features.push("status=" + options.status); }
			if (options.toolbar)		{ window_features.push("toolbar=" + options.toolbar); }

			window.open(options.url, options.name, window_features.join(','), options.replace);
			if (options.close) window.close();
	}
	
}

} catch(e) { console.log("error: " + e);}
})();