﻿function togglePerma(action)
{
    var perma = document.getElementById("permablock");
    if (perma != null) {
        if (action == 'show')
        {
            perma.style.display = 'block';
        } else {
            perma.style.display = 'none';
        }
    }
}

function confirm_email(){
    var target = document.getElementById("confirm-email");
    target.innerHTML="Thank you. Your request has been sent.<br/>&nbsp;";
}

function contact_confirm(){
    var target = document.getElementById("contact-confirm");
    target.innerHTML="Thank you. Your request has been sent.";
}

function tab(target){
    destroyScroll();
    
    //reveal content
    var root = document.getElementById("tab-content-wrapper");
    var tabs = root.getElementsByTagName("div");
    for(var i=0; i<5; i++){ //clear
       tabs[i].style.display="none";
    }
    tabs[target].style.display="block"; //show
    
    var  rootTab=document.getElementById("tabs");
    var links =rootTab.getElementsByTagName("ul")[0].getElementsByTagName("li");
    for(var i=0; i<links.length; i++){ //reset hilight
        var anchor = links[i].getElementsByTagName("a")[0];
        var loc = anchor.className.indexOf(" ");
        //console.log(loc);
        if(loc!=-1){
            anchor.className=anchor.className.substring(0,loc);
        }
    }
   links[target].getElementsByTagName("a")[0].className+=" active";//hilight
   
   initScrollbars();//scroll power!
}

var current = 0;
var size = {
    'bas':[
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'}, 
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'} 
    ],
    'kne':[
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'}, 
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'} 
    ],
	
	'bac':[
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'}, 
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'} 
    ],
	
	'bag':[
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'}, 
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'},
        {'margin':'12px 0 0 19px', 'width':'476px', 'height':'327px'} 
    ]
	
	
}
function reveal(target){
	//alert(target);
    var cat =target.className.substring(0,3);
    //alert(cat);
    var num= parseInt(target.className.charAt(3));
    //alert(num);
    var targetImg = document.getElementById("large-img");
	//alert(targetImg.src);
    targetImg.style.display="none"; //temp hide
	targetImg.src= targetImg.src.substring(0,targetImg.src.length-5)+num+".png"; //swap img
    //alert(targetImg.src);
    $('#large-img').load(function(){
        $('#large-img').css(size[cat][num-1]); // position and size!
        targetImg.style.display="block"; //reveal
    });
    //the shading
    var ul = target.parentNode.parentNode;
    var anchors = ul.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++){ //loop to find what to unshade
        var loc = anchors[i].className.indexOf("_");
        if(loc!=-1){
            anchors[i].className=anchors[i].className.substring(0,loc);
        }
    }
    target.className += "_select";//shade 
}

function revealWhite(target){
	//alert(target);
    var cat =target.className.substring(0,4);
    //alert(cat);
    var num= parseInt(target.className.charAt(4));
    //alert(num);
    var targetImg = document.getElementById("large-img");
	//alert(targetImg.src);
    targetImg.style.display="none"; //temp hide
	targetImg.src= targetImg.src.substring(0,targetImg.src.indexOf("basketball"))+"basketballw-large"+num+".png"; //swap img
	
    //alert(targetImg.src);
    $('#large-img').load(function(){
        //$('#large-img').css(size[cat][num-1]); // position and size!
        targetImg.style.display="block"; //reveal
    });
    //the shading
    var ul = target.parentNode.parentNode;
    var anchors = ul.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++){ //loop to find what to unshade
        var loc = anchors[i].className.indexOf("_");
        if(loc!=-1){
            anchors[i].className=anchors[i].className.substring(0,loc);
        }
    }
    target.className += "_select";//shade 
	//alert(target.className);
	}
