function checkemail() {
var error = "" ;
apos = $('email').value.indexOf("@")
dotpos = $('email').value.lastIndexOf(".")
if ($('email').value == "" || apos<1 || dotpos-apos<2)
{
alert("Please enter your email address.");
return false;
}
}

jQuery.noConflict();

Array.prototype.in_array=function(v){
 for(var i in this)
  if(this[i]==v)
   return true;
 return false;
}
String.prototype.toId=function(){
 return this.toLowerCase().replace(/[^a-z0-9]/g,'');
}
function showp(a) {
window.location = "../../code/includes/partner_go.asp?id="+a
}
function showl(a) {
window.location = "../../code/includes/partner_go.asp?alp="+a
}
// Nav functions-->
jQuery(function(){
 if(cookie.read('acu_text_only')==1)
  return false;

 jQuery('#nav ul li').hover(function(){
  jQuery(this).addClass('sfhover');
 },function(){
  jQuery(this).removeClass('sfhover');
 });
 jQuery('#nav ul ul').each(function(){
  var _width=jQuery(this).width()+20;
  jQuery('li a',this).width(_width);
 });
 jQuery('#nav>div>ul>li').hover(function(){
  jQuery(this).children('a').addClass('hover');
 },function(){
  jQuery(this).children('a').removeClass('hover');
 });
 jQuery('#nav ul ul li:has(ul)').addClass('sub');

 jQuery('div#nav ul li ul li').hover(function(){
  jQuery(this).find('ul').css({'left':jQuery(this).parent().width()-2,'top':jQuery(this).offset().top-jQuery(this).parent().offset().top-14});
 },function(){
  jQuery(this).find('ul').css('left','-999em');
 });
});

var tabs={
 on:null,
 init:function(){
  if(jQuery('#tabs').length){
   tabs.on=jQuery('#tabs a.on').get(0);
   jQuery('#tabs a').each(function(){
    if(window.location.hash=='#'+jQuery(this).attr('href').split('#')[1]){
     jQuery(tabs.on).removeClass('on');
     jQuery(this).addClass('on');
     tabs.on=this;
    }
   });
   jQuery('#tabs a').focus(function(){this.blur();}).each(function(){
    if(!jQuery(this).hasClass('on'))
     jQuery('#'+jQuery(this).attr('rel')).hide();
   }).click(function(){
    jQuery(tabs.on).removeClass('on');
    jQuery(this).addClass('on');
    jQuery('#'+jQuery(tabs.on).attr('rel')).hide();
    jQuery('#'+jQuery(this).attr('rel')).show();
    tabs.on=this;
    set_footer();
    return false;
   });
  }
  set_footer();
 }
}

var star_grey=_root+'images/star-grey.png',star_red=_root+'images/star-red.png',submit_btn=_root+'images/feedback-submit.png',star_html='<p class="stars" rel="%s%">';
for(var i=1;i<6;i++) star_html+='<img src="'+star_grey+'" alt="" id="star_%s%_'+i+'" onmouseover="feedback_stars(this,\'over\',\'%s%\','+i+');" onmouseout="feedback_stars(this,\'out\',\'%s%\','+i+');" onclick="feedback_stars(this,\'click\',\'%s%\','+i+');" width="15" height="15" /><input type="hidden" id="rating_%s%" value="-1" />';star_html+='</p>';
var fb_html='<div id="feedback_div"><form action="code/includes/feedbackpop.asp" method="post"><div class="left"><p class="title">Your feedback</p><p style="clear:both;">This page</p><p class="indent">Content:</p>'+star_html.replace(/%s%/gi,'content')+'<p class="indent">Ease of use:</p>'+star_html.replace(/%s%/gi,'ease')+'<p style="clear:both;">Whole site</p><p class="indent">Navigation:</p>'+star_html.replace(/%s%/gi,'navigation')+'<p class="indent">Finding what you<br />were looking for:</p>'+star_html.replace(/%s%/gi,'finding')+'<p class="indent">Overall:</p>'+star_html.replace(/%s%/gi,'overall')+'</div>'+
'<div class="right"><p>Comments:</p><textarea name="comments" cols="10" rows="5"></textarea><p>Name:</p><input type="text" name="name" value="" /><p>Company:</p><input type="text" name="company" value="" /><p>Email:</p><input type="text" name="email" value="" /></div><div><input type="image" name="submit" src="'+submit_btn+'" class="image" /></div></form></div>';

