/* rotates which div is displayed on home page and corresponding button styles, based on Customize page animation code  */
function showFeatured() {
	var div1 = document.getElementById('newGames'); // get div called ""
	var gamePos = parseInt(div1.style.height); // div's height
	document.getElementById('featured').style.display = 'block';  //  next div's display set to 'block'
	if (gamePos > 0) {  // as long as height is greater than 0
		div1.style.height = (gamePos - 10) + "px";  // div's height will continue to decrease by x pixels
		setTimeout("showFeatured()", 0);  // set speed for this function, larger numbers are slower
	}
	if (gamePos === 0) {  // once height equals 0
		div1.style.display = 'none';  // div's display equals 'none', then height is reset to original and function continues
		div1.style.height = '360px';
	document.getElementById('two').className = document.getElementById('two').className.replace(/\bselect\b/, 'chosen');  // switch thumbnails
	document.getElementById('one').className = document.getElementById('one').className.replace(/\bchosen\b/, 'select');
	}
}
function showAbout() {
	var div1 = document.getElementById('featured'); // get div called ""
	var gamePos = parseInt(div1.style.height); // div's height
	document.getElementById('about').style.display = 'block';  //  next div's display set to 'block'
	if (gamePos > 0) {  // as long as height is greater than 0
		div1.style.height = (gamePos - 10) + "px";  // div's height will continue to decrease by x pixels
		setTimeout("showAbout()", 0);  // set speed for this function, larger numbers are slower
	}
	if (gamePos === 0) {  // once height equals 0
		div1.style.display = 'none';  // div's display equals 'none', then height is reset to original and function continues
		div1.style.height = '360px';
	document.getElementById('three').className = document.getElementById('three').className.replace(/\bselect\b/, 'chosen');  // switch thumbnails
	document.getElementById('two').className = document.getElementById('two').className.replace(/\bchosen\b/, 'select');
	}
}
function showShows() {
	var div1 = document.getElementById('about'); // get div called ""
	var gamePos = parseInt(div1.style.height); // div's height
	document.getElementById('shows').style.display = 'block';  //  next div's display set to 'block'
	if (gamePos > 0) {  // as long as height is greater than 0
		div1.style.height = (gamePos - 10) + "px";  // div's height will continue to decrease by x pixels
		setTimeout("showShows()", 0);  // set speed for this function, larger numbers are slower
	}
	if (gamePos === 0) {  // once height equals 0
		div1.style.display = 'none';  // div's display equals 'none', then height is reset to original and function continues
		div1.style.height = '360px';
	document.getElementById('four').className = document.getElementById('four').className.replace(/\bselect\b/, 'chosen');  // switch thumbnails
	document.getElementById('three').className = document.getElementById('three').className.replace(/\bchosen\b/, 'select');
	}
}
function showTechs() {
	var div1 = document.getElementById('shows'); // get div called ""
	var gamePos = parseInt(div1.style.height); // div's height
	document.getElementById('techs').style.display = 'block';  //  next div's display set to 'block'
	if (gamePos > 0) {  // as long as height is greater than 0
		div1.style.height = (gamePos - 10) + "px";  // div's height will continue to decrease by x pixels
		setTimeout("showTechs()", 0);  // set speed for this function, larger numbers are slower
	}
	if (gamePos === 0) {  // once height equals 0
		div1.style.display = 'none';  // div's display equals 'none', then height is reset to original and function continues
		div1.style.height = '360px';
	document.getElementById('five').className = document.getElementById('five').className.replace(/\bselect\b/, 'chosen');  // switch thumbnails
	document.getElementById('four').className = document.getElementById('four').className.replace(/\bchosen\b/, 'select');
	}
}
function showNew() {
	var div1 = document.getElementById('techs'); // get div called ""
	var gamePos = parseInt(div1.style.height); // div's height
	document.getElementById('newGames').style.display = 'block';  //  next div's display set to 'block'
	if (gamePos > 0) {  // as long as height is greater than 0
		div1.style.height = (gamePos - 10) + "px";  // div's height will continue to decrease by x pixels
		setTimeout("showNew()", 0);  // set speed for this function, larger numbers are slower
	}
	if (gamePos === 0) {  // once height equals 0
		div1.style.display = 'none';  // div's display equals 'none', then height is reset to original and function continues
		div1.style.height = '360px';
	document.getElementById('one').className = document.getElementById('one').className.replace(/\bselect\b/, 'chosen');  // switch thumbnails
	document.getElementById('five').className = document.getElementById('five').className.replace(/\bchosen\b/, 'select');
	}
}
/*    old version which switches display but does not animate transitions
function showFeatured() {
	document.getElementById('newGames').style.display = 'none';
	document.getElementById('featured').style.display = 'block';
	document.getElementById('two').className = document.getElementById('two').className.replace(/\bselect\b/, 'chosen');
	document.getElementById('one').className = document.getElementById('one').className.replace(/\bchosen\b/, 'select');
}
function showAbout() {
	document.getElementById('featured').style.display = 'none';
	document.getElementById('about').style.display = 'block';
	document.getElementById('three').className = document.getElementById('three').className.replace(/\bselect\b/, 'chosen');
	document.getElementById('two').className = document.getElementById('two').className.replace(/\bchosen\b/, 'select');
}
function showShows() {
	document.getElementById('about').style.display = 'none';
	document.getElementById('shows').style.display = 'block';
	document.getElementById('four').className = document.getElementById('four').className.replace(/\bselect\b/, 'chosen');
	document.getElementById('three').className = document.getElementById('three').className.replace(/\bchosen\b/, 'select');
}
function showTechs() {
	document.getElementById('shows').style.display = 'none';
	document.getElementById('techs').style.display = 'block';
	document.getElementById('five').className = document.getElementById('five').className.replace(/\bselect\b/, 'chosen');
	document.getElementById('four').className = document.getElementById('four').className.replace(/\bchosen\b/, 'select');
}
function showNew() {
	document.getElementById('techs').style.display = 'none';
	document.getElementById('newGames').style.display = 'block';
	document.getElementById('one').className = document.getElementById('one').className.replace(/\bselect\b/, 'chosen');
	document.getElementById('five').className = document.getElementById('five').className.replace(/\bchosen\b/, 'select');
} 
*/


