var ie=navigator.userAgent.toLowerCase().indexOf('msie')>-1;
function clearIt(e){
if(e.value==e.defaultValue){ e.value=""; }
}
function defaultIt(e){
if(e.value==''){
e.value=e.defaultValue;
}
}
function getFlashVersion(){
try{
try{
var axo=new ActiveXObject('ShockwaveFlash.ShockwaveFlash.6');
try{ axo.AllowScriptAccess='always'; }catch(e){ return'6,0,0'; }
}catch(e){ } return new ActiveXObject('ShockwaveFlash.ShockwaveFlash').GetVariable('$version').replace(/\D+/g, ',').match(/^,?(.+),?$/)[1];
}catch(e){
try{
if(navigator.mimeTypes["application/x-shockwave-flash"].enabledPlugin){
return(navigator.plugins["Shockwave Flash 2.0"] || navigator.plugins["Shockwave Flash"]).description.replace(/\D+/g, ",").match(/^,?(.+),?$/)[1];
}}catch(e){}
} return '0,0,0';
}
jQuery(function($){
// ADD NAV FADE IN/OUT EFFECT
$('#nav ul li ul').css('display','none');
$('#nav ul li').mouseenter(function(){
$(this).children('ul').stop().fadeTo(200,0.95,function(){
$(this).children('ul').css('opacity','');
});
}).mouseleave(function(){
$(this).children('ul').stop().fadeOut(200).css('display','none');
});
// ADD SUBSCRIBE FORM AJAX FUNCTIONALITY
if($('#subscribe.box').length){
var options = {
url: 'http://www.xplore.net/snippets/siteHandler.php?ajax=1',
type: 'post',
success: function(){
var message=$('
Thank you.
You have successfully registered to receive our monthly e-newsletter.
');
$('#subscribe.box').append(message);
$(message).fadeIn(200);
}
};
$('#subscribe.box form').submit(function(){
var errors='';
if($('#subscribe.box form #firstname').val()==''){ errors+="- First name field is empty\n"; }
if($('#subscribe.box form #lastname').val()==''){ errors+="- Last name field is empty\n"; }
if($('#subscribe.box form #email').val()==''){ errors+="- Email field is empty\n"; }
if(errors!=''){ alert("Sorry, the following errors occurred:\n\n"+errors); }
else{
$(this).ajaxSubmit(options);
$('#firstname,#lastname,#company,#email').val('')
}
return false;
});
};
// ADD TWITTER FEED
if($('#tw_feed').length){
$("#tw_feed").getTwitter({
userName: "xploreNET",
numTweets: 3,
loaderText: "Loading tweets...",
slideIn: true,
showHeading: true,
headingText: "Xplore's latest
Tweets:",
showProfileLink: true
});
}
// ADD PORTFOLIO GALLERY FUNCTIONALITY
if($('#portfolio #xhibitGallery').length){
var links=$('#xhibitGallery a');
for(i=0; i < links.length; i++){
if($(links[i]).hasClass('swapLink')){
var id=links[i].id;
if(id!=1){
var href=links[i].href.split('?');
href=href[1].split('&');
href=href[0].replace('dir=','');
img='
';
$('#headSwap').append(img);
}else{
links[i].className+=' active';
$('#imgSwap').addClass('active');
document.getElementById('imgSwap').id='i1';
}
$(links[i]).attr({'href':'javascript:void(0);','target':'','id':'a'+links[i].id}).mousedown(function(){
if($(this).hasClass('active')==false){
var id='#'+this.id.replace('a','i');
var aid='#'+this.id;
$('#headSwap img.active').fadeOut(300,function(){
$('#xhibitGallery a.swapLink.active').removeClass('active');
$(aid).addClass('active');
$(id).fadeIn(300).addClass('active');
}).removeClass('active');
} return false
});
}
}
}
// ADD PORTFOLIO TAB FUNCTIONALITY
if($('#portfolio .b.box .l.box ul li').length>1){
// SHOW TABS
$('#portfolio .b.box .l.box').css('display','block');
$('#portfolio .b.box .r.box').css('width','664px');
$('#portfolio .b.box .r.box .w').css('background-position','549px bottom');
$('#portfolio .b.box .r.box .box').css({'display':'none','width':'380px'});
$('#portfolio .b.box .r.box .box.active').css('display','block');
// ADD TAB FUNCTIONALITY
$('#portfolio .b.box .l.box ul li a').mousedown(function(){
var a='#'+this.id;
var d=this.id.replace('b','c');
if($('#'+d).hasClass('active')==false){
$('#portfolio .b.box .r.box div.box.active').fadeOut(200,function(){
$('#portfolio .b.box .l.box ul li a').removeClass('active');
$(a).addClass('active');
$('#portfolio .b.box .r.box div.box.active').removeClass('active').css('display','none');
$('#'+d).fadeIn(200,function(){
$('#'+d).css('opacity','').addClass('active');
});
});
}
});
}
// ADD 'ADDTHIS' BUTTONS
if($('#home').length){ var addthis='#bottom .w'; }else{ var addthis='#foot .l.box'; }
$(addthis).append('');
// ADD DIAGNOSTICS FUNCTIONALITY
if($('#diagnostics').length){
$('#sr,#ws,#cd,#fl').css('display','block');
$('#name,#from,#to').focus(function(){
clearIt(this);
}).blur(function(){
defaultIt(this);
});
var screenSize=screen.width+'x'+screen.height;
if(ie){ var winSize=document.documentElement.offsetWidth+'x'+document.documentElement.offsetHeight; }
else{ var winSize=window.innerWidth+'x'+window.innerHeight; }
var colourDepth=screen.colorDepth+' bit';
var flashVersion='Version '+getFlashVersion().replace(/,/g,'.');
$('#sr p').text(screenSize);
$('#ws p').text(winSize);
$('#cd p').text(colourDepth);
$('#js p').text('Enabled');
$('#fl p').text(flashVersion);
$('#srF').val(screenSize);
$('#wsF').val(winSize);
$('#cdF').val(colourDepth);
$('#jsF').val('Enabled');
$('#flF').val(flashVersion);
if(navigator.cookieEnabled){ $('#co p').text('Enabled'); $('#coF').val('Enabled'); };
}
});