var ctartomany = "evamagazin.hu";
var mtartomany = "marquardmedia.hu";
var protokoll = "mailto";


/*
function open_image(src, w, h) {
	imageview = window.open("", "imageview", "width=" + w + ",height=" + h);
	imageview.moveTo(Math.round((screen.width-w)/2), Math.round((screen.height-h)/2));
	imageview.document.open();
	imageview.document.write('<!doctype html public "-//W3C//DTD HTML 4.01 Transitional//EN">');
	imageview.document.write('<html><head><title>Kép megtekintése</title><link rel="stylesheet" type="text/css" href="/common.css" /><meta http-equiv="Content-type" content="text/html; charset=iso-8859-2" /><meta http-equiv="author" name="author" content="Mile Informatika - http://www.mile.hu/" /></head>');
	imageview.document.write('<body bgcolor="white" text="black" link="navy" alink="blue" vlink="navy" leftmargin="0" topmargin="0" marginwidth="0" marginheight="0" >');
	imageview.document.write('<a href="#" onClick="window.close();" ><img src="' + src + '" width="' + w + '" height="' + h + '" border="0" /></a></body></html>');
	imageview.document.close();
}
*/
function open_image(src, w, h) {
	new_open_image(src, w, h);
}

function show_hide_layer(layerid) {
	v = document.getElementById(layerid).style.visibility;
	if (v != "visible") v = "visible";
		else v = "hidden";
	document.getElementById(layerid).style.visibility = v;
}

function open_close_layer(layerid) {
	d = document.getElementById(layerid).style.display;
	if (d != "block") d = "block";
		else d = "none";
	document.getElementById(layerid).style.display = d;
}

function hide_layer(layerid) {
	if (layerid != "") {
		cucc = eval("$(" + layerid + ");");
		cucc.fadeOut("normal");
	} // document.getElementById(layerid).style.visibility = "hidden";
}

function show_layer(layerid) {
	if (layerid != "") {
		cucc = eval("$(" + layerid + ")");
		cucc.fadeIn("normal");
	} // document.getElementById(layerid).style.visibility = "visible";
}

function un_hun(szoveg) {
	var magyarbetuk = new Array(18);
	magyarbetuk[0] = "Á";
	magyarbetuk[1] = "É";
	magyarbetuk[2] = "Ó";
	magyarbetuk[3] = "Ö";
	magyarbetuk[4] = "Ő";
	magyarbetuk[5] = "Ú";
	magyarbetuk[6] = "Ü";
	magyarbetuk[7] = "Ű";
	magyarbetuk[8] = "Í";
	magyarbetuk[9] = "á";
	magyarbetuk[10] = "é";
	magyarbetuk[11] = "ó";
	magyarbetuk[12] = "ö";
	magyarbetuk[13] = "ő";
	magyarbetuk[14] = "ú";
	magyarbetuk[15] = "ü";
	magyarbetuk[16] = "ű";
	magyarbetuk[17] = "í";
	
	var latinbetuk = new Array(18);
	latinbetuk[0] = "A";
	latinbetuk[1] = "E";
	latinbetuk[2] = "O";
	latinbetuk[3] = "O";
	latinbetuk[4] = "O";
	latinbetuk[5] = "U";
	latinbetuk[6] = "U";
	latinbetuk[7] = "U";
	latinbetuk[8] = "I";
	latinbetuk[9] = "a";
	latinbetuk[10] = "e";
	latinbetuk[11] = "o";
	latinbetuk[12] = "o";
	latinbetuk[13] = "o";
	latinbetuk[14] = "u";
	latinbetuk[15] = "u";
	latinbetuk[16] = "u";
	latinbetuk[17] = "i";
	
	for (i=0; i<18; i++) szoveg = szoveg.replace(magyarbetuk[i], latinbetuk[i]);
	szoveg = szoveg.toLowerCase();
	return szoveg;
}