/* switches button div style between select & chosen on home page  */
function homeOver(div_id) {
	var el = document.getElementById(div_id);
	
	if (document.getElementById('newGames').style.display === 'block') {	
		document.getElementById('one').className = document.getElementById('one').className.replace(/\bselect\b/, 'chosen');
		el.className = el.className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('featured').style.display === 'block') {	
		document.getElementById('two').className = document.getElementById('two').className.replace(/\bselect\b/, 'chosen');
		el.className = el.className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('about').style.display === 'block') {	
		document.getElementById('three').className = document.getElementById('three').className.replace(/\bselect\b/, 'chosen');
		el.className = el.className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('shows').style.display === 'block') {	
		document.getElementById('four').className = document.getElementById('four').className.replace(/\bselect\b/, 'chosen');
		el.className = el.className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('techs').style.display === 'block') {	
		document.getElementById('five').className = document.getElementById('five').className.replace(/\bselect\b/, 'chosen');
		el.className = el.className.replace(/\bselect\b/, 'chosen');
	}
	
}
function homeOut(div_id) {
	var el = document.getElementById(div_id);
	
	if (document.getElementById('newGames').style.display === 'block') {	
		el.className = el.className.replace(/\bchosen\b/, 'select');
		document.getElementById('one').className = document.getElementById('one').className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('featured').style.display === 'block') {	
		el.className = el.className.replace(/\bchosen\b/, 'select');
		document.getElementById('two').className = document.getElementById('two').className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('about').style.display === 'block') {	
		el.className = el.className.replace(/\bchosen\b/, 'select');
		document.getElementById('three').className = document.getElementById('three').className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('shows').style.display === 'block') {	
		el.className = el.className.replace(/\bchosen\b/, 'select');
		document.getElementById('four').className = document.getElementById('four').className.replace(/\bselect\b/, 'chosen');
	}
	if (document.getElementById('techs').style.display === 'block') {	
		el.className = el.className.replace(/\bchosen\b/, 'select');
		document.getElementById('five').className = document.getElementById('five').className.replace(/\bselect\b/, 'chosen');
	}
		
}

