var Win1;

function displayWindow(url, width, height) {

	var rozm_x = width+20;
	var rozm_y = height+30;
	
	Win1 = window.open("","displayWindow1",'width=' + rozm_x + ',height=' + rozm_y + ',resizable=yes,scrollbars=no,menubar=no,top=0,left=0' );
	
	Win1.document.write('<head>');
	Win1.document.write('<title>Rubber Dragon</title>');
	Win1.document.write('<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">');
	Win1.document.write('</head>');
	Win1.document.write('<body bgcolor=#000000>');
	Win1.document.write('<a href="javascript:window.close()">');
	Win1.document.write('<img src="' + url + '" width=' + width + ' height=' + height + ' border=0' + ' alt="Close">');
	Win1.document.write('</a>');
	Win1.document.write('</body>');
	Win1.document.close();

}

function displayFlash(src, width, height) {

	var rozm_x = width+20;
	var rozm_y = height+30;

      Win1 = window.open("","displayFlash1",'width=' + rozm_x + ',height=' + rozm_y + ',resizable=yes,scrollbars=no,menubar=no,top=0,left=0' );

	Win1.document.write('<head>');
	Win1.document.write('<title>Web Film Clips and Video</title>');
	Win1.document.write('</head>');
	Win1.document.write('<BODY bgcolor=#000000>');
	Win1.document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + width + '" HEIGHT="' + height +'" id="torun01" ALIGN=""><PARAM NAME=movie VALUE="' + src + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="' + src + '" quality=high bgcolor=#FFFFFF  WIDTH="' + width + '" HEIGHT="' + height + '" NAME="" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
	Win1.document.write('</BODY>');
	Win1.document.close();

}

function displayPanorama(src, width, height) {

	var rozm_x = width+20;
	var rozm_y = height+30;

      Win1 = window.open("","displayFlash1",'width=' + rozm_x + ',height=' + rozm_y + ',resizable=yes,scrollbars=no,menubar=no,top=0,left=0' );

	Win1.document.write('<head>');
	Win1.document.write('<title>Virtual Panoramas 360 Degree Photography</title>');
	Win1.document.write('</head>');
	Win1.document.write('<BODY bgcolor=#000000>');
	Win1.document.write('<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,0,0" WIDTH="' + width + '" HEIGHT="' + height +'" id="torun01" ALIGN=""><PARAM NAME=movie VALUE="' + src + '"> <PARAM NAME=quality VALUE=high> <PARAM NAME=bgcolor VALUE=#FFFFFF> <EMBED src="' + src + '" quality=high bgcolor=#FFFFFF  WIDTH="' + width + '" HEIGHT="' + height + '" NAME="" ALIGN="" TYPE="application/x-shockwave-flash" PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>');
	Win1.document.write('</BODY>');
	Win1.document.close();

}

function wap()
{

	var rozm_x = 360;
	var rozm_y = 220;

    Win1 = window.open("","displayWindow1",'width=' + rozm_x + ',height=' + rozm_y + ',resizable=yes,scrollbars=no,menubar=no,top=0,left=0' );

	Win1.document.write('<head>');
	Win1.document.write('<title>Rubber Dragon Portfolio of Websites and Design Work</title>');
	Win1.document.write('<META HTTP-EQUIV="Content-Type" content="text/html; charset=iso-8859-1">');
	Win1.document.write('</head>');
	Win1.document.write('<body bgcolor=#ffffff>');
	Win1.document.write('<font size=2 face=arial>');
	Win1.document.write('<p align="justify">');
	Win1.document.write('Visit <b>www.adk.pl/wap</b> on your mobile phone.');
 	Win1.document.write('</p>');
	Win1.document.write('<p align="justify">');
	Win1.document.write('Alternatively you can view our Wap Site on an emulator available at ');
	Win1.document.write('<a href="http://gelon.net" target="Gelon">gelon.net</a> ');
	Win1.document.write('</p>');
	Win1.document.write('<p align=center>');
	Win1.document.write('<a href="javascript:window.close()">');
	Win1.document.write('close');
	Win1.document.write('</a>');
	Win1.document.write('</p>');
	Win1.document.write('</font>');
	Win1.document.write('</body>');
	Win1.document.close();
}

