
// image swapping
function rollOn (obj) { document.getElementById(obj).src = '/themes/shockdoctrine/img/m/on/' + obj + '.png'; }
function rollOff (obj, obj2) { document.getElementById(obj).src = '/themes/shockdoctrine/img/m/' + obj2 + '/' + obj + '.png'; }

prevFlag = 'us';

// jacket swapping
function swapJacket (obj) {
	document.getElementById('sdJacketFlag' + prevFlag).className = '';
	document.getElementById('sdJacketImg').src = '/themes/shockdoctrine/img/jacket_' + obj + '.png';
	document.getElementById('sdJacketFlag' + obj).className = 'activeFlag';
	document.getElementById('sdJacketArrow').className = 'sdJacketArrow' + obj;
	prevFlag = obj;
}


// simple browser sniffer - h/t k10k
var isW3C = (document.getElementById) ? true : false;
var isAll = (document.all) ? true : false;


// no focused links
function unblur () { this.blur (); }
function getLinksToBlur () {
	if ((isW3C) || (isAll)) {
		if (isW3C) {
			var links = document.getElementsByTagName("a");
		} else {
			var links = document.all.tags("a");
		}
		for (i = 0; i < links.length; i++) {
			links[i].onfocus = unblur;
		}
	}
}

function newsletterPop () {
	window.open ('/list/?p=subscribe', 'newsletterForm', 'toolbar=0,scrollbars=1,location=0,statusbar=0,menubar=0,resizable=1,width=525,height=580');
}

window.addEventListener ? window.addEventListener("load",getLinksToBlur,false) : window.attachEvent("onload",getLinksToBlur);

function renderYouTube (videoID, videoW, videoH) {

	var videoW = (videoW == null) ? 425 : videoW;
	var videoH = (videoH == null) ? 350 : videoH;

	document.write ('<object width="' + videoW + '" height="' + videoH + '"><param name="movie" value="http://www.youtube.com/v/' + videoID + '"><param name="wmode" value="transparent"><embed src="http://www.youtube.com/v/' + videoID + '&rel=0" type="application/x-shockwave-flash" wmode="transparent" width="' + videoW + '" height="' + videoH + '"></object>');

}

function youTubeLink (videoID) {
	document.write ('<a href="http://www.youtube.com/watch?v=' + videoID + '"><img src="http://img.youtube.com/vi/' + videoID + '/default.jpg" width="130" height="97" alt="Watch this Video" title="Watch this Video" /></a>');
}

function videoPlayerPop (videoFormat, videoSize) {
	if ( (videoFormat == 'quicktime' || videoFormat == 'windows') && (videoSize == 'high' || videoSize == 'medium') ) {
		var popW = (videoSize == 'high') ? 700 : 380;
		var popH = (videoSize == 'high') ? 540 : 300;
		if (videoFormat == 'windows') popH += 30;
		window.open ('/videoplayer.php?format=' + videoFormat + '&size=' + videoSize, 'video' + videoFormat + videoSize, 'toolbar=0,scrollbars=1,location=0,statusbar=1,menubar=0,resizable=1,width=' + popW + ',height=' + popH);
	}
}


// SD submenu/dropdown functions

function showSDSubMenu (obj) {
	if (document.getElementById('submenu-'+obj)) {
		document.getElementById('submenu-'+obj).style.display = 'block';
		document.getElementById('submenu-'+obj).style.left = (document.getElementById(obj).offsetLeft - 2) + 'px';
	}
}

function hideSDSubMenu (obj) {
	if (document.getElementById('submenu-'+obj)) {
		document.getElementById('submenu-'+obj).style.display = 'none';
	}
}