/* switches Divs on home page */
function homeDv(div_id) {
	var homeID = document.getElementById(div_id);
	
	document.getElementById('newGames').style.display = 'none';
	document.getElementById('featured').style.display='none';
	document.getElementById('about').style.display = 'none';
	document.getElementById('shows').style.display = 'none';
	document.getElementById('techs').style.display = 'none';
	homeID.style.display = 'block';
	clearTimeout(a); // clearing rotating divs functions being called in head of home page
	clearTimeout(b); 
	clearTimeout(c); 
	clearTimeout(d); 
	clearTimeout(e);
}
function homeTb(div_id) {
	var homeID = document.getElementById(div_id);
	
	document.getElementById('one').className = document.getElementById('one').className.replace(/\bchosen\b/, 'select');
	document.getElementById('two').className = document.getElementById('two').className.replace(/\bchosen\b/, 'select');
	document.getElementById('three').className = document.getElementById('three').className.replace(/\bchosen\b/, 'select');
	document.getElementById('four').className = document.getElementById('four').className.replace(/\bchosen\b/, 'select');
	document.getElementById('five').className = document.getElementById('five').className.replace(/\bchosen\b/, 'select');
	homeID.className = homeID.className.replace(/\bselect\b/, 'chosen');
}

/* switches divs & switches tab style between select & chosen on product pages */
/* http://stackoverflow.com/questions/195951/change-an-elements-css-class-with-javascript (replacing class names on elements) */
function prodDv(div_id) {
	var prodID = document.getElementById(div_id);
	
	document.getElementById('description').style.display = 'none';
	document.getElementById('productImages').style.display='none';
	document.getElementById('features').style.display = 'none';
	document.getElementById('options').style.display = 'none';
	document.getElementById('dimensions').style.display = 'none';
	prodID.style.display = 'block';
}
function prodTb(div_id) {
	var prodID = document.getElementById(div_id);
	
	document.getElementById('descriptionTab').className = document.getElementById('descriptionTab').className.replace(/\btabActive\b/, 'tab');
	document.getElementById('featuresTab').className = document.getElementById('featuresTab').className.replace(/\btabActive\b/, 'tab');
	document.getElementById('optionsTab').className = document.getElementById('optionsTab').className.replace(/\btabActive\b/, 'tab');
	document.getElementById('dimensionsTab').className = document.getElementById('dimensionsTab').className.replace(/\btabActive\b/, 'tab');
	document.getElementById('photoTab').className = document.getElementById('photoTab').className.replace(/\btabActive\b/, 'tab');
	prodID.className = prodID.className.replace(/\btab\b/, 'tabActive');
}

/* switches divs on Products page */
function changeProduct(div_id) {
	document.getElementById('importCranes').style.display='none'; 
	document.getElementById('usCranes').style.display='none'; 
	document.getElementById('bigCranes').style.display='none';
	document.getElementById('photoBooths').style.display='none';
	document.getElementById('selfMerch').style.display='none';
	document.getElementById('sportsGames').style.display='none';
	document.getElementById('redemption').style.display='none';
	document.getElementById(div_id).style.display='block';
}

/* switches subtabs & switches tab style between select & chosen on Products page */
function changeProdDv(div_id) {
	var dv = document.getElementById(div_id);
	
	document.getElementById('prod1a').style.display = 'none';
	//document.getElementById('prod1b').style.display = 'none';
	document.getElementById('prod1c').style.display = 'none';
	//document.getElementById('prod1d').style.display = 'none';
	document.getElementById('prod2a').style.display = 'none';
	document.getElementById('prod2b').style.display = 'none';
	document.getElementById('prod2c').style.display = 'none';
	document.getElementById('prod2d').style.display = 'none';
	document.getElementById('prod2e').style.display = 'none';
	document.getElementById('prod2f').style.display = 'none';
	document.getElementById('prod2g').style.display = 'none';
	document.getElementById('prod3a').style.display = 'none';
	document.getElementById('prod4a').style.display = 'none';
	document.getElementById('prod5a').style.display = 'none';
	document.getElementById('prod6a').style.display = 'none';
	document.getElementById('prod7a').style.display = 'none';
	dv.style.display='block';
}
function changeProdTb(div_id) {
	var tb = document.getElementById(div_id);
	
	document.getElementById('prod1atab').className = document.getElementById('prod1atab').className.replace(/\btabActive\b/,'tab');
	//document.getElementById('prod1btab').className = document.getElementById('prod1btab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod1ctab').className = document.getElementById('prod1ctab').className.replace(/\btabActive\b/,'tab');
	//document.getElementById('prod1dtab').className = document.getElementById('prod1dtab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod2atab').className = document.getElementById('prod2atab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod2btab').className = document.getElementById('prod2btab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod2ctab').className = document.getElementById('prod2ctab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod2dtab').className = document.getElementById('prod2dtab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod2etab').className = document.getElementById('prod2etab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod2ftab').className = document.getElementById('prod2ftab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod2gtab').className = document.getElementById('prod2gtab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod3atab').className = document.getElementById('prod3atab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod4atab').className = document.getElementById('prod4atab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod5atab').className = document.getElementById('prod5atab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod6atab').className = document.getElementById('prod6atab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('prod7atab').className = document.getElementById('prod7atab').className.replace(/\btabActive\b/,'tab');
	tb.className = tb.className.replace(/\btab\b/,'tabActive');
}


