/* **************
 * Detect Browser
 ****************/

var rl = 0;

var ie = 0;
var ie_5 = 0;
var ns = 0;
var mz = 0;
var kq = 0;
var op = 0;

var glb_version;
var glb_platform;

function detectBrowser()
{
	var detect = navigator.userAgent.toLowerCase();
	var OS,browser,version,total,thestring;
	glb_version = parseInt(navigator.appVersion);

	if (checkIt('konqueror'))
	{
		kq=1;
		glb_platform = "linux";
	}
	else if (checkIt('opera')) op=1;
	else if (checkIt('msie')) ie=1;
	else if (!checkIt('compatible'))
	{
		mz=1;
	}

	if(ie) {
	ie_5 = (detect.indexOf("msie 5.0")!=-1);
	}


	if (!OS)
	{
		if (checkIt('linux')) glb_platform = "linux";
		else if (checkIt('mac')) glb_platform = "mac";
		else if (checkIt('win')) glb_platform = "win";
		else OS = glb_platform = "other";
	}


	function checkIt(string)
	{
		place = detect.indexOf(string) + 1;
		thestring = string;
		return place;
	}

}



function detectBrowser2()
{

	// convert all characters to lowercase to simplify testing
	var agt=navigator.userAgent.toLowerCase();

	// *** BROWSER VERSION ***
	// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
	var is_major = parseInt(navigator.appVersion);
	var is_minor = parseFloat(navigator.appVersion);
// *** BROWSER VERSION ***
	// Note: On IE5, these return 4, so use is_ie5up to detect IE5.
	var is_major = parseInt(navigator.appVersion);
	var is_minor = parseFloat(navigator.appVersion);

	// Note: Opera and WebTV spoof Navigator.  We do strict client detection.
	// If you want to allow spoofing, take out the tests for opera and webtv.
	var is_nav  = ((agt.indexOf('mozilla')!=-1) && (agt.indexOf('spoofer')==-1) && (agt.indexOf('compatible') == -1) && (agt.indexOf('opera')==-1) && (agt.indexOf('webtv')==-1) && (agt.indexOf('hotjava')==-1));
	var is_nav2 = (is_nav && (is_major == 2));
	var is_nav3 = (is_nav && (is_major == 3));
	var is_nav4 = (is_nav && (is_major == 4));
	var is_nav4up = (is_nav && (is_major >= 4));
	var is_navonly      = (is_nav && ((agt.indexOf(";nav") != -1) ||
						(agt.indexOf("; nav") != -1)) );
	var is_nav6 = (is_nav && (is_major == 5));
	var is_nav6up = (is_nav && (is_major >= 5));
	var is_gecko = (agt.indexOf('gecko') != -1);


	var is_ie     = ((agt.indexOf("msie") != -1) && (agt.indexOf("opera") == -1));
	var is_ie3    = (is_ie && (is_major < 4));
	var is_ie4    = (is_ie && (is_major == 4) && (agt.indexOf("msie 4")!=-1) );
	var is_ie4up  = (is_ie && (is_major >= 4));
	var is_ie5    = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.0")!=-1) );
	var is_ie5_5  = (is_ie && (is_major == 4) && (agt.indexOf("msie 5.5") !=-1));
	var is_ie5up  = (is_ie && !is_ie3 && !is_ie4);
	var is_ie5_5up =(is_ie && !is_ie3 && !is_ie4 && !is_ie5);
	var is_ie6    = (is_ie && (is_major == 4) && (agt.indexOf("msie 6.")!=-1) );
	var is_ie6up  = (is_ie && !is_ie3 && !is_ie4 && !is_ie5 && !is_ie5_5);

	// KNOWN BUG: On AOL4, returns false if IE3 is embedded browser
	// or if this is the first browser window opened.  Thus the
	// variables is_aol, is_aol3, and is_aol4 aren't 100% reliable.
	var is_aol   = (agt.indexOf("aol") != -1);
	var is_aol3  = (is_aol && is_ie3);
	var is_aol4  = (is_aol && is_ie4);
	var is_aol5  = (agt.indexOf("aol 5") != -1);
	var is_aol6  = (agt.indexOf("aol 6") != -1);

	var is_opera = (agt.indexOf("opera") != -1);
	var is_opera2 = (agt.indexOf("opera 2") != -1 || agt.indexOf("opera/2") != -1);
	var is_opera3 = (agt.indexOf("opera 3") != -1 || agt.indexOf("opera/3") != -1);
	var is_opera4 = (agt.indexOf("opera 4") != -1 || agt.indexOf("opera/4") != -1);
	var is_opera5 = (agt.indexOf("opera 5") != -1 || agt.indexOf("opera/5") != -1);
	var is_opera5up = (is_opera && !is_opera2 && !is_opera3 && !is_opera4);

	var is_webtv = (agt.indexOf("webtv") != -1);

	var is_TVNavigator = ((agt.indexOf("navio") != -1) || (agt.indexOf("navio_aoltv") != -1));
	var is_AOLTV = is_TVNavigator;

	var is_hotjava = (agt.indexOf("hotjava") != -1);
	var is_hotjava3 = (is_hotjava && (is_major == 3));
	var is_hotjava3up = (is_hotjava && (is_major >= 3));
	var is_js;
	if (is_nav2 || is_ie3) is_js = 1.0;
	else if (is_nav3) is_js = 1.1;
	else if (is_opera5up) is_js = 1.3;
	else if (is_opera) is_js = 1.1;
	else if ((is_nav4 && (is_minor <= 4.05)) || is_ie4) is_js = 1.2;
	else if ((is_nav4 && (is_minor > 4.05)) || is_ie5) is_js = 1.3;
	else if (is_hotjava3up) is_js = 1.4;
	else if (is_nav6 || is_gecko) is_js = 1.5;
	// NOTE: In the future, update this code when newer versions of JS
	// are released. For now, we try to provide some upward compatibility
	// so that future versions of Nav and IE will show they are at
	// *least* JS 1.x capable. Always check for JS version compatibility
	// with > or >=.
	else if (is_nav6up) is_js = 1.5;
	// NOTE: ie5up on mac is 1.4
	else if (is_ie5up) is_js = 1.3

	// HACK: no idea for other browsers; always check for JS version with > or >=
	else is_js = 0.0;
}

