// JavaScript Document
mainWindow = window.opener;

function browseParentWindow(newUrl) {
	// Reference to parent-window.
	if(!mainWindow.closed){
		mainWindow.location = newUrl;
		mainWindow.focus();
	} else {
		window.open(newUrl);
	}
    return false;
}

//********************************************************************************************************************//
//********************************************************************************************************************//

var popUpWin=0;
/*function popUpWindow(URLStr, name, width, height, resizeable){
  if(popUpWin){
    if(!popUpWin.closed) popUpWin.close();
  }
  popUpWin = window.open(URLStr, name, 'menubar=0, location=0,status=0,scrollbars=1,,resizable='+ resizeable +',copyhistory=yes,width='+width+',height='+height);
  
popUpWin.window.moveTo((screen.width - width)/2, (screen.height - height)/2);
}*/

function popUpWindow(URLStr, name, width, height){
  if(popUpWin){
    if(!popUpWin.closed) popUpWin.close();
  }
 
  popUpWin = open(URLStr, 'popUpWin', 'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbar=yes,resizable=yes,copyhistory=yes,width='+width+',height='+height);
  popUpWin.window.moveTo((screen.width - width)/2, (screen.height - height)/2);
}

function UpdateParent(){
//parent.location.href="http://skoda.dk/modeller/v2-eksterior.asp?strModel=Octavia";
window.opener.location.href = "http://skoda.dk/modeller/v2-eksterior.asp?strModel=Octavia";
}

//********************************************************************************************************************//
//********************************************************************************************************************//
function validateFrameldingForm() {
	x = document.form2;
	at = x.Name.value
	if (at == '') 
	{
		alert('Husk at udfylde dit navn.');
		x.Name.focus();
		return false;
	}
	
	if (x.Email.value == "") 
	{
		alert("Husk at udfylde din email-adresse.");
		x.Email.focus();
		return false;
	}
	if (x.Email.value.indexOf("@") == -1) 
	{
		alert("Den angivne email-adresse er ikke gyldig.");
		x.Email.focus();
		return false;
	} 

	
}
//********************************************************************************************************************//
//********************************************************************************************************************//
function validateNyhederForm() {
	x = document.form1;
	at = x.Name.value
	if (at == '') 
	{
		alert('Husk at udfylde dit navn.');
		x.Name.focus();
		return false;
	}
	
	if (x.Email.value == "") 
	{
		alert("Husk at udfylde din email-adresse.");
		x.Email.focus();
		return false;
	}
	if (x.Email.value.indexOf("@") == -1) 
	{
		alert("Den angivne email-adresse er ikke gyldig.");
		x.Email.focus();
		return false;
	} 
	
	if (x.zipcode.value == "") 
	{
		alert("Husk at udfylde dit postnummer.");
		x.zipcode.focus();
		return false;
	}
	
}

//********************************************************************************************************************//
//********************************************************************************************************************//
function validateScoutForm() {
	x = document.scutform;
	at = x.Name.value
	if (at == '') 
	{
		alert('Husk at udfylde dit navn.');
		x.Name.focus();
		return false;
	}
	at = x.Address.value
	if (at == '') 
	{
		alert('Husk at udfylde dit adresse.');
		x.Address.focus();
		return false;
	}
	
	at = x.ZipCode.value
	if (at == '') 
	{
		alert('Husk at udfylde dit postnummer.');
		x.ZipCode.focus();
		return false;
	}
	
	at = x.ZipCode.value.length
	if (at > 4) 
	{
		alert('Postnummer skal bestå af max 4 cifre.');
		x.ZipCode.focus();
		return false;
	}
	
	at = x.City.value
	if (at == '') 
	{
		alert('Husk at udfylde by navn.');
		x.City.focus();
		return false;
	}
	at = x.Phone.value
	if (at == '') 
	{
		alert('Husk at udfylde dit tlf. nr.');
		x.Phone.focus();
		return false;
	}
	
	at = x.Phone.value.length
	if (at > 20) 
	{
		alert('Tlf. nr. skal bestå af max 20 cifre.');
		x.Phone.focus();
		return false;
	}
	
	
	
	if (x.Email.value == "") 
	{
		alert("Husk at udfylde din email-adresse.");
		x.Email.focus();
		return false;
	}
	if (x.Email.value.indexOf("@") == -1) 
	{
		alert("Den angivne email-adresse er ikke gyldig.");
		x.Email.focus();
		return false;
	} 
	
	
	
}