function MM_findObj(n, d) { //v4.0
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && document.getElementById) x=document.getElementById(n); return x;
}

function MM_goToURL() { //v1.2
  for (var i=0; i< (MM_goToURL.arguments.length - 1); i+=2) //with arg pairs
   if (MM_goToURL.arguments[i+1]!="**")
    {
    eval(MM_goToURL.arguments[i]+".location='"+MM_goToURL.arguments[i+1]+"'");
    }
  document.MM_returnValue = false;
}	

function MM_changeProp(objName,x,theProp,theValue) { //v3.0
  var obj = MM_findObj(objName);
  if (obj && (theProp.indexOf("style.")==-1 || obj.style)) eval("obj."+theProp+"='"+theValue+"'");
}

function openhtmlWindow(sourceFile, windowWidth, windowHeight, distanceTop, distancLeft)
{
	pictureWindow = window.open(sourceFile, "plainwindow","width=" + windowWidth + ",height=" + windowHeight + ",top=" + distanceTop + ",left=" + distancLeft + ",toolbar=0,location=0,resizable=0,status=0,menubar=0,fullscreen=0,scrollbars=0");
	pictureWindow.focus();	
}

function openhtmlWindow_scroll(sourceFile, windowWidth, windowHeight, distanceTop, distancLeft)
{
	pictureWindow = window.open(sourceFile, "plainwindow","width=" + windowWidth + ",height=" + windowHeight + ",top=" + distanceTop + ",left=" + distancLeft + ",toolbar=0,location=0,resizable=0,status=0,menubar=0,fullscreen=0,scrollbars=1");
	pictureWindow.focus();	
}

// arak popup -----------------------------------------------------------------

var pictureWindow;
var isOpened;

function openWindow_arak(text1, text2, text3, windowWidth, windowHeight, distanceTop, distancLeft)
{
	pictureWindow = window.open("", "plainwindow","width=" + windowWidth + ",height=" + windowHeight + ",top=" + distanceTop + ",left=" + distancLeft + ",toolbar=0,location=0,resizable=0,status=0,menubar=0,fullscreen=0,scrollbars=0");

	pictureWindow.document.open();
	
	pictureWindow.document.write("<html>\n<head>\n\t<title>Harmonet</title>\n</head>\n<body marginwidth=\"0\" marginheight=\"0\" topmargin=\"0\" leftmargin=\"0\" bgcolor=\"#D3E9BF\" onUnload=\"window.opener.isOpened = false;\"><div id=\"feriLayer\"></div>\n</body>\n</html>");
	
	pictureWindow.focus();
	
	pictureWindow.document.close();

	isOpened = true;
}

function writePopup(text1, text2, text3, windowWidth, windowHeight, distanceTop, distancLeft)
{
	if (isOpened == true)
	{
		targetLayer = pictureWindow.document.getElementById('feriLayer');
		targetLayer.innerHTML = "<table cellpadding=\"3\" cellspacing=\"3\" align=\"left\" width=\"100%\" height=\"100%\" STYLE=\"border: 1px solid #008000;\" bgcolor=\"#ffffff\"><tr><td valign=\"top\" bgcolor=\"#DEEFCF\" STYLE=\"font : normal 12px Arial, Helvetica, sans-serif; text-align: left; color: #000000;\"><b>" + text1 + "</b></td><td valign=\"top\" bgcolor=\"#DEEFCF\" STYLE=\"font : normal 12px Arial, Helvetica, sans-serif; text-align: left; color: #000000;\">" + text2 + "</td><td valign=\"top\" bgcolor=\"#DEEFCF\" STYLE=\"font : normal 12px Arial, Helvetica, sans-serif; text-align: left; color: #000000;\"><B>" + text3 + "</B></td></tr></table>";
	
		pictureWindow.focus();
	}
	else
	{
		openWindow_arak(text1, text2, text3, windowWidth, windowHeight, distanceTop, distancLeft);
		writePopup(text1, text2, text3, windowWidth, windowHeight, distanceTop, distancLeft);
	}
}