detectBrowser();


function resizeWorkArea() {

var __guruHeader = 232;
var __guruFooter = 0;
var __menuHeight = 431;
var __scrollPos = getWindowTop(getBaseWindow());
var _work   = getWorkWindow();
if( !_work ) return;

var wf = getWorkIFrame();
wf.style.height = '1px';

// A magasság minimális értékét az oldal magasságából számítjuk
min_height  = getWindowHeight(window.top) - __guruHeader - __guruFooter;
var doc_height  = getDocumentHeight(window.top) - __guruHeader - __guruFooter;

// A lapok méretei
work_height = 0;
if(_work) {
	work_height = getDocumentHeight(_work);
}

// A legnagyobb méret miválasztása
__height = Math.max(min_height,work_height);
__height = Math.max(__height,doc_height);

if(_work) {
	wf.style.height = __height+'px';
	wf.style.width = '625px';


// 	heightimage01: 1573
// 	heightimage02: 1143
// 	heightimage03: 1143

		var __m02height = __height - __menuHeight;
		if (__m02height < 0)	{
			__m02height = 0;

//			if (ie)	{
//				var __m01height = __menuHeight + 10;
//			}
//			else	{
				var __m01height = __menuHeight;
//			}
		}
		else	{
			var __m01height = __menuHeight + __m02height;
		}
		var __m03height = __m02height;

		getBaseWindow().document.getElementById('heightimage01').height=__m01height;
		getBaseWindow().document.getElementById('heightimage02').height=__m02height-75;
		getBaseWindow().document.getElementById('heightimage03').height=__m03height;

}
wf.style.visibility = 'visible';
setWindowTop(getBaseWindow(),__scrollPos);
}


function getControllerObject() {
var _main = getMainWindow();
return _main.__sello_controller;
}

function getGalleryControllerObject() {
var _main = getWorkWindow();
return _main.__sello_gallerycontroller;
}


function getMainWindow() {
var _work = getBaseWindow();
if(_work) {
	return _work.top;
}
return null;
}

function getBaseWindow() {
var _work = window.sellocentrum_main;
if(!_work && window.top) {
	_work = window.top.sellocentrum_main;
}
if(!_work && window.opener) {
	_work = window.opener.top.sellocentrum_main;
}
if (!_work && window.top.opener)	{
	_work = window.top.opener.sellocentrum_main;
}
return _work;
}

function setWorkLocation(host) {
var work = getWorkWindow();
setLocation(work,host);
}

function setLocation(win,loc) {
/*  var _work = getWorkWindow();
if(win==_work) {
	showWaiting(true);
} */
win.location.href = getLocation(loc);
}


function getWorkWindow()
{
var _work = getBaseWindow();
if(_work) {
	return _work.iframe_sello_work;
}
return null;
}




