function checkcontactform(){
  var error = false;
  var errormsg = 'ERROR!!! The following fields are mandatory:\n\n';
  if (document.getElementById('name').value == ''){
   errormsg = errormsg + ' - Name\n';
   error = true;
  }
  if (document.getElementById('email').value == ''){
   errormsg = errormsg + ' - Email\n';
   error = true;
  }
  if (document.getElementById('message').value == ''){
   errormsg = errormsg + ' - Message\n';
   error = true;
  }
  if (error == true){
   alert (errormsg);
  }
  else{
   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value)){
    myform=document.getElementById('contactform');								
    myform.method='post';
    myform.action='sendcontact.php';
    myform.submit();
   }
   else{
	alert("ERROR!!! That is not a valid email address.")
   }	  
  }
 }

function checksolutionsform(){
  var error = false;
  var errormsg = 'ERROR!!! The following fields are mandatory:\n\n';
  if (document.getElementById('name').value == ''){
   errormsg = errormsg + ' - Name\n';
   error = true;
  }
  if (document.getElementById('email').value == ''){
   errormsg = errormsg + ' - Email\n';
   error = true;
  }
  if (document.getElementById('message').value == ''){
   errormsg = errormsg + ' - Message\n';
   error = true;
  }
  if (error == true){
   alert (errormsg);
   return false;
  } else{
   if (/^\w+([\.-]?\w+)*@\w+([\.-]?\w+)*(\.\w{2,3})+$/.test(document.getElementById('email').value)){
   // do something
   }
   else{
	alert("ERROR!!! That is not a valid email address.")
        return false;
   }	  

if(error != true){
    myform=document.getElementById('contactform');								
    myform.method='post';
    myform.action='sendsolutionscontact.php';
    myform.submit();

}

  }
 }


 

function runAnims(){

}

function rabbitAnim(){
if(!document.getElementById('rabbitAnim')){
mCreateDiv('rabbitAnim');
} 

var anims = new Array();
anims[1] = '/assets/98/rabbits-anim.gif';
anims[2] = '/assets/98/frog-anim.gif';
anims[3] = '/assets/98/chicken-anim.gif';
anims[4] = '/assets/98/barbarian-anim.gif';
anims[5] = '/assets/98/caveman-anim.gif';
anims[6] = '/assets/98/caveman2-anim.gif';
anims[7] = '/assets/98/homer-anim.gif';
anims[8] = '/assets/98/pinkpanther-anim.gif';
anims[9] = '/assets/98/sonic-anim.gif';
anims[10] = '/assets/98/suprise-anim.gif';
anims[11] = '/assets/98/tiger-anim.gif';
random_num = (Math.round((Math.random()*10)+1));
randompos = (Math.round((Math.random()*200)+1));
anim = anims[random_num];
mDivPos('rabbitAnim',200 + randompos ,1,'absolute');
mDivOverflow('rabbitAnim','hidden');
mDivSize('rabbitAnim',200,200);
mDivInnerHTML('rabbitAnim','<img onmouseover="killrabbit()",10000);" src="'+anim+'">');
mDivAnimatePos('rabbitAnim',250  + randompos ,600  + randompos ,'15');
setTimeout("mDivAnimatePos('rabbitAnim',-1000  + randompos ,-1000 + randompos ,'15')",8000);
}

function killrabbit(){
mDivAnimatePos('rabbitAnim',-500,-600,'20');
}

function rss(colour){
w = 200;
h = 110;

startx = mMouseX();
starty = mMouseY();
endx = startx -w;
endy = starty -h - 50;

if(!document.getElementById('rss_holder')){
mCreateDiv('rss_holder');
} 

mDivPos('rss_holder',starty,startx,'absolute');
mDivOverflow('rss_holder','hidden');
mDivBackgroundColor('rss_holder','#FFFFFF');
mDivBorder('rss_holder','1','solid','#cccccc');
mDivSize('rss_holder',1,1);
mDivAnimatePos('rss_holder',endy,endx,'5');
mDivAnimateSizeTo('rss_holder',w,h,'6');
sendRequest('rss.php?id=rss');

log_this('rss popup','rss popup');
}

function close_rss(){
mDivAnimatePos('rss_holder',-1000,-1000,'10');
mDivAnimateSizeTo('rss_holder',50,50,'5');
}


