// JavaScript Document

//flash object
function createani()
{
   document.write('<object classid="clsid:d27cdb6e-ae6d-11cf-96b8-444553540000" codebase="http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="383" height="57" id="topLinks" align="middle">\n');
   document.write('<param name="allowScriptAccess" value="sameDomain">\n');
   document.write('<param name="movie" value="/images/topLinks.swf">\n');
   document.write('<param name="menu" value="false">\n');
   document.write('<param name="quality" value="high">\n');
   document.write('<param name="bgcolor" value="#ffffff">\n');
   document.write('<param name="wmode" value="transparent">\n');
   document.write('<embed src="/images/topLinks.swf" wmode="transparent" menu="false" quality="high" bgcolor="#ffffff" width="383" height="57" name="topLinks" align="middle" allowScriptAccess="sameDomain" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer">\n');
   document.write('</object>\n');
}


//mouseover
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}


//dropdowns
var disappeardelay=250  //menu disappear speed onMouseout (in miliseconds)
var enableanchorlink=0 //Enable or disable the anchor link when clicked on? (1=e, 0=d)
var hidemenu_onclick=1 //hide menu when user clicks within menu? (1=yes, 0=no)

/////No further editting needed

var ie5=document.all
var ns6=document.getElementById&&!document.all

function getposOffset(what, offsettype){
var totaloffset=(offsettype=="left")? what.offsetLeft : what.offsetTop;
var parentEl=what.offsetParent;
while (parentEl!=null){
totaloffset=(offsettype=="left")? totaloffset+parentEl.offsetLeft : totaloffset+parentEl.offsetTop;
parentEl=parentEl.offsetParent;
}
return totaloffset;
}

function showhide(obj, e, visible, hidden){
if (ie5||ns6)
dropmenuobj.style.left=dropmenuobj.style.top=-500
if (e.type=="click" && obj.visibility==hidden || e.type=="mouseover")
obj.visibility=visible
else if (e.type=="click")
obj.visibility=hidden
}

function iecompattest(){
return (document.compatMode && document.compatMode!="BackCompat")? document.documentElement : document.body
}

function clearbrowseredge(obj, whichedge){
var edgeoffset=0
if (whichedge=="rightedge"){
var windowedge=ie5 && !window.opera? iecompattest().scrollLeft+iecompattest().clientWidth-15 : window.pageXOffset+window.innerWidth-15
dropmenuobj.contentmeasure=dropmenuobj.offsetWidth
if (windowedge-dropmenuobj.x < dropmenuobj.contentmeasure)
edgeoffset=dropmenuobj.contentmeasure-obj.offsetWidth
}
else{
var topedge=ie5 && !window.opera? iecompattest().scrollTop : window.pageYOffset
var windowedge=ie5 && !window.opera? iecompattest().scrollTop+iecompattest().clientHeight-15 : window.pageYOffset+window.innerHeight-18
dropmenuobj.contentmeasure=dropmenuobj.offsetHeight
if (windowedge-dropmenuobj.y < dropmenuobj.contentmeasure){ //move up?
edgeoffset=dropmenuobj.contentmeasure+obj.offsetHeight
if ((dropmenuobj.y-topedge)<dropmenuobj.contentmeasure) //up no good either?
edgeoffset=dropmenuobj.y+obj.offsetHeight-topedge
}
}
return edgeoffset
}

function dropdownmenu(obj, e, dropmenuID){
if (window.event) event.cancelBubble=true
else if (e.stopPropagation) e.stopPropagation()
if (typeof dropmenuobj!="undefined") //hide previous menu
dropmenuobj.style.visibility="hidden"
clearhidemenu()
if (ie5||ns6){
obj.onmouseout=delayhidemenu
dropmenuobj=document.getElementById(dropmenuID)
if (hidemenu_onclick) dropmenuobj.onclick=function(){dropmenuobj.style.visibility='hidden'}
dropmenuobj.onmouseover=clearhidemenu
dropmenuobj.onmouseout=ie5? function(){ dynamichide(event)} : function(event){ dynamichide(event)}
showhide(dropmenuobj.style, e, "visible", "hidden")
dropmenuobj.x=getposOffset(obj, "left")
dropmenuobj.y=getposOffset(obj, "top")
dropmenuobj.style.left=dropmenuobj.x-clearbrowseredge(obj, "rightedge")+"px"
dropmenuobj.style.top=dropmenuobj.y-clearbrowseredge(obj, "bottomedge")+obj.offsetHeight+"px"
}
return clickreturnvalue()
}

function clickreturnvalue(){
if ((ie5||ns6) && !enableanchorlink) return false
else return true
}

function contains_ns6(a, b) {
while (b.parentNode)
if ((b = b.parentNode) == a)
return true;
return false;
}

