/*document.write("<script type='text/javascript' src='/js/tools.js'></script>");
document.write("<script type='text/javascript' src='/js/jq/jquery.js'></script>");
document.write("<script type='text/javascript' src='/js/jq/jquery.validate.js'></script>");
document.write("<script type='text/javascript' src='/js/ac.js'></script>");
document.write("<script type='text/javascript' src='/js/emailNotification.js'></script>");
document.write("<script type='text/javascript' src='/js/emailTopic/messages.js'></script>");

*/

var pageLocation = window.location.href;
var domain = /www\.arupconsult\.com/;
var domain2 = /mock\.arupconsult\.com/;
var domain3 = /\/arupconsult\.com/;
var result = pageLocation.match(domain);
var result2 = pageLocation.match(domain2);
var result3 = pageLocation.match(domain3);
if (result != null || result2 != null||result3!=null) { var prodSite=true; }
else { var prodSite=false; }

function buildAutocompleter() 
		{
			new Autocompleter.Local(
				'IW_FIELD_WEB_STYLE',
				'autoCompleteMenu',
				LIST,
				{
					minChars: 1,
					fullSearch : true
				}
			);
		}


   
   function getObjectStyle(el,styleProp){
       var x = document.getElementById(el);
       if (x.currentStyle)
           var y = x.currentStyle[styleProp];
       else if (window.getComputedStyle)
           var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
       return y;
   }

   function Set_Cookie( name, value, expires, path, domain, secure ) {
       // set time, it's in milliseconds
       var today = new Date();
       today.setTime( today.getTime() );
       if ( expires ){
           expires = expires * 1000 * 60 * 60 * 24;
       }
       var expires_date = new Date( today.getTime() + (expires) );
             document.cookie = name + "=" +escape( value ) +
       ( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) +
       ( ( path ) ? ";path=" + path : "" ) +
       ( ( domain ) ? ";domain=" + domain : "" ) +
       ( ( secure ) ? ";secure" : "" );
   }
   function Get_Cookie( name ) {
             var start = document.cookie.indexOf( name + "=" );
       var len = start + name.length + 1;
       if ( ( !start ) && ( name != document.cookie.substring( 0, name.length ) ) ){
           return null;
       }
       if ( start == -1 ) return null;
       var end = document.cookie.indexOf( ";", len );
       if ( end == -1 ) end = document.cookie.length;
       return unescape( document.cookie.substring( len, end ) );
   }

   //This function sets the element size onload, from the cookie value
   function textSize(obj){
       var size = Get_Cookie('dmntextsize');
       if (size){
           document.getElementById(obj).style.fontSize = size + 'px';
           document.getElementById(obj).style.lineHeight = (parseInt(size) + 3) + 'px';
       }
	  
   }


   function textSizeUp(obj,size){
       if(document.getElementById(obj).style.fontSize){
           if (size){
               document.getElementById(obj).style.fontSize = size + 'px';
               document.getElementById(obj).style.lineHeight = size + 'px';
           }else{
               if(parseInt(document.getElementById(obj).style.fontSize) < 25){
                   document.getElementById(obj).style.fontSize =  (parseInt(document.getElementById(obj).style.fontSize) + 3) + 'px';
                   document.getElementById(obj).style.lineHeight = (parseInt(document.getElementById(obj).style.lineHeight) + 3) + 'px';
                   Set_Cookie( 'dmntextsize', parseInt(document.getElementById(obj).style.fontSize), 30, '/', '', '' );
               }
           }
       }else{
           cssFontSize = getObjectStyle(obj, 'fontSize') ? getObjectStyle(obj, 'fontSize') : getObjectStyle(obj, 'font-size');
           cssFontSize = parseInt(cssFontSize);
           cssLineHeight = getObjectStyle(obj, 'lineHeight') ? getObjectStyle(obj, 'lineHeight') : getObjectStyle(obj, 'line-height');
           cssLineHeight = parseInt(cssLineHeight);
           document.getElementById(obj).style.fontSize =  (cssFontSize + 3) + 'px';
           document.getElementById(obj).style.lineHeight = (cssLineHeight + 3) + 'px';
       }
   }


         function textSizeDown(obj,size){
       if(document.getElementById(obj).style.fontSize){
           if (size){
               document.getElementById(obj).style.fontSize = size + 'px';
               document.getElementById(obj).style.lineHeight = size + 'px';
           }else{
               if(parseInt(document.getElementById(obj).style.fontSize) > 12){
                   document.getElementById(obj).style.fontSize =  (parseInt(document.getElementById(obj).style.fontSize) - 3) + 'px';
                   document.getElementById(obj).style.lineHeight = (parseInt(document.getElementById(obj).style.lineHeight) - 3) + 'px';
                   Set_Cookie( 'dmntextsize', parseInt(document.getElementById(obj).style.fontSize), 30, '/', '', '' );
               }
           }
       }else{
           cssFontSize = getObjectStyle(obj, 'fontSize') ? getObjectStyle(obj, 'fontSize') : getObjectStyle(obj, 'font-size');
           cssFontSize = parseInt(cssFontSize);
           cssLineHeight = getObjectStyle(obj, 'lineHeight') ? getObjectStyle(obj, 'lineHeight') : getObjectStyle(obj, 'line-height');
           cssLineHeight = parseInt(cssLineHeight);
           document.getElementById(obj).style.fontSize =  (cssFontSize - 3) + 'px';
           document.getElementById(obj).style.lineHeight = (cssLineHeight - 3) + 'px';
       }
   }


   
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];}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