function getLocation(loc) {
return loc;
}

function NewCenteredWindow(mypage,myname,w,h){
	var winl = (screen.width-w)/2;
	var wint = (screen.height-h)/2;
	var settings ='height='+h+',';
	settings +='width='+w+',';
	settings +='top='+wint+',';
	settings +='left='+winl+',';
	settings +='scrollbars='+scroll+',';
	settings +='resizable=yes';
	win=window.open(mypage,myname,settings);
	if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

function imagePopUp(imageType,imageName,imageWidth,imageHeight,alt,posLeft,posTop)   // v4.01
{
	var header='sellocentrum.hu';
	newWindow = window.open("","newWindow","width="+imageWidth+",height="+imageHeight+",scrollbars=no,left="+posLeft+",top="+posTop);
	newWindow.document.open();
	newWindow.document.write('<html><title>'+header+'</title><body bgcolor="#FFFFFF" leftmargin="0" topmargin="0" marginheight="0" marginwidth="0" onBlur="self.close()">');

	if (imageType == "swf")
	{
	newWindow.document.write('<object classid=\"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000\" codebase=\"http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=5,0,0,0\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('<param name=movie value=\"'+imageName+'\"><param name=quality value=high>');
	newWindow.document.write('<embed src=\"'+imageName+'\" quality=high pluginspage=\"http://www.macromedia.com/shockwave/download/index.cgi?P1_Prod_Version=ShockwaveFlash\" type=\"application/x-shockwave-flash\" width=\"'+imageWidth+'\" height=\"'+imageHeight+'\">');
	newWindow.document.write('</embed></object>');
	}
	else
	{
	newWindow.document.write('<img src=\"'+imageName+'\" width='+imageWidth+' height='+imageHeight+' alt=\"'+header+'\">');
	}

	newWindow.document.write('</body></html>');
	newWindow.document.close();
	newWindow.focus();
}


function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (getBaseWindow().document.images && (getBaseWindow().preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			getBaseWindow().document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

function changeImagesGallery() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImagesGallery.arguments.length; i+=2) {
			document[changeImagesGallery.arguments[i]].src = changeImagesGallery.arguments[i+1];
		}
	}
}

function changeControllerLink(id,style)
{
	div = getWorkWindow().document.getElementById(id);

	if (!div)	{
		return false;
	}

	if (style == 'on')	{
		div.style.color='#292173';
	}

	if (style == 'off')	{
		div.style.color='#555555';
	}


}

var preloadFlag = false;
function preloadImages() {
	if (getBaseWindow().document.images) {
		getBaseWindow().sello_05_over = newImage("img/hu/sello_05-over.gif");
		getBaseWindow().sello_07_sello_05_over = newImage("img/hu/sello_07-sello_05_over.gif");
		getBaseWindow().sello_08_over = newImage("img/hu/sello_08-over.gif");
		getBaseWindow().sello_09_sello_08_over = newImage("img/hu/sello_09-sello_08_over.gif");
		getBaseWindow().sello_10_over = newImage("img/hu/sello_10-over.gif");
		getBaseWindow().sello_11_sello_10_over = newImage("img/hu/sello_11-sello_10_over.gif");
		getBaseWindow().sello_12_over = newImage("img/hu/sello_12-over.gif");
		getBaseWindow().sello_13_sello_12_over = newImage("img/hu/sello_13-sello_12_over.gif");
		getBaseWindow().sello_14_over = newImage("img/hu/sello_14-over.gif");
		getBaseWindow().sello_15_sello_14_over = newImage("img/hu/sello_15-sello_14_over.gif");
		getBaseWindow().sello_16_over = newImage("img/hu/sello_16-over.gif");
		getBaseWindow().sello_17_sello_16_over = newImage("img/hu/sello_17-sello_16_over.gif");
		preloadFlag = true;
	}
}

function preloadImagesGallery() {
	if (document.images) {
		getBaseWindow().galeria_09_over = newImage("img/hu/galeria_09-over.gif");
		getBaseWindow().galeria_11_over = newImage("img/hu/galeria_11-over.gif");
		preloadFlag = true;
	}
}

function writeSpan(win,name,value) {
if(win) {
	if(win.document) {
	var tag = win.document.getElementById(name);
	if(tag!=null && tag!='') {
		tag.innerHTML = value;
	}
	}
}
}

function getWindowTop(win)
{
var wintop = 0;
	if(ie) {
	if(win.document!=null) {
	return win.document.body.scrollTop;
	}
	}
	else {
	return win.pageYOffset;
	}
	return wintop;
}

function getWorkIFrame() {
/*@cc_on @*/
/*@if (@_jscript_version >= 5)	{

	try {
	var _iframe = window.top.sellocentrum_main.document.getElementById('iframe_sello_work');
	} catch (e) {
	var _iframe = null;
	}

	if (!_iframe)  {
		try {
		var _iframe = window.top.opener.sellocentrum_main.document.getElementById('iframe_sello_work');
		} catch (e) {
		var _iframe = null;
		}
	}
}

return _iframe;

/*@end @*/

var _iframe = window.top.sellocentrum_main.document.getElementById('iframe_sello_work');

if (!_iframe) {
	var _iframe = window.top.opener.sellocentrum_main.document.getElementById('iframe_sello_work');
}

return _iframe;

}

function getWindowHeight(win)
{
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)	{
	try {
		_body = win.document.body;
	} catch (e) {
		//alert('gettreeiframe');
		return 0;
	}
	}

	/*@end @*/

	_body = win.document.body;

	if(!_body) return 0;
	// Általában ez igaz
	if(ie || ns || mz || kq || op) {
		return _body.clientHeight;
	}
	// Ez a mac Safarinál bejöhet
	if(win.innerHeight!=null) {
		return win.innerHeight;
	}
	// Ha minden kötél szakad, megpróbáljuk ezt:
	return _body.clientHeight;
}