function stripwords(szoveg) {
	nemkell = new Array(8);
	nemkell[0] = "a";
	nemkell[1] = "az";
	nemkell[2] = "es";
	nemkell[3] = "egy";
	nemkell[4] = "the";
	nemkell[5] = "of";
	nemkell[6] = "with";
	nemkell[7] = "an";
	szoveg = un_hun(szoveg);
	for (i=0; i<8; i++) {
		szo = " " + nemkell[i] + " ";
		szoveg = szoveg.replace(szo, "");
	}
	szoveg = szoveg.replace(/[^a-z0-9_ -]/gi, "");
	szoveg = szoveg.replace(/ /gi, "-");
	return szoveg;
}

function rating_slider(rate) {
	eval("document.getElementById('ratingimg').src = ratingon" + rate + ".src;"); 
}

for (i=1; i<6; i++) {
	eval("ratingon" + i + " = new Image();");
	eval("ratingon" + i + ".src = \"/data/images/rating" + i + ".gif\";");
}


function rate_it(elementid, t, rate) {
	document.getElementById('ajaxframe').src = "/rateit.php?id=" + elementid + "&t=" + t + "&rating=" + rate;
}

function crating_slider(rate, gepid) {
	document.getElementById("cratingimg" + gepid).src = "/data/images/crating" + rate + ".gif";
}


function open_gallery(gid) {
	imageview = window.open("/cgaleria.php?id=" + gid, "galleryview", "width=700,height=660");
	imageview.moveTo(Math.round((screen.width-700)/2), Math.round((screen.height-600)/2));
}


var addthis_pub="PLAYBOY.hu";
var addthis_brand = "";
var addthis_header_color = "#ffffff";
var addthis_header_background = "#f50000";
var addthis_localize = {
	share_caption: "HA TETSZETT, OSZD MEG MÁSOKKAL IS!",
        email_caption: "Küldés e-mailben",
        email: "E-mail",
        favorites: "Kedvencek", 
        more: "Még több..."
};

function clevel_kuldes(hova) {
	window.location = protokoll + ":" + hova + "@" + ctartomany;
}

function mlevel_kuldes(hova) {
	window.location = protokoll + ":" + hova + "@" + mtartomany;
}


function getPageSize() {
	var xScroll, yScroll;
	var xScrollPos = document.body.scrollLeft;
	var yScrollPos = document.body.scrollTop;
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	var windowWidth, windowHeight;
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}
	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight, xScrollPos, yScrollPos);
	return arrayPageSize;
};



function new_open_image(src, w, h) {
	var arrPageSizes = getPageSize();
	posx = Math.abs(Math.round((arrPageSizes[2]-w)/2));
	// posy = Math.abs(dy + Math.round((arrPageSizes[3]-h)/2));
	posy = arrPageSizes[5] + Math.abs(Math.round(arrPageSizes[3]/2 - h/2));
	// posy = arrPageSizes[5];
	out = '<div id="overlaycontainer" style="left: ' + posx + 'px; top: ' + posy + 'px; width: ' + (w+2) + 'px; text-align: center; ">'; // height: ' + (h+20) + 'px;
	out += '<img src="' + src + '" width="' + w + '" height="' + h + '" border="1" alt="" /></div>';
	$('body').append('<div id="blackoverlay" style="display: none; position: absolute; top: 0; left: 0; z-index: 90; width: 100%; height: 100%;"></div>');
	$('body').append(out);
	
	$('#blackoverlay').css({
		backgroundColor:	'#000000',
		opacity:			0.8,
		width:				arrPageSizes[0],
		height:				arrPageSizes[1]
	}).fadeIn("slow", function() {
		$('#overlaycontainer').fadeIn("slow");
		
	});
	
	$('#blackoverlay').click(function() {
		$('#overlaycontainer').remove();
		$('#blackoverlay').remove();
	});
	
	$('#overlaycontainer').click(function() {
		$('#overlaycontainer').remove();
		$('#blackoverlay').remove();
	});
}
