
/* *******************************************************************************************
 *         BROWSER SNIFFER                                                                   *
 ******************************************************************************************* */

var platf = navigator.platform ;
var ua    = navigator.userAgent ;

var isNS  = (document.layers) ? 1 : 0 ;
var isIE  = (document.all) ? 1 : 0 ;
var isMoz = (document.getElementById) ? 1 : 0 ;

var isGecko   = inStr(ua,'Gecko') ;
var isOpera   = inStr(ua,'Opera') ;
var isWindows = inStr(platf,'Win32') ;
var isMac     = inStr(platf,'Mac') ;

var isIE55 = (isWindows && isIE && isMoz && (inStr(ua,'MSIE 5.5') || inStr(ua,'MSIE 6.0') || inStr(ua,'MSIE 6.5') || inStr(ua,'MSIE 7.0')) && !isOpera) ? 1 : 0 ;

function inStr(str,val,cas) {
	var ret ;
	if (cas) { /* Case sensitive */
		ret = (str.indexOf(val) != -1) ? true : false ;
	} else { /* Not Case sensitive */
		str = str.toUpperCase() ;
		val = val.toUpperCase() ;
		ret = (str.indexOf(val) != -1) ? true : false ;
	}
	return ret ;
}


/* *******************************************************************************************
 *         POPUP - Centered on the screen                                                    *
 ******************************************************************************************* */

function popWinOpen(winW,winH,sUrl,sName,iResize,iScroll) {
	if (screen) {
		if ((screen.height - winH) < 150) {
			var winX = (screen.width - winW) / 2;
			var winY = 0;
		} else {
			var winX = (screen.width - winW) / 2;
			var winY = (screen.height - winH) / 2;
		}
		var popWindow = window.open(sUrl,sName,"resizable=" + iResize + ",menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH + ",top=" + winY + ",left=" + winX + "");
		if (popWindow) popWindow.focus();
	} else {
		var popWindow = window.open(sUrl,sName,"resizable=yes,menubar=0,scrollbars=" + iScroll + ",width=" + winW + ",height=" + winH);
	}
}

//<A HREF="javascript: popWinOpen(600,560,'/path/file.ext','myWin',0,0)">Linktext</A>



/* *******************************************************************************************
 *         FUNCTIONS                                                                         *
 ******************************************************************************************* */

function sendToFriend(meta) {
	popWinOpen(380,410,"/jsp/sendtofriend/index.jsp?meta_id=" + meta,"SendToFriendWin",1,0) ;
}

function sendPostcard() {
	popWinOpen(380,585,"GetDoc?meta_id=1011","PostCardWin",1,0) ;
}

function addEvent() {
	popWinOpen(380,585,"/jsp/calendar/","EventWin",1,0) ;
}

function expertMail(meta) {
	popWinOpen(380,350,"/jsp/expert_mail.jsp?meta_id=" + meta,"ExpertWin",1,0) ;
}

function openTourFlash() {
	popWinOpen(760,600,"/user/tour_flash/","TourWin",1,0) ;
}

function openTourHtml() {
	popWinOpen(760,600,"/user/tour_html/","TourWin",1,0) ;
}

function openRendelar() {
	popWinOpen(780,600,"/user/rendelar/Rendelar_Loader.html","RendelarWin",1,0) ;
}

function openRenYear() {
	popWinOpen(780,600,"/user/8_arstider/8arstider_Loader.html","RenYearWin",1,0) ;
}

function orderBook() {
	popWinOpen(380,435,"/jsp/popup_book_order.jsp","orderWin",1,0) ;
}

function openFlashFromDocumentMenu(documentId, menuIndex) {
    var url = "/user/movie_flash/run_flash.jsp?documentId=" + documentId + "&menuIndex=" + menuIndex;
    popWinOpen(760,600,url,"FlushWin",1,0) ;
}



function winStatus(str) {
	if (str.indexOf("/") != -1) {
		str = "http://" + location.host + str ;
	}
	window.status = str ;
}