function zoom_image(image_id){
w = 480;
h = 320;

startx = mMouseX();
starty = mMouseY();
endx = startx -w;
endy = starty;

if(!document.getElementById('zoom_image_holder')){
mCreateDiv('zoom_image_holder');
} 

mDivPos('zoom_image_holder',starty,startx,'absolute');
mDivOverflow('zoom_image_holder','hidden');
mDivBackgroundColor('zoom_image_holder','#FFFFFF');
mDivBorder('zoom_image_holder','1','solid','#cccccc');
mDivInnerHTML('zoom_image_holder','<span style="padding-left:10px;padding-top:3px" class="subgrey">Loading....</span>');
mDivSize('zoom_image_holder',1,1);
mDivAnimatePos('zoom_image_holder',endy,endx,'5');
mDivAnimateSizeTo('zoom_image_holder',w,h,'6');
sendRequest('zoom_image.php?id=zoom_image&image_id='+image_id);

log_this('zoom_image popup','zoom_image popup');
}

function close_zoom_image(){
mDivAnimatePos('zoom_image_holder',-1000,-500,'10');
mDivAnimateSizeTo('zoom_image_holder',50,50,'10');
}


function doSearch(){
query = document.getElementById('searchQuery').value;
if(query != ''){
search(query);
} else {
return false;
}
}

function search(query){
w = 520;
h = 415;

startx = mMouseX();
starty = mMouseY();
endx = startx + 100;
endy = starty - 200;

if(!document.getElementById('search_holder')){
mCreateDiv('search_holder');
} 

mDivPos('search_holder',starty,startx,'absolute');
mDivOverflow('search_holder','auto');
mDivBackgroundColor('search_holder','#FFFFFF');
mDivBorder('search_holder','1','solid','#cccccc');
mDivSize('search_holder',1,1);
mDivInnerHTML('search_holder','<span style="padding-left:10px;padding-top:3px" class="subgrey">Loading....</span>');
mDivAnimatePos('search_holder',endy,endx,'5');
mDivAnimateSizeTo('search_holder',w,h,'6');
sendRequest('search.php?id=search&query=' + query);

log_this('search ' + query,'search' + query);
}

function close_search(){
mDivAnimatePos('search_holder',-1000,-1000,'10');
mDivAnimateSizeTo('search_holder',1,1,'10');
}


function underconstruction(){
w = 200;
h = 110;

startx = mMouseX();
starty = mMouseY();
endx = startx;
endy = starty + 50;

if(!document.getElementById('underconstruction_holder')){
mCreateDiv('underconstruction_holder');
} 

mDivPos('underconstruction_holder',starty,startx,'absolute');
mDivOverflow('underconstruction_holder','hidden');
mDivBackgroundColor('underconstruction_holder','#FFFFFF');
mDivBorder('underconstruction_holder','1','solid','#cccccc');
mDivSize('underconstruction_holder',1,1);
mDivAnimatePos('underconstruction_holder',endy,endx,'5');
mDivAnimateSizeTo('underconstruction_holder',w,h,'6');
sendRequest('underconstruction.php?id=underconstruction');

log_this('under construction popup','under construction popup');
}

function close_underconstruction(){
mDivAnimatePos('underconstruction_holder',-200,-200,'10');
mDivAnimateSizeTo('underconstruction_holder',50,50,'5');
}


function emailform(subject){
w = 280;
h = 270;

startx = mMouseX();
starty = mMouseY();
endx = startx -w + w/2;
endy = starty -h + w/2;

if(!document.getElementById('emailform_holder')){
mCreateDiv('emailform_holder');
} 

mDivPos('emailform_holder',starty,startx,'absolute');
mDivOverflow('emailform_holder','hidden');
mDivBackgroundColor('emailform_holder','#FFFFFF');
mDivBorder('emailform_holder','1','solid','#cccccc');
mDivSize('emailform_holder',1,1);
mDivAnimatePos('emailform_holder',endy,endx,'5');
mDivAnimateSizeTo('emailform_holder',w,h,'6');
sendRequest('emailform.php?id=emailform&subject='+subject);
log_this('email form popup','email form popup');
}

function close_emailform(){
mDivAnimatePos('emailform_holder',-1000,-1000,'10');
mDivAnimateSizeTo('emailform_holder',50,50,'5');
}

