﻿// JavaScript Document
function openMain(url, target){
	var screenWidth = screen.availWidth;
	var screenHeight = screen.availHeight;
	var refWidth = 1400;
	var refHeight = 900;

	if(screenWidth >= refWidth && screenHeight >= refHeight) { // IF SCREEN IS BIGGER THAN REF WIDTH & HEIGHT
		//alert("CAS 1 : REF H " + refHeight + " :"+(screenHeight - refHeight));
		//winMain = window.open(url,target, 'toolbar=no,resizable=yes,status=yes,scrollbars=no,width=' + refWidth + ',height=' + refHeight + ',left=' + (screenWidth - refWidth)*.5 + ',top=' + (screenHeight - refHeight)*.5 );
		winMain = window.open(url,target, 'toolbar=no,resizable=yes,status=yes,scrollbars=no,width=' + refWidth + ',height=' + screenHeight + ',left=' + (screenWidth - refWidth)*.5 + ',top=0');
		
	} else if(screenWidth >= refWidth && screenHeight < refHeight) { // ONLY REF WIDTH IS BIGGER
		//alert('CAS 2');
		winMain = window.open(url,target, 'toolbar=no,resizable=yes,status=yes,scrollbars=no,width='+ refWidth +',height=' + screenHeight +',left='+(screenWidth - refWidth) *.5 +',top=0');
	} else if(screenWidth < refWidth && screenHeight >= refHeight) { // ONLY REF HEIGHT IS BIGGER
		//alert('CAS 3');
		winMain = window.open(url,target, 'toolbar=no,resizable=yes,status=yes,scrollbars=no,width='+ screenWidth +',height=' + refHeight +',left=0,top='+(screenHeight - refHeight)*.5 );
	} else { // BOTH SCREEN VALUES SMALLER THAN REF
		//alert('CAS 4');
		winMain = window.open(url,target, 'toolbar=no,resizable=yes,status=yes,scrollbars=no,width='+ screenWidth +',height=' + screenHeight +',left=0,top=0');
	}
		winMain.focus();
}