function dynamichide(e){
if (ie5&&!dropmenuobj.contains(e.toElement))
delayhidemenu()
else if (ns6&&e.currentTarget!= e.relatedTarget&& !contains_ns6(e.currentTarget, e.relatedTarget))
delayhidemenu()
}

function delayhidemenu(){
delayhide=setTimeout("dropmenuobj.style.visibility='hidden'",disappeardelay)
}

function clearhidemenu(){
if (typeof delayhide!="undefined")
clearTimeout(delayhide)
}
//TABs
//tabs
//a public function that the container uses to pass in values for the labels
function public_Labels(label1, label2, label3, label4, label5){
	
	t1.innerText = label1;
	t2.innerText = label2;
	t3.innerText = label3;
	t4.innerText = label4;
	t5.innerText = label5;
}
//a public function that the container uses to pass in values for the card containers
function public_Contents(contents1, contents2, contents3, contents4, contents5){
	t1Contents.innerHTML = contents1;
	t2Contents.innerHTML = contents2;
	t3Contents.innerHTML = contents3;
	t4Contents.innerHTML = contents4;
	t5Contents.innerHTML = contents5;
	init();
}
//sets the default display to tab 1
function init(){
	tabContents.innerHTML = t1Contents.innerHTML;
}	
//this is the tab switching function
var currentTab;
var tabBase;
var firstFlag = true;
function changeTabs(){
	if(firstFlag == true){
		currentTab = t1;
		tabBase = t1base;
		firstFlag = false;
	}
	if(window.event.srcElement.className == "tab"){
		currentTab.className = "tab";
		tabBase.style.backgroundColor = "#666666";
		currentTab = window.event.srcElement;
		tabBaseID = currentTab.id + "base";
		tabContentID = currentTab.id + "Contents";
		tabBase = document.all(tabBaseID);
		tabContent = document.all(tabContentID);
		currentTab.className = "selTab";
		
		tabBase.style.backgroundColor = "";
		tabContents.innerHTML = tabContent.innerHTML;
	}
}

//form validator
function validateForm(){
var firstName=document.frmDemoRequest.firstname.value

if(firstName==""){
			alert ("Please enter a value for the First Name field");
			document.frmDemoRequest.firstname.focus();
			return false;
}
var lastName=document.frmDemoRequest.lastname.value
if(lastName==""){
			alert ("Please enter a value for the Last Name field");
			document.frmDemoRequest.lastname.focus();
			return false;
}
var company=document.frmDemoRequest.company.value
if(company==""){
			alert ("Please enter a value for the Company field");
			document.frmDemoRequest.company.focus();
			return false;
}
var address1=document.frmDemoRequest.address1.value
if(address1==""){
			alert ("Please enter a value for the Address field");
			document.frmDemoRequest.address1.focus();
			return false;
}
var city=document.frmDemoRequest.city.value
if(city==""){
			alert ("Please enter a value for the City field");
			document.frmDemoRequest.city.focus();
			return false;
}
var state=document.frmDemoRequest.state.value
if(state==""){
			alert ("Please enter a value for the State / Province field");
			document.frmDemoRequest.state.focus();
			return false;
}
var phone=document.frmDemoRequest.phone.value
if(phone==""){
			alert ("Please enter a value for the Phone field");
			document.frmDemoRequest.phone.focus();
			return false;
}
var email=document.frmDemoRequest.email.value

if((email=="") || !(isEmailAddr(email)) ){
			alert ("Please enter a value for the Email field e.g. yourname@yourdomain.com");
			document.frmDemoRequest.email.focus();
			return false;
}
return true;
}




function validateDownloadForm(){
	var firstName=document.frmDownloadRequest.firstname.value
	if(firstName==""){
		alert ("Please enter a value for the First Name field");
		document.frmDownloadRequest.firstname.focus();
		return false;
	}
	
	var lastName=document.frmDownloadRequest.lastname.value
	if(lastName==""){
		alert ("Please enter a value for the Last Name field");
		document.frmDownloadRequest.lastname.focus();
		return false;
	}
	
	var company=document.frmDownloadRequest.company.value
	if(company==""){
		alert ("Please enter a value for the Company field");
		document.frmDownloadRequest.company.focus();
		return false;
	}
	
	var address1=document.frmDownloadRequest.address1.value
	if(address1==""){
		alert ("Please enter a value for the Address field");
		document.frmDownloadRequest.address1.focus();
		return false;
	}
	
	var city=document.frmDownloadRequest.city.value
	if(city==""){
		alert ("Please enter a value for the City field");
		document.frmDownloadRequest.city.focus();
		return false;
	}
	
	var state=document.frmDownloadRequest.state.value
	if(state==""){
		alert ("Please enter a value for the State / Province field");
		document.frmDownloadRequest.state.focus();
		return false;
	}
	
	var phone=document.frmDownloadRequest.phone.value
	if(phone==""){
		alert ("Please enter a value for the Phone field");
		document.frmDownloadRequest.phone.focus();
		return false;
	}

	var code=document.frmDownloadRequest.code.value
	if(code=="" || code.length<5){
		alert ("Please enter code shown in the image");
		document.frmDownloadRequest.code.value="";
		document.frmDownloadRequest.code.focus();
		return false;
	}
	
	var email=document.frmDownloadRequest.email.value
	if((email=="") || !(isEmailAddr(email)) ){
		alert ("Please enter a value for the Email field e.g. yourname@yourdomain.com");
		document.frmDownloadRequest.email.focus();
		return false;
	}
return true;
}


