/**                                                           
 * This File Defines All common functions and objects that are used throughout the Javascript Framework
 *
 * @author Sal Bordonaro, designertechnology.com.au
 *
 */                                                                                                                                                                                                                                 /*
 

/* JS Shortcuts  */
function $() 			{ return document.getElementById(arguments[0]);} 

/**
 * @since 1.0.04.2008108_2
 */
function isDefined(type) {
  return (type != 'undefined' && type != 'unknown');
}

function isEmpty(s){return ((s=='')||/^\s*$/.test(s));}

 
function $S() 			{ if($(arguments[0]))	return $(arguments[0]).style; return 0;} 



/* Parsing & Cast Functions */
function $pI(str)		{ return parseInt(str); }; 
function $tp(i,j) 		{ var s = false; if(!isNaN(parseInt(i))) {j = isNaN(parseInt(i));s = true;}return s; }; 
function TryParse(i,j) 	{ var s = false; if(!isNaN(parseInt(i))) {j = isNaN(parseInt(i));s = true;}return s; }; 

/* Style Functions 
 *
 * Requires $S(x)
 */
function $O(v,id,s,top)	{ var ob=$S(id),b=v/100; ob.opacity=b; ob.MozOpacity=b; ob.KhtmlOpacity=b;ob.filter="alpha(opacity="+v+")"; } ;
function IOpacity(v,id,s,top) {var ob=$S(id),b=v/100; ob.opacity=b; ob.MozOpacity=b; ob.KhtmlOpacity=b;ob.filter="alpha(opacity="+v+")"; } 
function getOpacity(o) { var _r;	if($S(o).opacity){_r= parseInt($S(o).opacity*100);}; if($S(o).MozOpacity){_r= parseInt($S(o).MozOpacity*100);};	if($S(o).KhtmlOpacity){_r= parseInt($S(o).KhtmlOpacity*100);}; if($S(o).filter){_r= parseInt($S(o).filter); }; if(_r == "undefined") return 100; return _r; }

/* Misc */
function isset(v) { return((typeof(v)=='undefined' || v.length==0)?false:true); };

/* Browser Agent */
function $b(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); };

/* Used in Movable */
function xy(e,v) { return(v?($b('msie')?event.clientY+document.body.scrollTop:e.pageY):($b('msie')?event.clientX+document.body.scrollTop:e.pageX)); };







/**
 * Returns information back to the requester of the browserdocument/screen/Window deteail 
 * Reuires to be loaded after isset()
 *
 * Formally XYwin(v)
 *
 */
function xyw(v) { 
	var z=$b('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); 
	return(isset(v)?z[v]:z); 
};

/*
function XYwin(v) { 
	var z=$b('msie')?Array(document.body.clientHeight,document.body.clientWidth):Array(window.innerHeight,window.innerWidth); 
	return(isset(v)?z[v]:z); 
};
*/

/* Used in MakeMovable */
function agent(v) { return(Math.max(navigator.userAgent.toLowerCase().indexOf(v),0)); };

/* Used in MakeMovable 
function xy(e,v) { return(v?(agent('msie')?event.clientY+document.body.scrollTop:e.pageY):(agent('msie')?event.clientX+document.body.scrollTop:e.pageX)); };
*/
