// Set Copyright: vers. 1.1
function setCopyright (sName,nYear,bRange) {
	var nThisYear = (new Date).getFullYear();
	var nYear = !nYear?nThisYear:nYear;
	var bRange = bRange == null?true:bRange;
	var sName = !sName?'':sName;
	
	if (nThisYear > nYear && bRange) {
		document.write('&copy; Copyright ' + nYear + '-' + nThisYear + ' ' + sName + ' &nbsp;All rights reserved.');
	} else {
		document.write('&copy; Copyright ' + nThisYear + ' ' + sName + ' &nbsp;All rights reserved.');
	}
}

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];}}
	removeLinkBorders();
}

function resizeDiv (t,w,h) {
	var div = document.getElementById(t);
	div.style.width = w+'px';
	div.style.height = h+'px';
	if (w != 88) {
		scrollTo(0,6000);	
	}
}

function loadXMLDoc (url,handler) {
	if (document.implementation && document.implementation.createDocument) {
		var xmlDoc = document.implementation.createDocument("","",null);
		xmlDoc.onload = function () {
			handler(xmlDoc);
		};
		xmlDoc.load(url);
	} else if (window.ActiveXObject) {
		var xmlDoc = new ActiveXObject("Microsoft.XMLDOM");
		xmlDoc.onreadystatechange = function () {
			if (xmlDoc.readyState == 4) handler(xmlDoc);
		};
		xmlDoc.load(url);
	}
}

function addCustomerFromXML (xmlDoc) {
	var customers = xmlDoc.getElementsByTagName("customer");
	var nCustomers = customers.length;
	var c = customers[Math.floor(Math.random()*nCustomers)];
	var image = c.getAttribute("image");
	var lnk = c.getAttribute("link");
	var img = document.createElement("img");
	var alt = c.getAttribute("name");
	var loc = c.getAttribute("location");
	var dt = c.getAttribute("date");
	img.setAttribute("src",image);
	img.setAttribute("alt",alt);
	
	var a = document.createElement("a");
	a.setAttribute("href",lnk);
	
	var l_div = document.createElement("div");
	var l_a = document.createElement("h1");
	var l_b = document.createElement("h2");
	var l_c = document.createElement("h2");
	
	l_div.setAttribute("id","cust-data");
	
	
	document.getElementById("col2").appendChild(a).appendChild(img);
	document.getElementById("col2").appendChild(l_div).appendChild(l_a).appendChild(alt);
	document.getElementById("cust-data").appendChild(l_b).appendChild(loc);
	//document.getElementById(l_div).appendChild(l_c).appendChild(dt);
	//document.getElementById("cust-data").style.backgroundColor = "black";
	//document.getElementById("cust-data").style.width = "164px"
}

/* -----------------------------------------------------------------------
-- This function is used to make object visible/invisible
-- Do not change the code
-- Srinivas Komma 2/25/2009
-------------------------------------------------------------------------*/
function SetObjVisibility(object) {
	if (document.layers && document.layers[object] != null) {
		if (document.layers[object].visibility == 'visible') {
			document.layers[object].visibility ='hidden';
			document.layers[object].display = 'none';
		} else {
			document.layers[object].visibility ='visible';
			document.layers[object].display = 'inline';
		}
	} else if (document.all) {
		if (document.all[object].style.visibility == 'visible') {
			document.all[object].style.visibility = 'hidden';
			document.all[object].style.display = 'none';
		} else {
			document.all[object].style.visibility = 'visible';
			document.all[object].style.display = 'inline';
		}
	} else if (document.getElementById(object) != null) {
		if (document.getElementById(object).style.visibility == 'visible') {
			document.getElementById(object).style.visibility = 'hidden';
			document.getElementById(object).style.display = 'none';
		} else {
			document.getElementById(object).style.visibility = 'visible';
			document.getElementById(object).style.display = 'inline';
		}
	}
}
//-----------------------------------------------------------------------

function toggle(object) {
	if (document.layers && document.layers[object] != null) {
		if (document.layers[object].visibility == 'visible') {
			document.layers[object].visibility ='hidden';
			document.layers[object].display = 'none';
		} else {
			document.layers[object].visibility ='visible';
			document.layers[object].display = 'inline';
		}
	} else if (document.all) {
		if (document.all[object].style.visibility == 'visible') {
			if (object == 'EmailToFriendDiv')
			{
				document.all['divEmailLink'].style.background='';
				document.all['tblEmail'].style.background='';
				document.all['emailfriendimg'].src='../../images/emailtofriend_icon.gif';
			}
			
			document.all[object].style.visibility = 'hidden';
			document.all[object].style.display = 'none';
		} else {
			if (object == 'EmailToFriendDiv')
			{
			document.all['divEmailLink'].style.background='#E5E1CE';
			document.all['tblEmail'].style.background='#E5E1CE';
			document.all['divEmailLink'].style.width='175';
			document.all['emailfriendimg'].src='../../images/emailtofriend_icon_ovr.gif';
			}
			document.all[object].style.visibility = 'visible';
			document.all[object].style.display = 'inline';
		}
	} else if (document.getElementById(object) != null) {
		if (document.getElementById(object).style.visibility == 'visible') {
			if (object == 'EmailToFriendDiv')
			{
				document.getElementById('divEmailLink').style.background='';
				document.getElementById('tblEmail').style.background='';
				document.emailfriendimg.src='../../images/emailtofriend_icon.gif';
			}
			document.getElementById(object).style.visibility = 'hidden';
			document.getElementById(object).style.display = 'none';
		} else {
			if (object == 'EmailToFriendDiv')
			{
			document.getElementById('divEmailLink').style.background='#E5E1CE';
			document.getElementById('tblEmail').style.background='#E5E1CE';
			document.getElementById('divEmailLink').style.width='190';
			document.emailfriendimg.src='../../images/emailtofriend_icon_ovr.gif';
			}
			document.getElementById(object).style.visibility = 'visible';
			document.getElementById(object).style.display = 'inline';
		}
	}
}