function ireland(colour){
w = 200;
h = 140;

startx = mMouseX();
starty = mMouseY();
endx = startx -w + w/2;
endy = starty -h + h/2;

if(!document.getElementById('ireland_holder')){
mCreateDiv('ireland_holder');
} 

mDivPos('ireland_holder',starty,startx,'absolute');
mDivOverflow('ireland_holder','hidden');
mDivBackgroundColor('ireland_holder','#FFFFFF');
mDivBorder('ireland_holder','1','solid','#cccccc');
mDivSize('ireland_holder',1,1);
mDivAnimatePos('ireland_holder',endy,endx,'5');
mDivAnimateSizeTo('ireland_holder',w,h,'6');
sendRequest('ireland.php?id=ireland');
log_this('contact ireland  popup','contact ireland popup');
}

function close_ireland(){
mDivAnimatePos('ireland_holder',-1000,-1000,'10');
mDivAnimateSizeTo('ireland_holder',50,50,'5');
}

function usa(colour){
w = 200;
h = 140;

startx = mMouseX();
starty = mMouseY();
endx = startx -w + w/2;
endy = starty -h + h/2;

if(!document.getElementById('usa_holder')){
mCreateDiv('usa_holder');
} 

mDivPos('usa_holder',starty,startx,'absolute');
mDivOverflow('usa_holder','hidden');
mDivBackgroundColor('usa_holder','#FFFFFF');
mDivBorder('usa_holder','1','solid','#cccccc');
mDivSize('usa_holder',1,1);
mDivAnimatePos('usa_holder',endy,endx,'5');
mDivAnimateSizeTo('usa_holder',w,h,'6');
sendRequest('usa.php?id=usa');
log_this('contact usa popup','contact usa popup');
}

function close_usa(){
mDivAnimatePos('usa_holder',-1000,-1000,'10');
mDivAnimateSizeTo('usa_holder',50,50,'5');
}

function uk(colour){
w = 200;
h = 160;

startx = mMouseX();
starty = mMouseY();
endx = startx -w + w/2;
endy = starty -h + h/2;

if(!document.getElementById('uk_holder')){
mCreateDiv('uk_holder');
} 

mDivPos('uk_holder',starty,startx,'absolute');
mDivOverflow('uk_holder','hidden');
mDivBackgroundColor('uk_holder','#FFFFFF');
mDivBorder('uk_holder','1','solid','#cccccc');
mDivSize('uk_holder',1,1);
mDivAnimatePos('uk_holder',endy,endx,'5');
mDivAnimateSizeTo('uk_holder',w,h,'6');
sendRequest('uk.php?id=uk');
log_this('contact uk popup','contact uk popup');
}

function close_uk(){
mDivAnimatePos('uk_holder',-1000,-1000,'10');
mDivAnimateSizeTo('uk_holder',50,50,'5');
}

function ukmap(colour){
w = 480;
h = 480;

startx = mMouseX();
starty = mMouseY();
endx = startx -w + w/2;
endy = starty -h + h/2;

if(!document.getElementById('ukmap_holder')){
mCreateDiv('ukmap_holder');
} 

mDivPos('ukmap_holder',starty,startx,'absolute');
mDivOverflow('ukmap_holder','hidden');
mDivBackgroundColor('ukmap_holder','#FFFFFF');
mDivBorder('ukmap_holder','1','solid','#cccccc');
mDivSize('ukmap_holder',1,1);
mDivAnimatePos('ukmap_holder',endy,endx,'5');
mDivAnimateSizeTo('ukmap_holder',w,h,'6');
sendRequest('ukmap.php?id=ukmap');
log_this('ukmap popup','ukmap popup');
}

function close_ukmap(){
mDivAnimatePos('ukmap_holder',-1000,-1000,'10');
mDivAnimateSizeTo('ukmap_holder',50,50,'5');
}

function snow(colour){
w = 100;
h = 80;

startx = mMouseX();
starty = mMouseY();

endx = startx -w;
endy = starty -h - 50;

if(!document.getElementById('snow_holder')){
mCreateDiv('snow_holder');
} 

mDivPos('snow_holder',starty,startx,'absolute');
mDivOverflow('snow_holder','hidden');
mDivBackgroundColor('snow_holder','#FFFFFF');
mDivBorder('snow_holder','1','solid','#cccccc');
mDivSize('snow_holder',1,1);
mDivAnimatePos('snow_holder',endy,endx,'5');
mDivAnimateSizeTo('snow_holder',w,h,'6');
sendRequest('snow.php?id=snow');

}

function close_snow(){
mDivAnimatePos('snow_holder',-1000,-1000,'10');
mDivAnimateSizeTo('snow_holder',50,50,'5');
}