function isANumber(entry)
{
	tmp = entry.value;
	for(var i = 0; i < tmp.length; i++)
	{
		if ((!parseInt(tmp.charAt(i), 10)) && (tmp.charAt(i) != "0") && (tmp.charAt(i) != "+") && (tmp.charAt(i) != "/") && (tmp.charAt(i) != "-") && (tmp.charAt(i) != "(") && (tmp.charAt(i) != ")") && (tmp.charAt(i) != " "))
		{
			alert("Please correct the phone field.\n    Only digits and + / - ( ) can be used.");
			entry.value = entry.value.substring(0, (i));
			return false;
		}
	}
	return true;
}

function test_form_01() {

	if (form.name.value == "")
	{
  		alert("Please complete the name field");
		form.name.focus();
		return false;
	}

	if (form.email.value == "")
	{
  		alert("Please complete the email field");
		form.email.focus();
		return false;
	}
	
	if ( (form.email.value.indexOf("@") < 1) || ( (form.email.value.indexOf(".",(form.email.value.indexOf("@"))) ) - ( form.email.value.indexOf("@")) < 2) || ((form.email.value.length - form.email.value.lastIndexOf(".")) < 3 ) || ((form.email.value.length - form.email.value.lastIndexOf(".")) > 4 ) )
	{
		alert("Please correct the email field" );
		form.email.focus();
		return false;
	}

	if (form.phone.value == "")
	{
  		alert("Please complete the phone field");
		form.phone.focus();
		return false;
	}

	if (form.comments.value == "")
	{
		alert("Please complete comments field");
		form.comments.focus();
		return false;
	}

	return true;

}

function test_form_02() {

	if (form.name.value == "")
	{
  		alert("Please complete the name field");
		form.name.focus();
		return false;
	}

	if (form.email.value == "")
	{
  		alert("Please complete the email field");
		form.email.focus();
		return false;
	}
	
	if ( (form.email.value.indexOf("@") < 1) || ( (form.email.value.indexOf(".",(form.email.value.indexOf("@"))) ) - ( form.email.value.indexOf("@")) < 2) || ((form.email.value.length - form.email.value.lastIndexOf(".")) < 3 ) || ((form.email.value.length - form.email.value.lastIndexOf(".")) > 4 ) )
	{
		alert("Please correct the email field" );
		form.email.focus();
		return false;
	}

	if (form.phone.value == "")
	{
  		alert("Please complete the phone field");
		form.phone.focus();
		return false;
	}

	if ( (form.propose_day.value == "") || (form.propose_month.value == "") || (form.propose_year.value == "") )
	{
		if (form.comments.value == "")
		{
  			alert("Please complete proposed meeting date or comments field");
			form.phone.focus();
			return false;
		}
	}	

	return true;

}

// email news page : enews.html

var win;

function display ( okno , width, height )
{

	// zamykamy okno jesli bylo otwarte
//	if ( win && !win.closed) win.close();

	var rozm_x = parseInt(width);
	var rozm_y = parseInt(height);

	//weryfikujemy rozmiar okna

	if ( ! rozm_x || rozm_x < 100 || rozm_x > 1200 || ! rozm_y || rozm_y < 80 || rozm_y > 800 )
	{
		rozm_x = 600;
		rozm_y = 400;
	}

	rozm_x += 30;
	rozm_y += 20;

	win = window.open ( "", okno, 'width='+rozm_x + ',height='+rozm_y + ',resizable=yes,scrollbars=yes' );

	win.focus ();

}

function submitform ( form, okno , width, height, action )
{
	display ( okno, width, height );

	// we redirect CGI answer to new window
	form.target = okno;

	// we set destination for form
	form.action = action;

	form.submit();
}

function clearforms ()
{
	//we clear form

	var i = 0;	

	while ( document.forms[i] )
	{
		document.forms[i].reset();
		i++;
	}

}



