function Init() {
	imgObj1 = new Image(); imgObj2 = new Image();
	imgObj1.src = '/img/design/calendarika-button-print-sel.png';
	imgObj2.src = '/img/design/calendarika-button-new-sel.png';
	getScreenResolution();
}

function printImage() {
	var imageObj = document.getElementById( 'res_img' );
//	ImageObjPath = imageObj.src;
//	ImageObjPath.replace(/min/,'max');
	var html = '<html><head><style type="text/css">img { float: left; margin: 0; padding: 0;}</style></head><body>';
	html += '<img src="' + document.getElementById( 'res_img' ).src.replace(/min/,'max') + '" />';
	html += '</body></html>';
	pwin = window.open('', "_blank");
	pwin.document.write(html);
	pwin.document.close();
	setTimeout("pwin.print()" ,20);
}

function getScreenResolution() {
	if( screen.width ) {
		var screenResolution = document.getElementById('screen_resolution');
		if( screenResolution ) {
			screenResolution.innerHTML += screen.width + 'x' + screen.height;
			showTag( 'screen_resolution' );
		}
	} else {
		return '';
	}
}

function openSaveDialog ( imgid, resolution ) {
	var _height = 620; var _width = 680;
	var img = document.getElementById('res_img');
	if( img.height / img.width != 0.75 ){ _height = 530; }
        var _top = (screen.availHeight/2) - _height / 2;
	var _left = (screen.availWidth/2) - _width / 2;
	var saveDialog = window.open( '/save_dialog/' + imgid + '/' + resolution + '/', 'saveDialogID', 'width=' + _width + ',height=' + _height + ',top=' + _top + ',left=' + _left + 'status=no,location=no,resizable=no,menubar=no,scrollbars=no' );
}

window.onload = Init;