last_tab = 'back';
//b_last_tab = 'b_tab1';
function show(layerName) {
document.getElementById(layerName).style.display = '';
}

function hide(layerName) {
document.getElementById(layerName).style.display = 'none';
}

function show_next(tab_name) {
document.getElementById(last_tab).className = '';
//document.getElementById(b_last_tab).className = 'tab';

var curr = document.getElementById(tab_name);
//var b_curr = document.getElementById(b_tab_name);

curr.className='current';
//b_curr.className='tab_hover';

hide(last_tab+'_data');
show(tab_name+'_data');
last_tab=tab_name;
last_tab.className='';
//b_last_tab=b_tab_name;

}

var bannerImg = new Array();
  // Enter the names of the images below
  bannerImg[0]="/images/banner_compworld.jpg";
bannerImg[1]="/images/banner_wwwhealth.jpg";
  bannerImg[2]="/images/banner_ehealth.jpg";
  bannerImg[3]="/images/banner_iqawards.jpg";
bannerImg[4]="/images/banner_utinnovation.jpg";
bannerImg[5]="/images/banner_stc.jpg";

var newBanner = 0;
var totalBan = bannerImg.length;

function loadBan(){
setTimeout("cycleBan()", 7*1000); 
}

function cycleBan() {
  newBanner++;
  if (newBanner == totalBan) {
    newBanner = 0;
  }
  document.award_banner.src=bannerImg[newBanner];
  // set the time below for length of image display
  // i.e., "4*1000" is 4 seconds
  setTimeout("cycleBan()", 7*1000);
}


var newWindow = null;
function closeWin(){
if (newWindow != null){
if(!newWindow.closed)
newWindow.close();
}
}
function popUpWin(url, type, strWidth, strHeight){
closeWin();
if (type == "fullScreen" ){
strWidth = screen.availWidth - 10;
strHeight = screen.availHeight - 160;
}
var tools="";
if (type == "standard" || type == "fullScreen") tools = "resizable,toolbar=yes,location=yes,scrollbars=yes, menubar=yes,width="+strWidth+",height="+strHeight+",top=0,left=0";
if (type == "console") tools = "resizable,toolbar=no,location=no,scrollbars=yes,width="+strWidth+",height="+strHeight+",left=0,top=0";
newWindow = window.open(url, 'newWin', tools);
newWindow.focus();
}


