var postURL = '/js/';
var loadMessage = '
';
jQuery(document).ready(function($){
var mainTab = $(".primaryTabs li a");
var fileGroup = $(".tabContentWrap");
var answersWrap = $(".answersWrap");
$(mainTab).click(function(){
var num = (mainTab.index(this));
$(mainTab).removeClass("active");
$(mainTab[num]).addClass("active");
$(fileGroup).removeClass("show").addClass("hide");
$(fileGroup[num]).removeClass("hide").addClass("show");
$(answersWrap).removeClass("show").addClass("hide");
$(answersWrap[num]).removeClass("hide").addClass("show");
return false;
});
$('#downloadWrap .downloadBtn').click(function(){
s.tl(this,'d','Cloudy Downloads');
});
$('#semaCar').css({display: 'block', left:'-7000px'}).animate({left:'35px'},1000);
$('#semaCarFan').css({display: 'block', left:'-7000px'}).animate({left:'118px'},1000);
$("#snippet-nav .snippet-sec .trigger:first").addClass("highlight")
$(".snippet-content:first").stop().slideToggle("normal");
$("#snippet-nav .snippet-sec .trigger").click(function(){
$(".snippet-content:visible").slideToggle("normal");
$(this).toggleClass("highlight");
$(this).parent().find('.snippet-content').stop().slideToggle('normal', function(){
$('.snippet-content:hidden').parent().find('.trigger').removeClass('highlight');
});
return false;
});
$('#subject').change(function(){handleSubject();});
$('#brand').change(function(){handleBrandChange();});
//OVERLAY CODE
if(navigator.userAgent.indexOf("MSIE 6") != -1){
$("body").children().wrapAll("
");
}
$("body").append("");
var showIt = $(".overlayTrigger");
var topMargin = 20;
var overlayFadeSpeed = 500;
var boxFadeSpeed = 500;
var isIE6 = (navigator.userAgent.indexOf("MSIE 6") != -1) ? true : false;
var ie6FullHeight = true;
var closeDisable = true;
var clicked;
showIt.click(function(){
$('#overlayReturn').html('');
clicked = $(this);
this.blur();
closeDisable = true;
if(isIE6){
$("#cover, #boxWrap").css({position: "absolute"});
if($("body").css("height") == "auto"){
ie6FullHeight = false;
$("html, body").css({height: "100%"});
}
$("#overlayWrap").css({height: "100%", overflow: "auto"});
$("html").css({overflow: "hidden"});
}
$("#cover").addClass("overlay").fadeTo(1, 0.7).fadeIn(overlayFadeSpeed, function(){
showBox();
});
return false;
});
function ie6Reset(){
if(isIE6 && !ie6FullHeight){
$("html, body").css({height: "auto"});
$("html").css({"overflow-y": "auto"});
ie6FullHeight = true;
}
}
function showBox(){
closeDisable = false;
$("#box").addClass("panel").css({"margin-top": topMargin}).fadeTo(1, 1).fadeIn(boxFadeSpeed, function(){
action();
if(isIE6){
$('select').hide();
}
});
}
function action(){
$('#overlayReturn').html(loadMessage);
$.post(postURL,{ type: 'showOverlay', template: clicked.attr('rel')},function(data){
$('#overlayReturn').html(data);
$(".beGone").click(function(event){
if(event.target == this && !closeDisable){
this.blur();
$("#cover, #box").stop().fadeOut(boxFadeSpeed, function(){ie6Reset();});
if(isIE6){
$('select').show();
}
}
return false;
});
});
}
});
function clearText(field) {
if(field.defaultValue == field.value) { field.value = "" }
}
function replaceText(field) {
if(field.value == "") { field.value = field.defaultValue }
}
function toggle(o){
var e = document.getElementById(o);
e.style.display = (e.style.display == 'block') ? 'none' : 'block';
}
function handleSubject(){
var brand = document.getElementById('brand');
var products = document.getElementById('products');
var index = $("#subject option:selected").val();
if(index <= 3 && index != ''){
brand.disabled = false;
}
else{
brand.disabled = true;
brand.selectedIndex = 0;
products.innerHTML = '';
}
}
function handleBrandChange(){
var brand = $("#brand option:selected").val();
getHTML('products','type=products&brand='+brand);
}
function getHTML(div,params){
$.ajax({
type: "POST",
url: postURL,
data: params,
dataType: "html",
success:
function(html){
document.getElementById(div).innerHTML = html;
}
});
}