// JavaScript Document


// code to resize iFrame to inserted HTML page
function adjustIFrameSize(id) {
    var myIframe = document.getElementById(id);
    if (myIframe) {
        if (myIframe.contentDocument && myIframe.contentDocument.body.offsetHeight) {
            // W3C DOM (and Mozilla) syntax
            myIframe.height = myIframe.contentDocument.body.offsetHeight;    
        } else if (myIframe.Document && myIframe.Document.body.scrollHeight) {
            // IE DOM syntax
            myIframe.height = myIframe.Document.body.scrollHeight;
        }
    }
}

function FP_getObjectByID(id,o) {//v1.0  
 var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
 else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
 if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
 for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
 f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
 for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
 return null;
}

function FP_changeProp() {//v1.0 - Changes the properties of an object
 var args=arguments,d=document,i,j,id=args[0],o=FP_getObjectByID(id),s,ao,v,x;
 d.$cpe=new Array(); if(o) for(i=2; i<args.length; i+=2) { v=args[i+1]; s="o"; 
 ao=args[i].split("."); for(j=0; j<ao.length; j++) { s+="."+ao[j]; if(null==eval(s)) { 
  s=null; break; } } x=new Object; x.o=o; x.n=new Array(); x.v=new Array();
 x.n[x.n.length]=s; eval("x.v[x.v.length]="+s); d.$cpe[d.$cpe.length]=x;
 if(s) eval(s+"=v"); }
}

function FP_LayerVisibility(layerName,layerVisibility){ // changes the visibility of a layer - eg hidden or visible - using FP_changeProp function above
	FP_changeProp(layerName,0,'style.visibility',layerVisibility)
}


function FP_callJS() {//v1.0
 eval(arguments[0]);
}

function newsItem(obj) 
{
	var el = document.getElementById(obj);
	if ( el.style.display != 'none' ) 
	{
		el.style.display = 'none';
	}
	else 
	{
		el.style.display = '';
	}
}

function IsNumeric(input)
{
	return (input - 0) == input && input.length > 0;
}

function popForm1(id)// Fills the form with the users selected option out of the selection field
{
	var idNo = document.getElementById(id).value;
	document.location.href = 'notice_board.php?notice_ID=' + idNo;	
}

function fillFormFields(a,b)
{
	a = "hello";
	document.getElemantById('Text1').value = a;
	
}

function openPhotoGallery()
{
	// Set page link
	var link = 'http://mj2.morganjames2.co.uk';
	// Get users page size
	w = screen.width;
	h = screen.height;
	// Open the link in a new page, maximised to the users screen dimension
	window.open(link,"",'width='+w+',height='+h+',top=0,left=0');
}