/* 
*  Copyright 2006-2007 Dynamic Site Solutions.
*  Free use of this script is permitted for non-commercial applications,
*  subject to the requirement that this comment block be kept and not be
*  altered.  The data and executable parts of the script may be changed
*  as needed.  Dynamic Site Solutions makes no warranty regarding fitness
*  of use or correct function of the script.  Terms for use of this script
*  in commercial applications may be negotiated; for this, or for other
*  questions, contact "license-info@dynamicsitesolutions.com".
*
*  Script by: Dynamic Site Solutions -- http://www.dynamicsitesolutions.com/
*  Last Updated: 2007-06-17
*/

//IE5+/Win, Firefox, Netscape 6+, Opera 7+, Safari, Konqueror 3, IE5/Mac, iCab 3

var addBookmarkObj = {
  linkText:'Bookmark',
  addTextLink:function(parId){
    var a=addBookmarkObj.makeLink(parId);
    if(!a) return;
    a.appendChild(document.createTextNode(addBookmarkObj.linkText));
  },
  addImageLink:function(parId,imgPath){
    if(!imgPath || isEmpty(imgPath)) return;
    var a=addBookmarkObj.makeLink(parId);
    if(!a) return;
    var img = document.createElement('img');
    img.title = img.alt = addBookmarkObj.linkText;
    img.src = imgPath;
    a.appendChild(img);
  },
  makeLink:function(parId) {
    if(!document.getElementById || !document.createTextNode) return null;
    parId=((typeof(parId)=='string')&&!isEmpty(parId))
      ?parId:'addBookmarkContainer';
    var cont=document.getElementById(parId);
    if(!cont) return null;
    var a=document.createElement('a');
    a.href=location.href;
    if(window.opera) {
      a.rel='sidebar'; // this makes it work in Opera 7+
    } else {
      // this doesn't work in Opera 7+ if the link has an onclick handler,
      // so we only add it if the browser isn't Opera.
      a.onclick=function() {
        addBookmarkObj.exec(this.href,this.title);
        return false;
      }
    }
    a.title=document.title;
    return cont.appendChild(a);
  },
  exec:function(url, title) {
    // user agent sniffing is bad in general, but this is one of the times 
    // when it's really necessary
    var ua=navigator.userAgent.toLowerCase();
    var isKonq=(ua.indexOf('konqueror')!=-1);
    var isSafari=(ua.indexOf('webkit')!=-1);
    var isMac=(ua.indexOf('mac')!=-1);
    var buttonStr=isMac?'Command/Cmd':'CTRL';

    if(window.external && (!document.createTextNode ||
      (typeof(window.external.AddFavorite)=='unknown'))) {
        // IE4/Win generates an error when you
        // execute "typeof(window.external.AddFavorite)"
        // In IE7 the page must be from a web server, not directly from a local 
        // file system, otherwise, you will get a permission denied error.
        window.external.AddFavorite(url, title); // IE/Win
    } else if(isKonq) {
      alert('You need to press CTRL + B to bookmark our site.');
    } else if(window.opera) {
      void(0); // do nothing here (Opera 7+)
    } else if(window.home || isSafari) { // Firefox, Netscape, Safari, iCab
      alert('You need to press '+buttonStr+' + D to bookmark our site.');
    } else if(!window.print || isMac) { // IE5/Mac and Safari 1.0
      alert('You need to press Command/Cmd + D to bookmark our site.');    
    } else {
      alert('In order to bookmark this site you need to do so manually '+
        'through your browser.');
    }
  }
}

function isEmpty(s){return ((s=='')||/^\s*$/.test(s));}

