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

function open_image(src, w, h, alttxt) {
	ww = w;
	wh = h;
	sh = screen.height;
	sbars = "";
	if (h+30 > sh) { 
		sbars = "scrollbars=yes,";
		wh = sh - 30;
		ww = ww + 20;
	}
	
	imageview = window.open("", "imageview", sbars + "width=" + ww + ",height=" + wh);
	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="/style.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="black" text="silver" link="orange" alink="yellow" vlink="orange" 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" alt="' + alttxt + '"/></a></body></html>');
	imageview.document.close();
	// imageview.document.oncontextmenu = RightClicker;
	
}

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 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=750,height=600");
	imageview.moveTo(Math.round((screen.width-750)/2), Math.round((screen.height-600)/2));
}

function open_apro_gallery(gid) {
	imageview = window.open("/bolhapiac/galeria.php?id=" + gid, "galleryview", "width=750,height=600");
	imageview.moveTo(Math.round((screen.width-750)/2), Math.round((screen.height-600)/2));
}


var addthis_pub="JOY.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;
}

