// zintLib.js

/**********************************************************
 * İntegral Library
 * v 1.3
 **********************************************************/

// top.DEBUG_MODE is defined in conXXX/index.htm

var isIE = navigator.appName == 'Microsoft Internet Explorer'  ? true: false;
var isNS = navigator.appName == 'Netscape' ? true: false;
// Header format constants
SBJ = 1; // subject
HLP = 2; // help
DYK = 3; // do you know
REM = 4; // reminder
USE = 5; // usage

POPUP_WIN = "popupWin"; // Popup
POPUP_APP_HELP = "popupAppHelp"; // Popup Applet Help



/**********************************************************
 * User Interface
 **********************************************************/
 
/**********************************************************
 * Switch visibility of the object
 * warning: IE only
 **********************************************************/
function zintVisibleSwitch(obj){
	var theObj;
	if (isIE) {
		theObj = eval("document.all." + obj + ".style");
	} else if (isNS) {
		theObj = eval("document." + obj );
	}
	if (theObj.visibility == "hidden") {
		theObj.visibility="visible";
	} else {
		theObj.visibility="hidden";
	}
}


/**********************************************************
 * window operations 
 **********************************************************/


/**********************************************************
 * Pops up a window / EÖ
 **********************************************************/
function zintPopup(w, width, height) {
	w.resizeTo(width, height);
	moveTo(screen.availWidth/2 - width/2, screen.availHeight/2 - height/2);
	w.focus();
}

 
/**********************************************************
 * opens an term in "glossary" window
 **********************************************************/
function zintOpenGlossary(termID) {
	var w = window.open("content" + top.CONTENT + "-Glossary.htm#" + termID, "glossary", "toolbar=no, scrollbars=yes");
	w.focus();
}


/**********************************************************
 * opens referance in "reference" window
 **********************************************************/
function zintOpenReference(refID) {
	var w = window.open("content" + top.CONTENT + "-Reference.htm#" + refID, "reference", "toolbar=no, scrollbars=yes");
	w.focus();
}


/**********************************************************
 * opens referance in "reference" window
 **********************************************************/
function zintOpenPresentation(urlAddress) {
	var w = window.open(urlAddress, "", "left=20,top=20,width=600,height=550,toolbar=no, scrollbars=yes");
}


/**********************************************************
 * opens a popup window
 **********************************************************/
function zintOpenPopup(urlAddress) {
	openpopup = window.open(urlAddress, POPUP_WIN, "resizable=no,scrollbars=yes");
	openpopup.opener.name = "opener";
}


/**********************************************************
 * opens a popup window
 **********************************************************/
function zintOpenPopupA(urlAddress, features) {
	if (features == null) {
		features="width=275,height=285,left=0,top=50,resizable=no";
	}
	openpopup = window.open(urlAddress, POPUP_WIN, features);
	openpopup.opener.name = "opener";
}


/**********************************************************
 * opens a window
 **********************************************************/
function zintOpenWindow(urlAddress, features) {
	if (arguments.length == 1){
		var w = window.open(urlAddress, "", "toolbar=no, scrollbars=yes");
	} else if (arguments.length == 2){
			var w = window.open(urlAddress, "", features);
		}
}


/**********************************************************
 * opens a modal dialog box / EÖ
 **********************************************************/
function zintOpenModalDialog(urlAddress) {
	window.showModalDialog(urlAddress, "", "status=no");
}

/**********************************************************
 * opens a modal dialog box with given features / EÖ
 **********************************************************/
function zintOpenModalDialog(urlAddress, features) {
	if (features == null) {
		features="status=no";
	}
	window.showModalDialog(urlAddress, "", features);
}


/**********************************************************
 * close current window
 **********************************************************/
function zintCloseCurrentWindow() {
	close();
}


/**********************************************************
 * creates header
 **********************************************************/
function setHeader(config ,param1, param2) {
	var s = "";
	var title = "";
	
	function setPopupHeader(pTitle) {
		s +='<TABLE width=100% class="headerPopup">' + '\n';
		s +='  <TR>' + '\n';
		s +='    <TD valign="middle">' + '\n';
		s +='        &nbsp;' + pTitle + '\n';
		s +='    </TD>' + '\n';
		s +='    <TD align=right>' + '\n';
		s +='        <BUTTON type="button" onclick="zintCloseCurrentWindow()">Kapat</BUTTON>' + '\n';
		s +='    </TD>' + '\n';
		s +='  </TR>' + '\n';
		s +='</TABLE>' + '\n';
		return s;
	}

	switch (config) {
		// subject header where param1 is subject, param2 (optional) is subSubject
		case SBJ:
			s += '<TABLE class="subjectCon" width=100%>' + '\n';
			s += '  <TR>' + '\n';
			s += '    <TD align=left bgcolor=#FFFF00>' + '\n';
			if (arguments.length == 3){
				s += '      ' + param2 + '\n';
			}
			s += '    </TD>' + '\n';
			s += '    <TD align=right bgcolor=#FFFF00>'; + '\n'
			s += '      ' + param1 + '\n';
			s += '    </TD>' + '\n';
			s += '  </TR>' + '\n';
			s += '</TABLE>' + '\n';
			break;

		// popup window headers where param1 (optional) is title
		case DYK:
			if (arguments.length == 2){
				title = param1;
			} else {
				title = "Bunu biliyor muydunuz?";
			}
			setPopupHeader(title);
			break;
		case HLP:
			if (arguments.length == 2){
				title = param1;
			} else {
				title = "Yardım";
			}
			setPopupHeader(title);
			break;
		case REM:
			if (arguments.length == 2){
				title = param1;
			} else {
				title = "Hatırlatma";
			}
			setPopupHeader(title);
			break;
		case USE:
			if (arguments.length == 2){
				title = param1;
			} else {
				title = "Kullanım";
			}
			setPopupHeader(title);
			break;

		default:
			s += "default";
	}
	document.write(s);
	document.close();
}


/**********************************************************
 * generic get content  
/**********************************************************/
ZINT_ABOUT  = "About"
ZINT_BANNER = "Banner"
ZINT_INDEX  = "Index"
ZINT_MAIN   = "Main"
function zintGetContent(what) {
	return "zz" + CONTENT + "-" + what + ".htm";
}


/**********************************************************
 * Code hide
 **********************************************************/
function right(e) {
	var msg = "Lütfen kodumuz bize kalsın,\nPlease leave our code alone";
	if (isIE && event.button == 2) {
			alert(msg);
			return false;
	} else 
		if (isNS && e.which == 3) {
			alert(msg); 
			return false;
		} 
	return true;
}
// for HTML
/* ************************* dikkat duzelt *****************
if (!top.DEBUG_MODE) {
	document.onmousedown = right;
}
*/
// Code hide 




/**********************************************************
 *        * OBSELETE *            *
 **********************************************************/

/**********************************************************
 * OBSELETE / EO - 10.11.2000
 * opens a help window

function zintOpenHelp(urlAddress) {
	var w = window.open(urlAddress, "Help", "toolbar=no, scrollbars=yes");
}
 **********************************************************/


/**********************************************************
 * OBSELETE / EO - 10.11.2000
 * opens an HTML in "do you know" window
 
function zintOpenDoYouKnow(urlAddress) {
	var w = window.open(urlAddress, "doYouKnow", "toolbar=no, scrollbars=yes");
}
 **********************************************************/
