function PopUp(url/*,imgs,pic*/,windowname)
{
   var w=window.open(url,windowname,"status=0,menubar=0,resizable=1,toolbar=0,location=0");
/*  
	 var arrTemp=self.location.href.split("?"); 
   var picUrl = (arrTemp.length>0)?arrTemp[1]:""; 
   var NS = (navigator.appName=="Netscape")?true:false; 

       iWidth = (NS)?w.innerWidth:document.body.clientWidth; 
       iHeight = (NS)?w.innerHeight:document.body.clientHeight; 
       iWidth = document.images[0].width - iWidth; 
       iHeight = document.images[0].height - iHeight; 
       w.resizeBy(iWidth, iHeight); 
       self.focus();  
*/
}

function set_window_size(w,h)
{
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    window.innerWidth=w;
    window.innerHeight=h;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    document.documentElement.clientWidth=w;
    document.documentElement.clientHeight=h;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    document.body.clientWidth=w;
    document.body.clientHeight=h;
  }
}


function oc(id,pat)
{
	var cs=document.getElementById(id);
	var p=document.getElementById(id+"_picture");
//alert("img/colours/"+cs.options[cs.selectedIndex].value+".gif");
	p.src="img/colours/"+cs.options[cs.selectedIndex].value+pat+".gif";
}

function oc2(id,sel,max)
{
	for(var i=0;i<max;i++)
	{
			var p=document.getElementById(id+'_'+i);

			if(i==sel)
			{
				document.getElementById("base_colour").value=p.src.substring(p.src.lastIndexOf('/')+1,p.src.indexOf('.jpg'));						
				if(document.getElementById("base_colour").value.indexOf('_')>-1)
					 document.getElementById("base_colour").value=document.getElementById("base_colour").value.substring(0,document.getElementById("base_colour").value.indexOf('_'));
				//alert(document.getElementById("base_colour").value);
				if (p.src.indexOf('_p')==-1) // keret on
						p.src=p.src.substring(0,p.src.indexOf('.jpg'))+'_p.jpg';
						//alert("keret on:"+p.name+'='+p.src);
			}
		  else
			  if (p.src.indexOf('_p')>-1) // keret off
			  {
			  		p.src=p.src.substring(0,p.src.indexOf('_p'))+'.jpg';
			  		//alert("keret off:"+p.name+'='+p.src);
			  		//alert(p.src.substring(p.src.lastIndexOf('/')+1,p.src.indexOf('.jpg')));
			  }
	}
}

function change_product_pics(image_name) //,base_colour,model
{
//	alert(document.getElementById("product_picture_0").src);
	var pic0=document.getElementById("product_picture_0");
	var pic1=document.getElementById("product_picture_1");
	var base_colour=document.getElementById("base_colour").value;
	var modseli=document.getElementById("model").options['selectedIndex'];
	var model=document.getElementById("model").options[modseli].value;
	
	pic0.src="/img/products/new/"+image_name+"_"+base_colour+".jpg";
	pic1.src="/img/products/new/"+image_name+"_"+base_colour+"_"+model+".jpg";
	/*alert(image_name+"_"+base_colour+".jpg");
	alert(pic0+"_"+model+".jpg");*/
}

function menu(m,p)
{
	var pic=document.getElementById("b"+m);
	if(p==1)
		pic.src=pic.src.replace(/2./, "1.")
	else
		pic.src=pic.src.replace(/1./, "2.");
}

function IsAffiliate()
{
	if(document.reg_form.reg_affiliatecode.value.length<1)
	{
		alert("Nem adtál meg kedvezménykódot!");
		return false;
	}
	return true;
}

function IsContestName()
{
	if(document.reg_form.reg_name.value.length<1)
	{
		alert("Nem adtál meg felhasználónevet!");
		return false;
	}
	if(document.reg_form.reg_email.value.length<1)
	{
		alert("Nem adtál meg emailcímet!");
		return false;
	}
	if(document.reg_form.reg_password.value.length<1)
	{
		alert("Nem adtál meg jelszót!");
		return false;
	}
	if(document.reg_form.reg_name.value.match(/[áÁéÉíÍóÓöÖúÚüÜűŰ ]/))
	{
		alert("A felhasználónevedben nem lehet ékezet vagy szóköz!");
		return false;
	}
	if(document.reg_form.reg_address.value.length<1)
	{
		alert("Nem adtál meg címet!");
		return false;
	}
	if(document.reg_form.reg_tel.value.length<1)
	{
		alert("Nem adtál meg telefonszámot!");
		return false;
	}
	if(document.reg_form.reg_fullname.value.length<1)
	{
		alert("Nem adtál meg teljes nevet!");
		return false;
	}	
	if(document.reg_form.reg_accept.checked==false)
	{
		alert("Nem \"pipáltad ki\" a szabályok elfogadását!");
		return false;
	}	
	return true;
}

function IsFinish()
{
	if(document.finish_form.finish_form_email.value.length<1)
	{
		alert("Nem adtál meg emailcímet!");
		return false;
	}
	if(document.finish_form.finish_form_name.value.length<1)
	{
		alert("Nem adtál meg nevet!");
		return false;
	}
	if(document.finish_form.finish_form_address.value.length<1)
	{
		alert("Nem adtál meg címet!");
		return false;
	}
	return true;
}


function toggleVisibility(id)
{
		var e = document.getElementById(id); 
		if(e.style.visibility == 'hidden') 
				e.style.visibility = 'visible'; 
		else 
				e.style.visibility = 'hidden'; 
}

