// JavaScript Document

//GENERAL FUNCTIONS

function change() {
	document.getElementById('unsColumnOne').className = 'first-row one-column home-slc-two huge-over-font left';
}
function toggle() {
	document.getElementById('unsColumnOne').className = 'first-row one-column home-uns-two huge-font left';
}

function changeT() {
	document.getElementById('unsColumnTwo').className = 'first-row one-column home-slc-three huge-over-font left';
}
function toggleT() {
	document.getElementById('unsColumnTwo').className = 'first-row one-column home-uns-three huge-font left';
}

function changeF() {
	document.getElementById('unsColumnThree').className = 'first-row one-column home-slc-four huge-over-font left';
}
function toggleF() {
	document.getElementById('unsColumnThree').className = 'first-row one-column home-uns-four huge-font left';
}

function changeLine(id) {
	document.getElementById(id).className = 'vLine-Mus left';
}
function toggleLine(id) {
	document.getElementById(id).className = 'vLine-Red left';
}

function display(id) {
	document.getElementById(id).className = 'display';
}

function hide(id) {
	document.getElementById(id).className = 'hide';
}

function titleColour(id) {
	document.getElementById(id).style.color = '#CC0000';
}

function whiteColour(id) {
	document.getElementById(id).style.color = '#FFFFFF';
}

function resetColour(id) {
	document.getElementById(id).style.color = '#a57a39';
}

// MENU FUNCTIONS

function subMenu(){
	document.getElementById('mojo').className = 'subMenuNoHit display';
	document.getElementById('modellerMenu').className = 'menu-item-over menu-font-over shadow left';
	document.getElementById('modellerMenuLine').className = 'subMenuLine display';
	document.getElementById('modellerSubMenu').className = 'subMenuTab shadow display';
}

function subMenuInner(){
	document.getElementById('mojo').className = 'subMenuNoHit display';
	document.getElementById('modellerMenu').className = 'menu-item-over menu-font-over shadow left';
	document.getElementById('modellerMenuLine').className = 'subMenuLineInner display';
	document.getElementById('modellerSubMenu').className = 'subMenuTabInner shadow display';
}

function hideMenu(){
	document.getElementById('mojo').className = 'hide';
	document.getElementById('modellerMenu').className = 'menu-item menu-font left';
	document.getElementById('modellerMenuLine').className = 'hide';
	document.getElementById('modellerSubMenu').className = 'hide';
}

// TRANSITION

var timeOut = 0;

function changeOpacity() {
	timeOut = setTimeout ('fadeInAd();', 5000);
	
	if (timeOut == 5000) {
		clearTimeout ( timeOutTwo );
	}
}

var timeOutTwo = 0;

function changeOpacityTwo() {
	timeOutTwo = setTimeout ('fadeInAdTwo();', 5000);
	
	if (timeOutTwo == 5000) {
		clearTimeout ( timeOut );
	}
}

function fadeInAd() {
	document.getElementById('adTwo').className = 'second-row-slc display';
	document.getElementById('adOne').className = 'second-row-slc hide';
	twTwo = new OpacityTween(document.getElementById('adTwo'),Tween.regularEaseOut, 0, 100, 0.5);
	
	twTwo.start();
	changeOpacityTwo();
}

function fadeInAdTwo() {
	document.getElementById('adOne').className = 'second-row-slc display';
	document.getElementById('adTwo').className = 'second-row-slc hide';
	twTwo = new OpacityTween(document.getElementById('adOne'),Tween.regularEaseOut, 0, 100, 0.5);
	
	twTwo.start();
	changeOpacity();
}

// ROLLOVER SCRIPT

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// DETAILS

function showDetail(id) {
	document.getElementById(id).className = 'display';
	document.getElementById(id).style.zIndex = 10000;
}

// NEWS

function openNews(id) {
	
	clearTimeout(timeOut3);
	var count = $('div[id*="news"]').size();
	
	$('div[id*="news"]').addClass("hide");
	$('#news-' + id).removeClass("hide");
	$("#news-"+id).css("opacity","0");
	$("#news-"+id).animate({
		opacity: 1
		},500
	);
	
	if(id == count) var openId = 1;
	else var openId = id + 1;
	
	timeOut3 = setTimeout ('openNews('+openId+');', 5000);
	
	if (timeOut == 5000) {
		clearTimeout ( timeOut3 );
	}
}

function arrowRed(name){
    $('div[name*='+name+']').css("color","#CC0000");
}
function arrowBlack(name){
    $('div[name*='+name+']').css("color","#333333");
}
function arrowBrown(name){
    $('div[name*='+name+']').css("color","#A57A39");
}

var timeOut3 = 0;

function changeNews () {
	timeOut3 = setTimeout ('openNews(2);', 5000);
	
	if (timeOut3 == 5000) {
		clearTimeout ( timeOut3 );
	}
}