function dss_addEvent(el,etype,fn) {
  if(el.addEventListener && (!window.opera || opera.version) &&
  (etype!='load')) {
    el.addEventListener(etype,fn,false);
  } else if(el.attachEvent) {
    el.attachEvent('on'+etype,fn);
  } else {
    if(typeof(fn) != "function") return;
    if(typeof(window.earlyNS4)=='undefined') {
      // to prevent this function from crashing Netscape versions before 4.02
      window.earlyNS4=((navigator.appName.toLowerCase()=='netscape')&&
      (parseFloat(navigator.appVersion)<4.02)&&document.layers);
    }
    if((typeof(el['on'+etype])=="function")&&!window.earlyNS4) {
      var tempFunc = el['on'+etype];
      el['on'+etype]=function(e){
        var a=tempFunc(e),b=fn(e);
        a=(typeof(a)=='undefined')?true:a;
        b=(typeof(b)=='undefined')?true:b;
        return (a&&b);
      }
    } else {
      el['on'+etype]=fn;
    }
  }
}

dss_addEvent(window,'load',addBookmarkObj.addTextLink);

// to make multiple links, do something like this:
/*
dss_addEvent(window,'load',function(){
  var f=addBookmarkObj.addTextLink;
  f();
  f('otherContainerID');
});
*/

// below is an example of how to make an image link with this
// the first parameter is the ID. If you pass an empty string it defaults to
// 'addBookmarkContainer'.
/*
dss_addEvent(window,'load',function(){
  addBookmarkObj.addImageLink('','/images/add-bookmark.jpg');
});
*/

function clearDefault(el) {
  if (el.defaultValue==el.value) el.value = ""
}

function showHide(id,img){
		//alert(obj);
		var table = document.getElementById(id);
		var img = document.getElementById(img);
		//alert(table);
		var tbody = table.getElementsByTagName("tbody")[0];
		 
		var old = tbody.style.display;
		tbody.style.display = (old == "none"?"":"none");
		img.src = (old == "none"?"/images/minus.gif":"/images/plusik.gif");
}


function showhidePDF(id,url){
if(document.getElementById(id).innerHTML == ""){
document.getElementById(id).style.display = "block";
document.getElementById(id).innerHTML = "<iframe src="+url+"#toolbar=0&navpanes=0&scrollbar=1&page=1 frameborder='0' allowtransparency='true' width='100%' height='600px'; ></iframe>";
}
else{
document.getElementById(id).style.display = "none";
document.getElementById(id).innerHTML = "";
}
}

// Initialize the rollover
//window.onload = function() {
//  findExternalLinks();
//}

// Attach event listeners to the buttons
function findExternalLinks() {
  var TopicPage, links, i;
  // Get the menu element to access the btn divs
  TopicPage = document.getElementById('TopicPage');

  if (TopicPage)
  {
  links = TopicPage.getElementsByTagName('span');

	for (i=0; i<links.length; i++) {
    // Attach event listeners for rollovers to the btns
    if (/externalLink/.test(links[i].className)) { 
      links[i].onmouseover = function(){roll(this);};
      links[i].onmouseout = function(){roll(this);};
    }
  }

  }
  else{

  }
  
}
// Attached to the buttons and ready to roll
function roll(o) {
  // btn is our off state, so turn it on
  if (o.className == 'externalLink') {
    o.className = 'span-over';
  // Otherwise, turn it off
  } else {
    o.className = 'externalLink';
  }
}

function bookmark_us(){

var url = window.location;
var title = document.title;

if (window.sidebar) // firefox
    window.sidebar.addPanel(title, url, "");
else if(window.opera && window.print){ // opera
    var elem = document.createElement('a');
    elem.setAttribute('href',url);
    elem.setAttribute('title',title);
    elem.setAttribute('rel','sidebar');
    elem.click();
} 
else if(document.all)// ie
    window.external.AddFavorite(url, title);
}

function toggleContent(target) {
		document.getElementById(target).style.display = (document.getElementById(target).style.display == 'block') ? 'none' : 'block';
}