function bigbrother(colour){
w = 300;
h = 230;

startx = mMouseX();
starty = mMouseY();

endx = startx -w;
endy = starty -h - 50;

if(!document.getElementById('bigbrother_holder')){
mCreateDiv('bigbrother_holder');
} 

mDivPos('bigbrother_holder',starty,startx,'absolute');
mDivOverflow('bigbrother_holder','hidden');
mDivBackgroundColor('bigbrother_holder','#FFFFFF');
mDivBorder('bigbrother_holder','1','solid','#cccccc');
mDivSize('bigbrother_holder',1,1);
mDivAnimatePos('bigbrother_holder',endy,endx,'5');
mDivAnimateSizeTo('bigbrother_holder',w,h,'6');
sendRequest('bigbrother.php?id=bigbrother');
log_this('bigbrother popup','bigbrother popup');
}

function close_bigbrother(){
mDivAnimatePos('bigbrother_holder',-1000,-1000,'10');
mDivAnimateSizeTo('bigbrother_holder',50,50,'5');
}

function terms(colour){
w = 600;
h = 260;

startx = mMouseX();
starty = mMouseY();
endx = startx - 100;
endy = starty -h - 50;

if(!document.getElementById('terms_holder')){
mCreateDiv('terms_holder');
} 

mDivPos('terms_holder',starty,startx,'absolute');
mDivOverflow('terms_holder','hidden');
mDivBackgroundColor('terms_holder','#FFFFFF');
mDivBorder('terms_holder','1','solid','#cccccc');
mDivSize('terms_holder',1,1);
mDivAnimatePos('terms_holder',endy,endx,'5');
mDivAnimateSizeTo('terms_holder',w,h,'6');
sendRequest('terms.php?id=terms');
log_this('terms popup','terms popup');
}

function close_terms(){
mDivAnimatePos('terms_holder',-1000,-1000,'10');
mDivAnimateSizeTo('terms_holder',50,50,'5');
}

function privacy(colour){
w = 620;
h = 260;

startx = mMouseX();
starty = mMouseY();
endx = startx - 100;
endy = starty -h - 50;

if(!document.getElementById('privacy_holder')){
mCreateDiv('privacy_holder');
} 

mDivPos('privacy_holder',starty,startx,'absolute');
mDivOverflow('privacy_holder','auto');
mDivBackgroundColor('privacy_holder','#FFFFFF');
mDivBorder('privacy_holder','1','solid','#cccccc');
mDivSize('privacy_holder',1,1);
mDivAnimatePos('privacy_holder',endy,endx,'5');
mDivAnimateSizeTo('privacy_holder',w,h,'6');
sendRequest('privacy.php?id=privacy');
log_this('privacy popup','privacy popup');
}

function close_privacy(){
mDivAnimatePos('privacy_holder',-1000,-1000,'10');
mDivAnimateSizeTo('privacy_holder',50,50,'5');
}

function webcam(colour){
w = 365;
h = 400;

startx = mMouseX();
starty = mMouseY();
endx = startx - 380;
endy = starty -h - 50;

if(!document.getElementById('webcam_holder')){
mCreateDiv('webcam_holder');
} 

mDivPos('webcam_holder',starty,startx,'absolute');
mDivOverflow('webcam_holder','auto');
mDivBackgroundColor('webcam_holder','#FFFFFF');
mDivBorder('webcam_holder','1','solid','#cccccc');
mDivSize('webcam_holder',1,1);
mDivAnimatePos('webcam_holder',endy,endx,'5');
mDivAnimateSizeTo('webcam_holder',w,h,'6');
sendRequest('webcam.php?id=webcam');
log_this('webcam popup','webcam popup');
}

function close_webcam(){
mDivAnimatePos('webcam_holder',-1000,-1000,'20');
mDivAnimateSizeTo('webcam_holder',50,50,'10');
}



function pausecomp(millis)
{
var date = new Date();
var curDate = null;

do { curDate = new Date(); }
while(curDate-date < millis);
} 

function findPosX(obj)
{
        obj = document.getElementById(obj);
        var curleft = 0;
        if (obj.offsetParent)
        {
                while (obj.offsetParent)
                {
                        curleft += obj.offsetLeft
                        obj = obj.offsetParent;
                }
        }
        else if (obj.x)
                curleft += obj.x;
        return curleft;
}