/**
 *	Visszatér az ablakban található tartalom teljes méretével
 *
 *	@param	window
 *			A vizsgált ablak referenciája
 *	@return int
 *			Az ablak tartalmának mérete
 */
function getDocumentHeight(win)
{
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)	{
	try {
		_body = win.document.body;
	} catch (e) {
		//alert('gettreeiframe');
		return 0;
	}
	}

	/*@end @*/

	if(!win.document) return 0;
	_body = win.document.body;

	if(!_body) return 0;
	// Az ms explorerekre windows alatt
	if(ie && glb_platform!='mac') {
		return _body.scrollHeight;
	}
	// A többi esetben
	else {
		return win.document.documentElement.offsetHeight;
	}

}

function scrollToWindowBotton(win)
{
	setWindowTop(win,getWindowHeight(win));
}

function setWindowTop(win,wintop)
{
	win.scroll(0,wintop);
/*

	if(ie) {
	if(win.document!=null) {
		win.document.body.scrollTop = wintop;
	}
	}
	else {
	win.scroll(0,wintop);
	}*/
	/*
	var _slip = getBetslipObject();
	if(_slip) {
	_slip.reset();
	}*/
}

function writeTitle(title)
{
var _work = getMainWindow();
if (!_work) {
	return;
}
_work.document.title = title;
}

function hidestatus(){
window.status=''
return true
}

function getWindowWidth(win)
{
	if(!win.document) return 0;
	if(!win.document.body) return 0;
	// Általában ez igaz
	if(ie || ns || mz || kp || op) {
		return win.document.body.clientWidth;
	}
	// Ez a mac Safarinál bejöhet
	if(win.innerWidth!=null) {
		return win.innerWidth;
	}
	// Ha minden kötél szakad, megpróbáljuk ezt:
	return win.document.body.clientWidth;
}

function getWindowHeight(win)
{
	/*@cc_on @*/
	/*@if (@_jscript_version >= 5)	{
	try {
		_body = win.document.body;
	} catch (e) {
		//alert('gettreeiframe');
		return 0;
	}
	}

	/*@end @*/

	_body = win.document.body;

	if(!_body) return 0;
	// Általában ez igaz
	if(ie || ns || mz || kq || op) {
		return _body.clientHeight;
	}
	// Ez a mac Safarinál bejöhet
	if(win.innerHeight!=null) {
		return win.innerHeight;
	}
	// Ha minden kötél szakad, megpróbáljuk ezt:
	return _body.clientHeight;
}

function kdjaf(aksjhd, ksjhfsa, qoewiur, sdzucvgxjh, sdhjhsdsd){
if (!sdhjhsdsd) sdhjhsdsd = '';
var svfdvbesrwe = ksjhfsa + "\u0040" + qoewiur + "." + aksjhd;
var vxysvcqwe = unescape('%6D%61%69%6C%74%6F%3A') + svfdvbesrwe;
if( ! sdzucvgxjh ) sdzucvgxjh = svfdvbesrwe;
document.write("<a href=\"" + vxysvcqwe + "\" style=\"" + sdhjhsdsd + "\">" + sdzucvgxjh + "</a>");}