function feedback(obj){
 if(fb_html!=''){
  jQuery(document.body).append(fb_html);
  fb_html='';
  _offset=jQuery(obj).offset();
  jQuery('#feedback_div').css({'left':_offset.left-jQuery('#feedback_div').width()+jQuery(obj).width()-5,'top':_offset.top-290});
  //jQuery('img[@src$=.png]','#feedback_div').ifixpng(); 
 }
 if(jQuery('#feedback_div').is(':visible')) jQuery('#feedback_div').fadeOut(250);
 else jQuery('#feedback_div').fadeIn(250);
}
jQuery(document).click(function(e){
 if(jQuery('#feedback_div').is(':visible')){
  var obj=e.target,ids=[];
  while(obj.parentNode){
   ids[ids.length]=obj.id;
   obj=obj.parentNode;
  }
  if(!ids.in_array('feedback_div') && !ids.in_array('feedback_a'))
   jQuery('#feedback_div').fadeOut(250);
 }
});
var fb_r=[];
function feedback_stars(obj,b,s,r){
 switch(b){
  case 'over' :
   for(var i=1;i<6;i++){
    if(i<=r) jQuery('#star_'+s+'_'+i).attr('src',star_red);
    else jQuery('#star_'+s+'_'+i).attr('src',star_grey);
   }
   break;
  case 'out' :
   for(var i=1;i<6;i++){
    if(typeof fb_r[s]!='undefined' && i<=fb_r[s]) jQuery('#star_'+s+'_'+i).attr('src',star_red);
    else jQuery('#star_'+s+'_'+i).attr('src',star_grey);
   }
   break;
  case 'click' :
   fb_r[s]=r;
   jQuery('#rating_'+s).val(r);
   break;
 }
}

var enlarge={
 time:450,
 load:'<img id="enlarge-load" src="'+_root+'images/loader.gif" alt="Loading..." style="position:absolute;" />',
 html:'<div id="enlarge-c"><img id="enlarge-img" src="%src%" alt="%alt%" /><a href="#" onclick="enlarge.close();return false;">Close image</a></div>',
 showing:false,
 init:function(){
  jQuery('div.solutions-image a').click(function(){
   if(enlarge.showing) 
    return false;
   enlarge.showing=true;
   var $img=jQuery(this).parent().find('img'),src=this.href,alt=this.alt,height=0,width=0;
   var top=$img.offset().top,left=$img.offset().left,tmb_width=$img.width(),tmb_height=$img.height();
   
   jQuery(document.body).append(enlarge.load);
   jQuery('#enlarge-load').show().css({top:top+(tmb_height-32)/2,left:left+(tmb_width-32)/2});

   var _loader=new Image();
   _loader.onload=function(){
    jQuery('#enlarge-load').remove();

    width=this.width;
    height=this.height;

    var html=enlarge.html.replace(/%src%/gi,src).replace(/%alt%/gi,alt);

    jQuery(document.body).append(html);
    jQuery('#enlarge-c').show().css({top:top,left:left,opacity:0});
    jQuery('#enlarge-img').css({width:tmb_width,height:tmb_height});
		
    top=jQuery(window).scrollTop()+(jQuery(window).height()-height)/2;
    left=jQuery(window).scrollLeft()+(jQuery(window).width()-width)/2;

    jQuery('#enlarge-c').animate({opacity:0.95,top:top,left:left},{duration:enlarge.time,queue:false});
    jQuery('#enlarge-c,#enlarge-img').animate({width:width,height:height},enlarge.time);

    jQuery(window).scroll(function(){
     top=jQuery(window).scrollTop()+(jQuery(window).height()-height)/2;
     left=jQuery(window).scrollLeft()+(jQuery(window).width()-width)/2;
     jQuery('#enlarge-c').dequeue().animate({top:top,left:left},enlarge.time);
    });
    jQuery(document).click(function(e){
     var _obj=e.target,_id=[],close=true;
     while(_obj.parentNode){
      _id[_id.length]=_obj.id;
      _obj=_obj.parentNode;
     }
     for(var q=0;q<_id.length;q++)
      if(_id[q].indexOf('enlarge')>-1)
       close=false;
     if(close)
      enlarge.close();
    });
   };
   _loader.src=src;
   return false;
  });
 },
 close:function(){
  jQuery('#enlarge-c').animate({opacity:0,top:'+=50px'},enlarge.time,function(){
   jQuery('#enlarge-c').remove();
   enlarge.showing=false;
   jQuery(document).click(function(){});
  });
  return false;
 }
}
function Bookmark(){
 var url=window.location.href,title=document.title;
 if(window.sidebar) 
  window.sidebar.addPanel(title,url,'');
 else if(window.external)
  window.external.AddFavorite(url,title);
}