function findPosY(obj)
{
                obj = document.getElementById(obj);
        var curtop = 0;
        if (obj.offsetParent)
        {
                while (obj.offsetParent)
                {
                        curtop += obj.offsetTop
                        obj = obj.offsetParent;
                }
        }
        else if (obj.y)
                curtop += obj.y;
        return curtop;
}

        function sendRequest(requestString){

                //////////////////////////////////////////////////////////
                status = 'Fetching Data';



           dest_iframe = document.getElementById("remoteScriptRPC").id;
                var url = '';

                url = requestString;
                eval(dest_iframe + ".location.href=url");
        }
///////// photo fader ////////////
document.write("<style type='text/css'>#thephoto {visibility:hidden;}</style>");
function initImage() {
imageId = 'thephoto';
image = document.getElementById(imageId);
setOpacity(image, 0);
image.style.visibility = "visible";
fadeIn(imageId,0);
}
function fadeIn(objId,opacity) {
if (document.getElementById) {
obj = document.getElementById(objId);
if (opacity <= 100) {
setOpacity(obj, opacity);
opacity += 10;
window.setTimeout("fadeIn('"+objId+"',"+opacity+")", 100);
    }
  }
}
function setOpacity(obj, opacity) {
opacity = (opacity == 100)?99.999:opacity;
// IE/Win
obj.style.filter = "alpha(opacity:"+opacity+")";
// Safari<1.2, Konqueror
obj.style.KHTMLOpacity = opacity/100;
// Older Mozilla and Firefox
obj.style.MozOpacity = opacity/100;
// Safari 1.2, newer Firefox and Mozilla, CSS3
obj.style.opacity = opacity/100;
}

function isNum(arg)
{
	var args = arg;
	var fad = true;

	if (args == "" || args == null || args.length == 0)
	{
		return false;
	}

	args = args.toString();

	for (var i = 0;  i<args.length;  i++)
	{
		if (args.substring(i,i+1) < "0" || args.substring(i, i+1) > "9")
		{
			if(args.substring(i, i+1) == ".")
			{
				if(fad == true)
					fad = false;
				else
					return false;			
			}
			else
			{
				return false;
			}
		}
	}
	return true;
}


function tobyte(bytees,type,opt)
{
	if(opt == "SI")
		xval = 1000;
	else
		xval = 1024;

	var value = bytees;
      if(type == "bits")
  	  value = value/8;
	else if(type == "KB")
	  value = value*[Math.pow(xval,1)];
	else if(type == "MB")
	  value = value*[Math.pow(xval,2)];
	else if(type == "GB")
	  value = value*[Math.pow(xval,3)];
	else if(type == "kilobit")
	 value = (value*xval)/8;
	else if(type == "megabit")
	 value = (value*xval*xval)/8;
	else if(type == "gigabit")
	 value = (value*xval*xval*xval)/8;	

	return value;
}

function convert()
{
	var val = document.cir.inp.value;

	if(!isNum(val))
	{
		val = val.substring(0, val.length-1);
		document.cir.inp.value = val;
	}
	else
	{
		var opt = document.cir.opt.value;

		document.cir.ev.value = val+" "+opt;
           
		var byteval = tobyte(val,opt,'SI');
		document.cir.va1.value = byteval;
		document.cir.va11.value = byteval/1000;
		document.cir.va12.value = byteval/1000000;
		document.cir.va13.value = byteval/1000000000;

		eval = byteval*8;
		document.cir.va2.value = eval;
		document.cir.va21.value = eval/1000;
		document.cir.va22.value = eval/1000000;
		document.cir.va23.value = eval/1000000000;

		byteval = tobyte(val,opt,'BIN');
		document.cir.va3.value = byteval;
		document.cir.va31.value = byteval/1024;
		document.cir.va32.value = byteval/(1024*1024);
		document.cir.va33.value = byteval/(1024*1024*1024);

		eval = byteval*8;
		document.cir.va4.value = eval;
		document.cir.va41.value = eval/1024;
		document.cir.va42.value = eval/(1024*1024);
		document.cir.va43.value = eval/(1024*1024*1024);


	}
}



function color(test)
{

	for(var j=2; j<10; j++)
	{
		var myI=document.getElementsByTagName("input").item(j);
		//myI.setAttribute("style",ch);
		myI.style.backgroundColor=test;
	}
}


function color1(test)
{
var myI=document.getElementsByTagName("table").item(0);
//myI.setAttribute("style",ch);
myI.style.backgroundColor=test;
}