//---------------------------------------------------------------------


function nesze(items){
   var plussed = "";
   for (var t = 1 ; t <= items.length ; t++) 
      {
      if (items.substring(t-1,t) == " ") 
         {  plussed+="+";  }
      else 
         {
	     if (items.substring(t-1,t) == "+") 
    	     {  plussed+="%2B";  }
     	 else 
        	 { plussed+=items.substring(t-1,t); }
		  }
      }
   return plussed;
}

function szotar(){
   var words2;
   words2 = tarform.query.value;
   var searchitems2;
   searchitems2=nesze(words2);
   var index2;
   index2 = tarform.melyik.selectedIndex;
   var site2;
   site2 = tarform.melyik.options[index2].value;
   site2+=searchitems2;
window.open(site2);
 }

//---------------------------------------------------------------------
// Parhoroszkophoz
//---------------------------------------------------------------------


function balcheck()
{
	if (document.pairs.sex1.options[document.pairs.sex1.selectedIndex].value != '0')
	{
		if (document.pairs.jegy1.options[document.pairs.jegy1.selectedIndex].value != '0')
		{
			seged = "/parhoroszkop/sajat/" + document.pairs.jegy1.options[document.pairs.jegy1.selectedIndex].value + document.pairs.sex1.options[document.pairs.sex1.selectedIndex].value + ".html";
			
			newWindow1 = window.open(seged, "plainwindow","width=500,height=300,top=10,left=10,toolbar=0,location=0,resizable=1,status=0,menubar=0,fullscreen=0,scrollbars=1");

			newWindow1.focus();
		}
		else 
		{
			alert("Nincs 'Jegy' megadva!");
		}
	}
	else 
	{
		alert("Nincs 'Nem' megadva!");
	}
}
//---------------------------------
function jobbcheck()
{
	if (document.pairs.sex2.options[document.pairs.sex2.selectedIndex].value != '0')
	{
		if (document.pairs.jegy2.options[document.pairs.jegy2.selectedIndex].value != '0')
		{
			seged = "/parhoroszkop/sajat/" + document.pairs.jegy2.options[document.pairs.jegy2.selectedIndex].value + document.pairs.sex2.options[document.pairs.sex2.selectedIndex].value + ".html";
			
			newWindow2 = window.open(seged, "plainwindow2","width=500,height=300,top=10,left=10,toolbar=0,location=0,resizable=1,status=0,menubar=0,fullscreen=0,scrollbars=1");

			newWindow2.focus();
		}
		else 
		{
			alert("Nincs 'Jegy' megadva!");
		}
	}
	else 
	{
		alert("Nincs 'Nem' megadva!");
	}
}
//---------------------------------
function compare_pairs(side)
{
	
	if (document.pairs.jegy1.options[document.pairs.jegy1.selectedIndex].value != '0' & document.pairs.jegy2.options[document.pairs.jegy2.selectedIndex].value != '0')
	{
		if(side == 'left')
		{
			pair1 = document.pairs.jegy1.options[document.pairs.jegy1.selectedIndex].value;
			pair2 = document.pairs.jegy2.options[document.pairs.jegy2.selectedIndex].value;
		}
		if(side == 'right')
		{
			pair1 = document.pairs.jegy2.options[document.pairs.jegy2.selectedIndex].value;
			pair2 = document.pairs.jegy1.options[document.pairs.jegy1.selectedIndex].value;
		}	
		
		newWindow3 = window.open("/parhoroszkop/compare.php?pair1=" + pair1 + "&pair2=" + pair2, "plainwindow3","width=500,height=300,top=10,left=10,toolbar=0,location=0,resizable=1,status=0,menubar=0,fullscreen=0,scrollbars=1");
		
		newWindow3.focus();
		
	}
	else 
	{
		alert("A 'Jegy'-ek nincsenek megadva!");
	}
	
	
}