function select(s,url){
 window.location.href='http://www.aculab.com/'+url+s[s.selectedIndex].value.toLowerCase();
}

var to_flag=true;
function text_only(){
 var o = document.getElementById('notTE');

 jQuery('link[@rel*=style]').each(function(){
  this.disabled=to_flag;
 });
 if(to_flag){
  cookie.create('acu_text_only','1',30);
  text_only_css();
    if (o )  {
dotextonly();
 }
 }else{
  cookie.remove('acu_text_only');
  jQuery('#to_css,#to_div').remove();
    if (o )  {
dotextonly1();
 }
 }
to_flag=!to_flag;



}

function dotextonly () {
   $('notTE').style.display='none';
   $('TE').style.display='block';

 
 return false;
 }
 function dotextonly1 () {
   $('notTE').style.display='block';
   $('TE').style.display='none';

 return false;
 }
 
jQuery(function(){
 if(cookie.read('acu_text_only')==1){
  jQuery('link[@rel*=style]').each(function(){
   this.disabled=to_flag;
  });
	text_only_css();
  to_flag=false;
 }
});
function text_only_css(){
 jQuery(document.body).append('<div id="to_div">You are currently viewing the text only version. <a href="#" onclick="text_only();return false;">Change to full view</a>.</div>');
 var sheet=document.createElement('link');
 sheet.setAttribute('rel','stylesheet');
 sheet.setAttribute('type','text/css');
 sheet.setAttribute('media','all');
 sheet.setAttribute('id','to_css');
 sheet.setAttribute('href','/css/textonly.css');
 document.body.appendChild(sheet);
}

var cookie={
 create:function(name,value,days){
  if(days){
   var date=new Date();
   date.setTime(date.getTime()+(days*24*60*60*1000));
   var expires='; expires='+date.toGMTString();
  }else
   var expires='';
  document.cookie=name+'='+value+expires+'; path=/';
 },
 read:function(name){
  var nameEQ=name+'=';
	var ca=document.cookie.split(';');
  for(var i=0;i<ca.length;i++){
   var c=ca[i];
   while(c.charAt(0)==' ') c=c.substring(1,c.length);
   if(c.indexOf(nameEQ)==0) return c.substring(nameEQ.length,c.length);
  }
  return null;
 },
 remove:function(name){
  cookie.create(name,'',-1);
 }
}

function get_winheight(){
 var windowHeight=0;
 if(typeof(window.innerHeight)=='number')
  windowHeight=window.innerHeight;
 else if(document.documentElement && document.documentElement.clientHeight)
  windowHeight=document.documentElement.clientHeight;
 else if(document.body && document.body.clientHeight)
  windowHeight=document.body.clientHeight;
 return windowHeight;
}
function set_footer() {
 if(!document.getElementById) return;
 var win_h=get_winheight(),total_h=0,footer_h=jQuery('#footer').height();
 jQuery('div:has(div.wrap)').each(function(){
  if(this.id!='footer')
   total_h+=jQuery(this).height();
 });
 jQuery('#footer').css({'marginTop':0});
 if(win_h-total_h-footer_h>0)
  jQuery('#footer').css({'marginTop':(win_h-total_h-footer_h)});
}

function _print(){
 window.print();
 return false;
}

/**
 *
 * Copyright (c) 2007 Tom Deater (http://www.tomdeater.com)
 * Licensed under the MIT License:
 * http://www.opensource.org/licenses/mit-license.php
 * 
 */
(function($){
 $.fn.equalizeCols=function(){
  var height=0,reset=$.browser.msie?'1%':'auto';
  return this.css('height',reset).each(function(){
   height=Math.max(height,this.offsetHeight);
  }).css("height",height).each(function(){
   var h=this.offsetHeight;
   if(h>height)
    jQuery(this).css('height',height-(h-height));
  });
 };
})(jQuery);

/*
 * jQuery ifixpng plugin
 * (previously known as pngfix)
 * Version 2.1  (23/04/2008)
 * @requires jQuery v1.1.3 or above
 *
 * Examples at: http://jquery.khurshid.com
 * Copyright (c) 2007 Kush M.
 * Dual licensed under the MIT and GPL licenses:
 * http://www.opensource.org/licenses/mit-license.php
 * http://www.gnu.org/licenses/gpl.html
 */