// from http://forums.devshed.com/javascript-development-115/reading-url-passed-variables-in-javascript-41596.html
// Create a global array that will hold the value of each variable,
// keyed by the name of the variable.
function whichGame() {
var GETDATA = new Array();

// Get the string that follows the "?" in the window's location.
var sGet = window.location.search;
if (sGet) // if has a value...
{
    // Drop the leading "?"
    sGet = sGet.substr(1);
    
    // Generate a string array of the name value pairs.
    // Each array element will have the form "foo=bar"
    var sNVPairs = sGet.split("&");
    
    // Now, for each name-value pair, we need to extract
    // the name and value.
    for (var i = 0; i < sNVPairs.length; i++)
    {
        // So, sNVPairs[i] contains the current element...
        // Split it at the equals sign.
        var sNV = sNVPairs[i].split("=");
        
        // Assign the pair to the GETDATA array.
        var sName = sNV[0];
        var sValue = sNV[1];
        GETDATA[sName] = sValue;
    }
}

// Finally, assign the value to the form input.
if (GETDATA["v"] != undefined)
    // Just in case we forgot to pass something to "v"...
    document.forms.MyForm.v.value = GETDATA["v"];
}

/* switches subtabs & switches tab style between select & chosen on Tech page */
function changeDv(div_id) {
	var dv = document.getElementById(div_id);
	
	document.getElementById('tech1').style.display = 'none';
	document.getElementById('tech2').style.display = 'none';
	document.getElementById('tech3').style.display = 'none';
	document.getElementById('tech4').style.display = 'none';
	document.getElementById('tech5').style.display = 'none';
	dv.style.display='block';
}
function changeTb(div_id) {
	var tb = document.getElementById(div_id);
	
	document.getElementById('tech1tab').className = document.getElementById('tech1tab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('tech2tab').className = document.getElementById('tech2tab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('tech3tab').className = document.getElementById('tech3tab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('tech4tab').className = document.getElementById('tech4tab').className.replace(/\btabActive\b/,'tab');
	document.getElementById('tech5tab').className = document.getElementById('tech5tab').className.replace(/\btabActive\b/,'tab');
	tb.className = tb.className.replace(/\btab\b/,'tabActive');
}

/* switches subtabs & switches tab style between select & chosen on Parts page */
function changeCatDv(div_id) {
	var dv = document.getElementById(div_id);
	
	document.getElementById('parts1a').style.display = 'none';
	//document.getElementById('parts1b').style.display = 'none';
	// document.getElementById('parts1c').style.display = 'none';
	// document.getElementById('parts1d').style.display = 'none';
	// document.getElementById('parts1e').style.display = 'none';
	// document.getElementById('parts1f').style.display = 'none';
	// document.getElementById('parts1g').style.display = 'none';
	// document.getElementById('parts1h').style.display = 'none';
	document.getElementById('parts2a').style.display = 'none';
	// document.getElementById('parts2b').style.display = 'none';
	document.getElementById('parts3a').style.display = 'none';
	// document.getElementById('parts3b').style.display = 'none';
	document.getElementById('parts4a').style.display = 'none';
	// document.getElementById('parts4b').style.display = 'none';
	document.getElementById('parts5a').style.display = 'none';
	// document.getElementById('parts5b').style.display = 'none';
	document.getElementById('parts6a').style.display = 'none';
	// document.getElementById('parts6b').style.display = 'none';
	dv.style.display='block';
}
function changeCatTb(div_id) {
	var tb = document.getElementById(div_id);
	
	document.getElementById('parts1tab1').className = document.getElementById('parts1tab1').className.replace(/\btabActive\b/,'tab');
	document.getElementById('parts1tab2').className = document.getElementById('parts1tab2').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts1tab3').className = document.getElementById('parts1tab3').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts1tab4').className = document.getElementById('parts1tab4').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts1tab5').className = document.getElementById('parts1tab5').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts1tab6').className = document.getElementById('parts1tab6').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts1tab7').className = document.getElementById('parts1tab7').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts1tab8').className = document.getElementById('parts1tab8').className.replace(/\btabActive\b/,'tab');
	document.getElementById('parts2tab1').className = document.getElementById('parts2tab1').className.replace(/\btabActive\b/,'tab');
	document.getElementById('parts3tab1').className = document.getElementById('parts3tab1').className.replace(/\btabActive\b/,'tab');
	document.getElementById('parts4tab1').className = document.getElementById('parts4tab1').className.replace(/\btabActive\b/,'tab');
	document.getElementById('parts5tab1').className = document.getElementById('parts5tab1').className.replace(/\btabActive\b/,'tab');
	document.getElementById('parts6tab1').className = document.getElementById('parts6tab1').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts2tab2').className = document.getElementById('parts2tab2').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts3tab2').className = document.getElementById('parts3tab2').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts4tab2').className = document.getElementById('parts4tab2').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts5tab2').className = document.getElementById('parts5tab2').className.replace(/\btabActive\b/,'tab');
	// document.getElementById('parts6tab2').className = document.getElementById('parts6tab2').className.replace(/\btabActive\b/,'tab');
	tb.className = tb.className.replace(/\btab\b/,'tabActive');
}



