
/* preload rollover images  */

function newImage(arg) {
	if (document.images) {
		rslt = new Image();
		rslt.src = arg;
		return rslt;
	}
}

function changeImages() {
	if (document.images && (preloadFlag == true)) {
		for (var i=0; i<changeImages.arguments.length; i+=2) {
			document[changeImages.arguments[i]].src = changeImages.arguments[i+1];
		}
	}
}

var preloadFlag = false;
function preloadImages() {
	if (document.images) {
		Company_over = newImage("/images/CompanyOver.gif");
		Company_down = newImage("/images/CompanyDown.gif");
		RequestForQuote_over = newImage("/images/RequestForQuoteOver.gif");
		RequestForQuote_down = newImage("/images/RequestForQuoteDown.gif");
		FAQ_over = newImage("/images/FAQOver.gif");
		FAQ_down = newImage("/images/FAQDown.gif");
		SiteOverview_over = newImage("/images/SiteOverviewOver.gif");
		SiteOverview_down = newImage("/images/SiteOverviewDown.gif");
		ContactUs_over = newImage("/images/ContactUsOver.gif");
		ContactUs_down = newImage("/images/ContactUsDown.gif");
		
		News_over = newImage("/images/NewsOver.gif");
		News_down = newImage("/images/NewsDown.gif");
		
		CompanyFooter_over = newImage("/images/CompanyFooterOver.gif");
		RequestForQuoteFooter_over = newImage("/images/RequestForQuoteFooterOver.gif");
		FAQFooter_over = newImage("/images/FAQFooterOver.gif");
		SiteOverviewFooter_over = newImage("/images/SiteOverviewFooterOver.gif");
		ContactFooter_over = newImage("/images/ContactUsFooterOver.gif");
		preloadFlag = true;
	}
}

/* swflove function */ 

function swflove() 
{ 
document.write('<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="468" height="60">\n'); 
document.write('<param name="movie" value="/images/MJK-Disc-Productions-CD-DVD-UK.swf" />\n'); 
document.write('<param name="quality" value="high">\n'); 
document.write('<embed src="/images/MJK-Disc-Productions-CD-DVD-UK.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="468" height="60"></embed>\n'); 
document.write('</object>\n'); 
} 

/* checkdata email address in online forms */

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_validateForm() { //v4.0
  var i,p,q,nm,test,num,min,max,errors='',args=MM_validateForm.arguments;
  for (i=0; i<(args.length-2); i+=3) { test=args[i+2]; val=MM_findObj(args[i]);
    if (val) { nm=val.name; if ((val=val.value)!="") {
      if (test.indexOf('isEmail')!=-1) { p=val.indexOf('@');
        if (p<1 || p==(val.length-1)) errors+=' Please provide a valid e-mail address.\n';
      } else if (test!='R') { num = parseFloat(val);
        if (isNaN(val)) errors+='- '+nm+' must contain a number.\n';
        if (test.indexOf('inRange') != -1) { p=test.indexOf(':');
          min=test.substring(8,p); max=test.substring(p+1);
          if (num<min || max<num) errors+='- '+nm+' must contain a number between '+min+' and '+max+'.\n';
    } } } else if (test.charAt(0) == 'R') errors += 'A valid e-mail address is required to unsubscribe. \n'; }
  } if (errors) alert('\n'+errors);
  document.MM_returnValue = (errors == '');
}

/* checkdata input fields contactforms  */

function checkdata() {
  if ((document.MJK.FirstName.value.length > 0) && (document.MJK.LastName.value.length > 0) && (document.MJK.CompanyName.value.length > 0) && (document.MJK.Country.value.length > 0) && (document.MJK.email.value.length > 0) && (document.MJK.Phone.value.length > 0) && (document.MJK.Message.value.length > 0)) {
    document.MJK.submit();
  } else {
    alert("Please fill out all the required fields (marked with an asterisk).");
  }
}

function NewWindow(mypage, myname, w, h, scroll) {
var winl = (screen.width - w) / 2;
var wint = (screen.height - h) / 2;
winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars='+scroll+',resizable'
win = window.open(mypage, myname, winprops)
if (parseInt(navigator.appVersion) >= 4) { win.window.focus(); }
}