// free site evaluation page form : eng-evaluation.html

function test_form_site_evaluation() {

	if (form.website.value == "")
	{
  		alert("Please complete the website address field");
		form.website.focus();
		return false;
	}

	if ( (form.website.value.lastIndexOf(".") < 0) || ( (form.website.value.length - form.website.value.lastIndexOf(".")) < 3 ) || ( (form.website.value.length - form.website.value.lastIndexOf(".")) > 4 ) )
	{
  		alert("Please correct the website address field");
		form.website.focus();
		return false;
	}

	if (form.name.value == "")
	{
  		alert("Please complete the name field");
		form.name.focus();
		return false;
	}

	if (form.email.value == "")
	{
  		alert("Please complete the email field");
		form.email.focus();
		return false;
	}
	
	if ( (form.email.value.indexOf("@") < 1) || ( (form.email.value.indexOf(".",(form.email.value.indexOf("@"))) ) - ( form.email.value.indexOf("@")) < 2) || ((form.email.value.length - form.email.value.lastIndexOf(".")) < 3 ) || ((form.email.value.length - form.email.value.lastIndexOf(".")) > 4 ) )
	{
		alert("Please correct the email field" );
		form.email.focus();
		return false;
	}

	evaluation_true = false;
	for(var i=0; i<4; i++)
	{
		if (form.evaluation[i].checked == true)
			evaluation_true = true;
	}
	if (evaluation_true == false)
	{
  		alert("Please choose one of the evaluation tests");
		return false;
	}

	
	return true;

}

// form on site care pages : eng-care.html

function test_form_site_care() {

	if (form.website.value == "")
	{
  		alert("Please complete the website address field");
		form.website.focus();
		return false;
	}

	if ( (form.website.value.lastIndexOf(".") < 0) || ( (form.website.value.length - form.website.value.lastIndexOf(".")) < 3 ) || ( (form.website.value.length - form.website.value.lastIndexOf(".")) > 4 ) )
	{
  		alert("Please correct the website address field");
		form.website.focus();
		return false;
	}

	if (form.name.value == "")
	{
  		alert("Please complete the name field");
		form.name.focus();
		return false;
	}

	if (form.email.value == "")
	{
  		alert("Please complete the email field");
		form.email.focus();
		return false;
	}

	if ( (form.email.value.indexOf("@") < 1) || ( (form.email.value.indexOf(".",(form.email.value.indexOf("@"))) ) - ( form.email.value.indexOf("@")) < 2) || ((form.email.value.length - form.email.value.lastIndexOf(".")) < 3 ) || ((form.email.value.length - form.email.value.lastIndexOf(".")) > 4 ) )
	{
		alert("Please correct the email field" );
		form.email.focus();
		return false;
	}

	if (form.phone.value == "")
	{
  		alert("Please complete the phone field");
		form.phone.focus();
		return false;
	}

	return true;

}

// form on multimedia pages : eng-cdcard.html

function test_form_cdcard() {

	cover_true = false;
	for(var i=0; i<4; i++)
	{
		if (form.cover[i].checked == true)
			cover_true = true;
	}
	if (cover_true == false)
	{
  		alert("Please select the cover");
		return false;
	}

	if (form.name.value == "")
	{
  		alert("Please complete the name field");
		form.name.focus();
		return false;
	}

	if (form.email.value == "")
	{
  		alert("Please complete the email field");
		form.email.focus();
		return false;
	}

	if ( (form.email.value.indexOf("@") < 1) || ( (form.email.value.indexOf(".",(form.email.value.indexOf("@"))) ) - ( form.email.value.indexOf("@")) < 2) || ((form.email.value.length - form.email.value.lastIndexOf(".")) < 3 ) || ((form.email.value.length - form.email.value.lastIndexOf(".")) > 4 ) )
	{
		alert("Please correct the email field" );
		form.email.focus();
		return false;
	}

	if (form.phone.value == "")
	{
  		alert("Please complete the phone field");
		form.phone.focus();
		return false;
	}

	return true;

}