(function($){
 $.ifixpng=function(customPixel){
  $.ifixpng.pixel=customPixel;
 };
 $.ifixpng.getPixel=function(){
  return $.ifixpng.pixel || '../images/pixel.gif';
 };
 var hack={
  ltie7:$.browser.msie && $.browser.version<7,
  filter:function(src){
   return "progid:DXImageTransform.Microsoft.AlphaImageLoader(enabled=true,sizingMethod=crop,src='"+src+"')";
  }
 };
 $.fn.ifixpng=hack.ltie7?function(){
  return this.each(function(){
   var $$=jQuery(this);
   // in case rewriting urls
   var base=jQuery('base').attr('href');
   if(base){
    // remove anything after the last '/'
    base=base.replace(/\/[^\/]+$/,'/');
   }
   if($$.is('img') || $$.is('input')){ // hack image tags present in dom
    if($$.attr('src')){
     if($$.attr('src').match(/.*\.png([?].*)?$/i)){ // make sure it is png image
      // use source tag value if set 
      var source=(base && $$.attr('src').search(/^(\/|http:)/i))?base+$$.attr('src'):$$.attr('src');
      // apply filter
      $$.css({filter:hack.filter(source), width:$$.width(), height:$$.height()})
        .attr({src:$.ifixpng.getPixel()})
        .positionFix();
     }
    }
   }else{ // hack png css properties present inside css
    var image=$$.css('backgroundImage');
    if(image.match(/^url\(["']?(.*\.png([?].*)?)["']?\)$/i)){
     image=RegExp.$1;
     image=(base && image.substring(0,1)!='/')?base+image:image;
     $$.css({backgroundImage:'none',filter:hack.filter(image)})
       .children().children().positionFix();
    }
   }
  });
 }:function(){return this;};
 $.fn.iunfixpng=hack.ltie7?function(){
  return this.each(function(){
   var $$=jQuery(this);
   var src=$$.css('filter');
   if(src.match(/src=["']?(.*\.png([?].*)?)["']?/i)){
    src=RegExp.$1;
    if($$.is('img') || $$.is('input')){
     $$.attr({src:src}).css({filter:''});
    }else{
     $$.css({filter:'',background:'url('+src+')'});
    }
   }
  });
 }:function(){return this;};
 $.fn.positionFix=function(){
  return this.each(function(){
   var $$=jQuery(this);
   var position=$$.css('position');
   if(position!='absolute' && position!='relative'){
    $$.css({position:'relative'});
   }
  });
 };
})(jQuery);

var calendar={
 events:[],div_id:'',
 init:function(id,did){
  calendar.div_id=did;
  for(var e=0;e<calendar.events.length;e++){
   date=calendar.events[e][0].split('/');
   if(date[2]==cur_year && date[1]==cur_month){
    jQuery('#'+id+' td').each(function(){
     if(jQuery(this).html()==date[0])
      jQuery(this).addClass('event').attr('id','date-'+date.join('-')).click(function(){
       calendar.show(this);
      });
    });
   }
  }
 },
 show:function(obj){
  for(var e=0;e<calendar.events.length;e++){
   if(calendar.events[e][0]==obj.id.replace(/date-/ig,'').replace(/-/g,'/')){
    jQuery('#'+calendar.div_id).html('<p><strong>'+calendar.events[e][1]+'</strong></p><p>'+calendar.events[e][2]+'</p>');
    if(jQuery('#'+calendar.div_id).is(':hidden'))
     jQuery('#'+calendar.div_id).show('fast');
   }
  } 
 }
}

function contact(w){
 jQuery('#contact-map,#contact-photo').hide();
 jQuery('#contact-'+w).show();
 jQuery('#contact-a-map,#contact-a-photo').removeClass('on');
 jQuery('#contact-a-'+w).addClass('on');
}

jQuery(document).mousedown(function(e){
 var t=e.target;
 if(jQuery(t).is('object') || jQuery(t).is('embed')){
  t.blur();
  window.focus();
 }
});

jQuery(function(){
 set_footer();
 tabs.init();
 enlarge.init();
 
 jQuery('#crumbs a').focus(function(){this.blur();});
 
 jQuery('div.pipes div.pipe').equalizeCols();
 
 jQuery('div.resource div.products,div.resource div.partners').each(function(){
  jQuery(this).height(jQuery(this).parent().height());
 });
 
 jQuery('div.column-left p:has(strong)').css({margin:'15px 0 -8px 0'});
});
jQuery(window).resize(function(){
 set_footer();
});