// Save div id name to use with showHid function
var divSave;
var linkSave;

	function showHide (div,defaultDiv,thisLink) {
		if (divSave != undefined) {
			document.getElementById(divSave).style.display = 'none';
			anch = document.getElementById(thisLink);
			ul = document.getElementById('col');
			li = ul.getElementsByTagName('li');
			

			if(thisLink != 'one') {
				l = document.getElementById('one');
				l.setAttribute('class','');
				l.setAttribute('className','');
			}
			if (div == defaultDiv) {
				li[0].setAttribute('class','first');
				li[0].setAttribute('className','first');
				anch.setAttribute('class','selected');
				anch.setAttribute('className','selected');
			} else {
				li[0].setAttribute('class','firstNBG');
				li[0].setAttribute('className','firstNBG');
				anch.setAttribute('class','selected');
				anch.setAttribute('className','selected');
			}
		} else {
			document.getElementById(defaultDiv).style.display = 'none';
			anch = document.getElementById(thisLink);
			ul = document.getElementById('col');
			li = ul.getElementsByTagName('li');
			
			if(thisLink != 'one') {
				l = document.getElementById('one');
				l.setAttribute('class','');
				l.setAttribute('className','');
			}
			
			if (div == defaultDiv) {
				li[0].setAttribute('class','first');
				li[0].setAttribute('className','first');
				anch.setAttribute('class','selected');
				anch.setAttribute('className','selected');
			} else {
				li[0].setAttribute('class','firstNBG');
				li[0].setAttribute('className','firstNBG');
				anch.setAttribute('class','selected');
				anch.setAttribute('className','selected');
			}
		}
		if (linkSave != undefined) {
			anch = document.getElementById(linkSave);
			anch.setAttribute('class','');
			anch.setAttribute('className','');
		}
		document.getElementById(div).style.display = '';
		divSave = div;
		linkSave = thisLink;
	}
	
function wait(divID) {
string="pauseforalert("+divID+");";
setTimeout(string,1000);
}

function pause() {
	document.getElementById(divID).style.display = 'none';
}

function removeLinkBorders() {
     if (!document.getElementsByTagName || !document.createElement || !document.appendChild) return;
     var anchors = document.getElementsByTagName("a");
	 var blurScript = "if(this.blur)this.blur();";
     for (var i=0; i<anchors.length; i++) {
          var attrFocus = anchors[i].getAttribute("onfocus");
          anchors[i].setAttribute("onfocus",blurScript);
     }
 }
function linkPDF(num) {
	var urls = [
				'http://www.approva.net/assets/resources/library/TakeControl-DoYouKnowYourRole.pdf',
				'http://www.approva.net/assets/resources/library/Section404-BestYetToCome.pdf',
				'http://www.approva.net/assets/resources/library/ImpactOfSarbanes-OxleyOnEnterpriseApps.pdf',
				'http://www.approva.net/assets/resources/library/Approva_2005_Survey_Results_Report.pdf',
				'http://www.approva.net/assets/resources/library/Emerging_Issues_Corporate_Governance_10_2005.pdf',
				'http://www.approva.net/assets/resources/library/Prashanth_Boccasam_Interview.pdf',
				'http://www.approva.net/assets/resources/library/MonitoringP2P-ApprovaWP.pdf',
				'http://www.approva.net/assets/resources/library/Transforming-compliance-into-competitive-advantage.pdf',
				'http://www.approva.net/assets/resources/library/Power-of-the-Platform.pdf',
				'http://www.approva.net/assets/resources/library/Power-of-Cross-Application.pdf',
				'http://www.approva.net/assets/resources/library/Power-of-Being-Business-Oriented.pdf',
				'http://www.approva.net/assets/resources/library/Transforming-Internal-Controls-with-Automated-Testing.pdf'
				];
	if (checkCookieSet == true) {
		window.location = urls[num];
	} else {
		window.location = '/content/view/87/';
	}
	
}