function validateResellerForm(){
	var firstName=document.frmResellerRequest.firstname.value
	if(firstName==""){
		alert ("Please enter a value for the First Name field");
		document.frmResellerRequest.firstname.focus();
		return false;
	}
	
	var lastName=document.frmResellerRequest.lastname.value
	if(lastName==""){
		alert ("Please enter a value for the Last Name field");
		document.frmResellerRequest.lastname.focus();
		return false;
	}
	
	var designation=document.frmResellerRequest.designation.value
	if(designation==""){
		alert ("Please enter a value for the Designation field");
		document.frmResellerRequest.designation.focus();
		return false;
	}

	var company=document.frmResellerRequest.company.value
	if(company==""){
		alert ("Please enter a value for the Company field");
		document.frmResellerRequest.company.focus();
		return false;
	}

	var webaddress=document.frmResellerRequest.webaddress.value
	if(webaddress==""){
		alert ("Please enter a value for the Web Address field");
		document.frmResellerRequest.webaddress.focus();
		return false;
	}
	
	var address1=document.frmResellerRequest.address1.value
	if(address1==""){
		alert ("Please enter a value for the Address field");
		document.frmResellerRequest.address1.focus();
		return false;
	}

	var city=document.frmResellerRequest.city.value
	if(city==""){
		alert ("Please enter a value for the City field");
		document.frmResellerRequest.city.focus();
		return false;
	}

	var state=document.frmResellerRequest.state.value
	if(state==""){
		alert ("Please enter a value for the State / Province field");
		document.frmResellerRequest.state.focus();
		return false;
	}

	var phone=document.frmResellerRequest.phone.value
	if(phone==""){
		alert ("Please enter a value for the Phone field");
		document.frmResellerRequest.phone.focus();
		return false;
	}
	
	var email=document.frmResellerRequest.email.value
	if((email=="") || !(isEmailAddr(email)) ){
		alert ("Please enter a value for the Email field e.g. yourname@yourdomain.com");
		document.frmResellerRequest.email.focus();
		return false;
	}
	
	return true;
}
function validateNewsLetterForm(){

	var txtFirstname=document.NewsLetterForm.txtFirstname.value;
	var txtLastname=document.NewsLetterForm.txtLastname.value;
	var txtEmail=document.NewsLetterForm.txtEmail.value;
	var code=document.NewsLetterForm.code.value
	
	if (txtFirstname.length==0){
		alert("Please enter the First name");
		document.NewsLetterForm.txtFirstname.focus();
		return false;
	}

	if (txtLastname.length==0){
		alert("Please enter the Last name");
		document.NewsLetterForm.txtLastname.focus();
		return false;
	}

	if(code=="" || code.length<5){
		alert ("Please enter code shown in the image");
		document.NewsLetterForm.code.value="";
		document.NewsLetterForm.code.focus();
		return false;
	}	
	
	if (txtEmail.length==0 || !(isEmailAddr(txtEmail))){	
		alert("Please enter valid email address\n e.g. yourname@yourdomain.com");
		document.NewsLetterForm.txtEmail.focus();
		return false;
	}
	
	return true;
}

function isEmailAddr(email){
  var result = false
  var theStr = new String(email)
  var index = theStr.indexOf("@");
  if (index > 0){
    var pindex = theStr.indexOf(".",index);
    if ((pindex > index+1) && (theStr.length > pindex+1))
	result = true;
  }
  return result;
}

//Preloading Images
function preLoadImages(){
MM_preloadImages(
	'/images/careersLinkon.gif',
	'/images/companyLinkon.gif',
	'/images/customersLinkon.gif',
	'/images/productsLinkon.gif',
	'/images/resourcesLinkon.gif',
	'/images/servicesLinkon.gif'
);
}
function preLoadHomepageImages(){
MM_preloadImages(
	'/images/mainColl.jpg',
	'/images/mainDms.jpg',
	'/images/mainonD.jpg',
	'/images/collaborateButton.gif',
	'/images/dmsButton.gif',
	'/images/onDemandButton.gif'
);
}

function refreshImage(){
	document.body.style.cursor="wait";
	document.getElementById("imgCode").src="/images/bg.jpg";
	setTimeout('document.getElementById("imgCode").src = "/classes/showImage.php"',500);
	setTimeout('document.body.style.cursor="default"',500);
}