﻿// JScript File
var ack = false;

function AboutUs() {
	$('aboutus').show();
}
function AboutUsClose() {
	$('aboutus').hide();
}
function Page_OnLoad()
{
		var item =$('cmdSearch');
		Event.observe(item, 'click', function() {
			//Searching();});
			Disclaimer();});
			
		var item2 =$('cmdAboutUs');
		Event.observe(item2, 'click', function() {
			//Searching();});
			AboutUs();});
			
		var item3 =$('cmdClose');
		Event.observe(item3, 'click', function() {
			//Searching();});
			AboutUsClose();});
			
	
		//Disclaimer();
		if ($('lblError').innerHTML == ''  && $F('txtNumber') == '')
		{
			ack = true;
		}
}

function Disclaimer() {

	//if($('lblError').innerHTML == '' && $F('txtNumber') == '')
	if ($F('txtNumber').length > 0)
	{
		if (ack == true)
		{
			// fade out other screen content
			var blockout = $(document.createElement('div'));
			blockout.id = 'blockout';
			blockout.addClassName('wait');
			blockout.setStyle({
				fontfamily: 'Arial, Helvetica, sans-serif',
				fontsize: '30px',
				fontweight: 'bolder',
				width: '100%',
				height: '100%',
				position: 'absolute',
				top: '0px',
				left: '0px',
				'z-index': '50'
			});
			var innerBlockout = $(document.createElement('div'));
			
			innerBlockout.id = 'innerBlockout';
			innerBlockout.setStyle({
				//fontfamily: 'Arial, Helvetica, sans-serif',
				//fontsize: '10px',
				//fontweight: 'bolder',
				width: '600px',
				//height: '200px',
				position: 'absolute',
				top: '10%',
				left: '26%',
				backgroundColor: '#000000',
				opacity: 0.9,
				'z-index': '51',
				border: 'solid 1px white'
			});
			innerBlockout.addClassName('Popup');
			innerBlockout.innerHTML = '<p>Search Conditions</p><br><p>I am a PET OWNER and I agree to the following:</p><br>1) I acknowledge that information to help facilitate the return of my pet may be contained on one or more of the microchip registries accessible via portal linkage from this website;<br><br>2) I am responsible for contacting and providing accurate information to EACH AND EVERY registry displayed from my enquiry relating to change of details of the recorded information;<br><br>';
			var btncontain1 = $(document.createElement('div'));
			btncontain1.addClassName('btncontain');
			var btn = $(document.createElement('button'));
			btn.innerHTML = 'I ACCEPT the above conditions';
			btncontain1.appendChild(btn);
			var btn_no = $(document.createElement('button'));
			btn_no.innerHTML = 'I dont ACCEPT the above conditions';
			btncontain1.appendChild(btn_no);
			innerBlockout.appendChild(btncontain1);
			
			var morestuff = $(document.createElement('div'));
			morestuff.innerHTML = '<br><br><p>I am acting on behalf of a SCANNING CENTRE and I agree to the following:</p><br>1) I accept that the microchip number I have scanned and are attempting to locate owner details for, may be listed on one or more of the microchip registries accessible via portal linkage from this website;<br><br>2) I accept that I will be responsible in contacting EACH AND EVERY registry displayed to ensure relevant owner information is obtained if available, to help facilitate the safe return to the owner/keeper of the pet;<br><br>';

			innerBlockout.appendChild(morestuff);
			var btncontain2 = $(document.createElement('div'));
			btncontain2.addClassName('btncontain');
			var btn2 = $(document.createElement('button'));
			btn2.innerHTML = 'I ACCEPT the above conditions';
			btncontain2.appendChild(btn2);
			
			var btn2_no = $(document.createElement('button'));
			btn2_no.innerHTML = 'I dont ACCEPT the above conditions';
			btncontain2.appendChild(btn2_no);
			innerBlockout.appendChild(btncontain2);
			blockout.appendChild(innerBlockout);
			document.body.appendChild(blockout);
			Event.observe(btn, 'click', function() {
					closeDisclaimer(btn,blockout,1);
				});
			Event.observe(btn_no, 'click', function() {
					closeDisclaimer(btn_no,blockout,0);
				});
			Event.observe(btn2, 'click', function() {
					closeDisclaimer(btn,blockout,1);
				});
			Event.observe(btn2_no, 'click', function() {
					closeDisclaimer(btn_no,blockout,0);
				});
		}
		else
		{
			Searching();
			$('form1').submit();
		}
	}
}

function closeDisclaimer(btn,blockout,submit) {
	blockout.remove();
	if (submit== 1 )
	{
		Searching();
		$('form1').submit();
	}
}

function Searching() {
	
	// fade out other screen content
	var blockout = $(document.createElement('div'));
	blockout.id = 'blockout';
	blockout.addClassName('wait');
	blockout.setStyle({
		fontfamily: 'Arial, Helvetica, sans-serif',
		fontsize: '30px',
		fontweight: 'bolder',
		width: '400px',
		height: '200px',
		position: 'absolute',
		top: '40%',
		left: '35%',
		backgroundColor: '#000000',
		opacity: 0.8,
		'z-index': '50'
	});
	blockout.innerHTML = '<br/>Please wait whilst I check the microchip registries for you<br /><br /><br /><img src="images/ani-busy.gif" alt=""/>'
	document.body.appendChild(blockout);
}

		
Event.observe(window, 'load', Page_OnLoad);


