

if (top.location != this.location) {
    top.location.href = document.location.href;
}
function writeNav(link,name,title) {
	//document.write('<tr><td class="navstyle" align="center"><a title="'+title+'" href="'+link+'">'+name+'</a></td></tr>');
	document.write('<li><a title="'+title+'" href="'+link+'">'+name+'</a></li>');
}
function vidPlayer(idnum) {
	window.open('/news/'+idnum+'/video','vidBox','width=600,height=430,scroll=no,status=no');
}
$("#newsdubs").submit(function() {
	if($("tosaccept").is(':checked')) {
		return true;
	} else {
		alert("You must accept the Terms of Service.");
		return false;
	}
});
function doCheck() {
	if(document.newsdubs.ima.options[document.newsdubs.ima.selectedIndex].value == "Client") {
		$("#cblock").show();
		$("#companyblock").slideDown("normal");
		$("#companyblock2").slideDown("normal");
	} else {
		$("#companyblock").slideUp("normal");
		$("#companyblock2").slideUp("normal");
	}
}
function newsstoryimgs(jimages,box) {
	for(i=0;i<jimages.length;i++) {
		box.html("<img src=\""+jimages[i]['src']+"\" title=\""+jimages[i]['caption']+"\">");
	}
}

function switchArrow(which) {
	$("#arrow"+which).attr("src","images/slideshow/arrowH"+which+".jpg");
}

function returnArrow() {
	$("#arrowL").attr("src","images/slideshow/arrowL.jpg");
	$("#arrowR").attr("src","images/slideshow/arrowR.jpg");
}

var pausestatus = 0;
var currentstory = 1;
var maxstories = stories+1;
var topstoriesCycle;
topstoriesCycle = window.setInterval('switchstories()', 6000);

function switchstories() {
	if(pausestatus == 0) {
		advanceFrame();
	} else {
		return false;
	}
}

function flipNum(num) {
	if(currentstory == num) {
		$("#quikselect"+num).attr("src","images/slideshow/"+num+"h_on.jpg");
	} else {
		$("#quikselect"+num).attr("src","images/slideshow/"+num+"h.jpg");
	}
}

function returnNum(num) {
	if(currentstory == num) {
		$("#quikselect"+num).attr("src","images/slideshow/"+num+"_on.jpg");
	} else {
		$("#quikselect"+num).attr("src","images/slideshow/"+num+".jpg");
	}
}

function advanceFrame() {
	$("#headline"+currentstory).fadeOut("normal",function() {
		$("#quikselect"+currentstory).attr("src","images/slideshow/"+currentstory+".jpg");
		currentstory++;
		if(currentstory >= maxstories) {
			currentstory = 1;
		}
		$("#quikselect"+currentstory).attr("src","images/slideshow/"+currentstory+"_on.jpg");
		$("#headline"+currentstory).fadeIn("normal");
	});
}

function rewindFrame() {
	$("#headline"+currentstory).fadeOut("normal",function() {
		$("#quikselect"+currentstory).attr("src","images/slideshow/"+currentstory+".jpg");
		currentstory--;
		if(currentstory <= 0) {
			currentstory = stories;
		}
		$("#quikselect"+currentstory).attr("src","images/slideshow/"+currentstory+"_on.jpg");
		$("#headline"+currentstory).fadeIn("normal");

	});
}

function selectFrame(framenum) {
	if(currentstory != framenum) {
		$("#headline"+currentstory).fadeOut("normal",function() {
			$("#quikselect"+currentstory).attr("src","images/slideshow/"+currentstory+".jpg");
			currentstory = framenum;
			$("#quikselect"+currentstory).attr("src","images/slideshow/"+currentstory+"_on.jpg");
			$("#headline"+currentstory).fadeIn("normal");
		});
	}
}

function togglepause(which) {
	if(which == 1) {
		$("#playpause").attr("src","images/slideshow/play.jpg");
		pausestatus = which;
	} else {
		$("#playpause").attr("src","images/slideshow/pause.jpg");
		pausestatus = which;
	}
}

function switchActBtn() {
	if(pausestatus == 1) {
		$("#playpause").attr("src","images/slideshow/playH.jpg");
	} else {
		$("#playpause").attr("src","images/slideshow/pauseH.jpg");
	}
}

function returnActBtn() {
	if(pausestatus == 1) {
		$("#playpause").attr("src","images/slideshow/play.jpg");
	} else {
		$("#playpause").attr("src","images/slideshow/pause.jpg");
	}
}

function doActBtn() {
	if(pausestatus == 1) {
		pausestatus = 0;
		$("#playpause").attr("src","images/slideshow/pauseH.jpg");
	} else {
		pausestatus = 1;
		$("#playpause").attr("src","images/slideshow/playH.jpg");
	}
}
