/*	DARCY INDEX/CORE JAVASCRIPT
	FOR THE DARCY INDEX PAGE MODULE
	
	By: Ayman Habayeb/Crome Tysnomi since 2007
	
	NAMESPACE: index_
*/

// Dialog element
var dialog_error_screensize;

// Page INIT; Define the screensize error dialog and check the resolution at first load
function __init() {
	dialog_error_screensize = $('dialog_error_screensize');
	
	if (dialog_error_screensize) {
		index_checkRes();
	} else {
		setTimeout('__init()',15);
	}
}

function index_checkRes() {
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) {
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
		//IE 6+ in 'standards compliant mode'
		myWidth = document.documentElement.clientWidth;
		myHeight = document.documentElement.clientHeight;
	}

	if (myWidth < 600 || myHeight < 500) {
		delClass(dialog_error_screensize,'hide');
	} else { (hasClass(dialog_error_screensize,'hide')) ? false : addClass(dialog_error_screensize,'hide'); }

}

__init();