/* blanket & popUpDiv from http://www.pat-burt.com/web-development/how-to-do-a-css-popup-without-opening-a-new-window/ */

function toggle(div_id) {  /* This simply toggles the inserted div name from being displayed (display:block) to being hidden (display:none). */
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function blanket_size(popUpDivVar) {  /* This resizes the blanket to fit the height of the page because there is not height=100% attribute. This also centers the popUp vertically. */
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-225;//225 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_pos(popUpDivVar) {  /* This centers the popUp vertically. */
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-250;//250 is half popup's width
	popUpDiv.style.left = window_width + 'px';
}
function popup(windowname) {  /* This function contains the other three to make life simple in the HTML file. */
	blanket_size(windowname);
	window_pos(windowname);
	toggle('blanket');
	toggle(windowname);		
}

//  for Parts Viewer
function toggle(div_id) {  /* This simply toggles the inserted div name from being displayed (display:block) to being hidden (display:none). */
	var el = document.getElementById(div_id);
	if ( el.style.display == 'none' ) {	el.style.display = 'block';}
	else {el.style.display = 'none';}
}
function blanket_Parts(popUpDivVar) {  /* This resizes the blanket to fit the height of the page because there is not height=100% attribute. This also centers the popUp vertically. */
	if (typeof window.innerWidth != 'undefined') {
		viewportheight = window.innerHeight;
	} else {
		viewportheight = document.documentElement.clientHeight;
	}
	if ((viewportheight > document.body.parentNode.scrollHeight) && (viewportheight > document.body.parentNode.clientHeight)) {
		blanket_height = viewportheight;
	} else {
		if (document.body.parentNode.clientHeight > document.body.parentNode.scrollHeight) {
			blanket_height = document.body.parentNode.clientHeight;
		} else {
			blanket_height = document.body.parentNode.scrollHeight;
		}
	}
	var blanket = document.getElementById('blanket');
	blanket.style.height = blanket_height + 'px';
	var popUpDiv = document.getElementById(popUpDivVar);
	popUpDiv_height=blanket_height/2-250;//250 is half popup's height
	popUpDiv.style.top = popUpDiv_height + 'px';
}
function window_Parts(popUpDivVar) {  /* This centers the popUp vertically. */
	if (typeof window.innerWidth != 'undefined') {
		viewportwidth = window.innerHeight;
	} else {
		viewportwidth = document.documentElement.clientHeight;
	}
	if ((viewportwidth > document.body.parentNode.scrollWidth) && (viewportwidth > document.body.parentNode.clientWidth)) {
		window_width = viewportwidth;
	} else {
		if (document.body.parentNode.clientWidth > document.body.parentNode.scrollWidth) {
			window_width = document.body.parentNode.clientWidth;
		} else {
			window_width = document.body.parentNode.scrollWidth;
		}
	}
	var popUpDiv = document.getElementById(popUpDivVar);
	window_width=window_width/2-450;//450 is half popup's width
	popUpDiv.style.left = window_width + 'px';
}
function showViewer(windowname) {  /* This function contains the other three to make life simple in the HTML file. */
	blanket_Parts(windowname);
	window_Parts(windowname);
	toggle('blanket');
	toggle(windowname);		
}


/* show or hide image1 and videos */
function showImage1() {
	document.getElementById('image1').style.display='block';
	document.getElementById('video1').style.display='none';
}
function showVideo1() {
	document.getElementById('image1').style.display='none';
	document.getElementById('video1').style.display='block';
}

/* open up one-sheet print view for Product pages based on http://winfolinx.com/tips/howto/various/printready.htm */
var gAutoPrint = true; // Flag for whether or not to automatically call the print function
function printSpecial()
{
	if (document.getElementById != null)
	{
		var html = '<HTML>\n<HEAD>\n';
		
		/*  if (document.getElementsByTagName != null)
		{
			var headTags = document.getElementsByTagName("head");
			if (headTags.length > 0)
				html += headTags[0].innerHTML;	
		}  //this section used to grab all tags in head section  */ 
		
		html += '\n<link rel="stylesheet" type="text/css" media="screen, print" href="http:/'+'/smartind.com/print-product.css"></HE' + 'AD>\n<BODY>\n';  // add link stylesheet for print layout into head
		
		var printReadyElem = document.getElementById("container");  // get contents of "container" div of the page
		
		if (printReadyElem != null)
		{
				html += printReadyElem.innerHTML;  // add "container" to page
				
		}
		else
		{
			alert("Could not find the printReady section in the HTML");
			return;
		}
			
		html += '\n</BO' + 'DY>\n</HT' + 'ML>';  // close up the html of the print page
		
		var printWin = window.open("","printSpecial");  // open new page
		printWin.document.open();
		printWin.document.write(html);  // write html code to new page
		printWin.document.getElementById('description').style.display = 'block';  // display all divs in case they have been changed
		printWin.document.getElementById('productImages').style.display='block';
		printWin.document.getElementById('features').style.display = 'block';
		printWin.document.getElementById('options').style.display = 'block';
		printWin.document.getElementById('dimensions').style.display = 'block';
		printWin.document.close();
		if (gAutoPrint)
			printWin.print();
	}
	else
	{
		alert("Sorry, the print ready feature is only available in modern browsers.");
	}
}


/* image slideshow for Customize page based on "Designing with Javascript: building dynamic web pages"  */
/* function showLayer() {
	var hiddenLayer = document.getElementById("slideshow");
	var layerPosition = parseInt(hiddenLayer.style.left);
	
	if (layerPosition < 0) {
		hiddenLayer.style.left = (layerPosition + 5) + "px";
		setTimeout("showLayer()", 20);
	}
}

function hideLayer() {
	var hiddenLayer = document.getElementById("slideshow");
	hiddenLayer.style.left = "-75px";
}
*/

function slideLeft() {
	var custGame = document.getElementById("slideshow"); // get div called "slideshow"
	var gamePos = parseInt(custGame.style.left); // slideshow's left position
	
	if (gamePos > -1450) {  // as long as left position is greater than x...
		custGame.style.left = (gamePos - 2) + "px";  // slideshow's left position will continue to decrease by x pixels
		setTimeout("slideLeft()", 80);  // set speed for this function, larger numbers are slower
	}
	if (gamePos === -1450) {  // once left position equals x...
		custGame.style.left = "600px";  // slideshow's left position moves to new position and slideLeft() continues
		setTimeout("slideLeft()", 80);  // set speed for this function, larger numbers are slower
	}
	/* if (gamePos < -799) {
		showLayer();
	}
	if (gamePos > -1) {
		slideLeft(); 
	}*/
}

/* different versions at  http://www.webmonkey.com/2010/02/make_a_javascript_slideshow/ and http://www.webmasterworld.com/javascript/3880255.htm */


/* shows/hides Distributor office divs */
function getOffice(div_id) {
	var office = document.getElementById(div_id);
	if (office.style.display = 'none') {
		office.style.display = 'block';
	}
	else {office.style.display = 'none';}
}
function clearOffice(div_id) {
	document.getElementById(div_id).style.display = 'none';
}


