//--------------------------------------clear contact box
function delField (object)
	{
	if ( document.getElementById(object).value.length<11 )
		{
		document.getElementById(object).value='';
		}
	}
//---------------------------------------------show email control panel login page	
function popup (id)
	{
	if (id=='mail')
		{
		if ( document.getElementById(id).style.display=='block' )	
			{
			document.getElementById(id).style.display='none';
			document.getElementById(id).innerHTML='';	
			}
		else
			{
			document.getElementById(id).style.display='block';
			document.getElementById(id).innerHTML='<iframe src="http://webmail.whiteclaw.co.uk" width="400px" height="341px" frameborder="0" scrolling="no"></iframe><span onclick=popup("'+id+'") class="link">CLOSE</span>';	
			}
		
		}
	}

//------------------------Java Cookies hanfling
function createCookie(name,value,days) {
	if (days) {
		var date = new Date();
		date.setTime(date.getTime()+(days*24*60*60*1000));
		var expires = "; expires="+date.toGMTString();
	}
	else var expires = "";
	document.cookie = name+"="+value+expires+"; path=/";
}

function readCookie(name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}
	return null;
}

function eraseCookie(name) {
	createCookie(name,"",-1);
}
//------------------------------Resize
function resize(name,value,days)
	{
	createCookie(name,value,days);
	var size = readCookie("size");
	if (size) {
			document.getElementById('content').style.fontSize=size;
			}
	var cont_type = readCookie("contType");
	if (cont_type) {
			document.getElementById('content').style.overflow=cont_type;
			if (cont_type=="overflow") {document.getElementById('page').style.height="550px";}
			if (cont_type=="visible") {document.getElementById('page').style.height="auto";}
			}
	}


//-----------------------------------------------Open popup

//----------------------------------------------------Simple Ajax

   var http_request = false;

   function makeRequest(url,put_into) {
		put_into_place = put_into;
       if (window.XMLHttpRequest) { // Mozilla, Safari,...
           http_request = new XMLHttpRequest();
       } else if (window.ActiveXObject) { // IE
           http_request = new ActiveXObject("Microsoft.XMLHTTP");
       }
       http_request.onreadystatechange = alertContents;
       http_request.open('GET', url, true);
       http_request.send(null);

   }

   function alertContents() {

       if (http_request.readyState == 4) {
           if (http_request.status == 200) {
               document.getElementById(put_into_place).innerHTML=(http_request.responseText);
           } else {
               alert('There was a problem with the request.');
           }
       }

   } 
