var myWidth;
var myHeight;
var currentTime = new Date();
var year = currentTime.getFullYear();
var j = 0;
var height = 280;
var interval;
var k=0;

/* Links */
function LostPassword() {
  var F1 = window.open("https://secure.six-securities-services.com/registration/LostPassword","LostPassword","width=800,height=600,scrollbars=1,status=1,resizable=1");
}
function Registration() {
  var F2 = window.open("https://secure.six-securities-services.com/registration/Registration","Registration","width=800,height=600,scrollbars=1,status=1,resizable=1");
}
function allSisParticipants() {
  var F3 = window.open("https://secure.six-securities-services.com/registration/AllSisParticipants","allSisParticipants","width=800,height=600,scrollbars=1,status=1,resizable=1");
}
function Logout() {
  var F4 = window.open("https://secure.six-securities-services.com/usafelogin/Logout","Logout","width=420,height=600,scrollbars=1,status=1,resizable=1");
}
function ChangePassword() {
  var F5 = window.open("https://secure.six-securities-services.com/userprofile/ChangePassword","ChangePassword","width=800,height=600,scrollbars=1,status=1,resizable=1");
}
function SisParticipants() {
  var F6 = window.open("https://secure.six-securities-services.com/userprofile/SisParticipants","SisParticipants","width=800,height=600,scrollbars=1,status=1,resizable=1");
}
function PartnerParticpants() {
  var F7 = window.open("https://secure.six-securities-services.com/userprofile/PartnerCustodians","PartnerParticipants","width=800,height=600,scrollbars=1,status=1,resizable=1");
}
function prepareProfile() {
  var F8 = window.open("https://secure.six-securities-services.com/userprofile/ModifyRegistration","prepareProfile","width=800,height=600,scrollbars=1,status=1,resizable=1");
}
/* Links */

function login() {
	if (j == 0) {
		moveToDown();
	}
	if (j == height) {
		moveToUp();
	}
}

function moveToUp() {
	interval = setInterval("lessHeight();", 1);
}

function moveToDown() {
	interval = setInterval("addHeight();", 1);
}

function lessHeight() {
	j=j-4;
	document.getElementById("loginbox").style.height=j+'px';
	if (j == 0) {
		clearInterval(interval);
	}
}

function addHeight() {
	j=j+4;
	document.getElementById("loginbox").style.height=j+'px';
	if (j == height) {
		clearInterval(interval);
	}
}

function winres() {
	if( typeof(window.innerWidth) == 'number' ) { 
		//No-IE 
		myWidth = window.innerWidth;
		myHeight = window.innerHeight; 
	}
	else if(document.documentElement && (document.documentElement.clientWidth || document.documentElement.clientHeight)) {
		//IE 6+ in 'standards compliant mode' 
		myWidth = document.documentElement.clientWidth; 
		myHeight = document.documentElement.clientHeight; 
	}
	else if(document.body && (document.body.clientWidth || document.body.clientHeight)) {
		//IE 4 compatible 
		myWidth = document.body.clientWidth; 
		myHeight = document.body.clientHeight; 
	} 
	if(myHeight < 400) {
		myHeight = 400;
	}
	if(typeof(window.innerWidth) == 'number') { 
		document.getElementById("rechteck").style.height=myHeight-312+'px';
	}
	else {
		document.getElementById("rechteck").style.height=myHeight-308+'px';
	}
}

function news(cat,num) {
	if (typeof(cat) != "undefined" && cat != "" && typeof(num) != "undefined") {
		if (num==0) {
			if (des.indexOf(cat)>-1) {
				newsContent[ncIndex] = '<li><a href="'+nl+'">'+nt+'</a> <span class="news-small">('+nd+')</span></li>';
				ncIndex++;
			}
		}
		else {
			num = num-1;
			if (des.indexOf(cat)>-1 && k<=num) {
				newsContent[ncIndex] = '<li><a href="'+nl+'">'+nt+'</a> <span class="news-small">('+nd+')</span></li>';
				ncIndex++;
				k++;
			}
		}
	}
	else if(typeof(cat) != "undefined" && cat != "") {
		if (des.indexOf(cat)>-1 && k<=2) {
			newsContent[ncIndex] = '<li><a href="'+nl+'">'+nt+'</a> <span class="news-small">('+nd+')</span></li>';
			ncIndex++;
			k++;
		}
	}
	else if(typeof(num) != "undefined") {
		if (num==0) {
			newsContent[ncIndex] = '<li><a href="'+nl+'">'+nt+'</a> <span class="news-small">('+nd+')</span></li>';
			ncIndex++;
		}
		else {
			num = num-1;
			if (k<=num) {
				newsContent[ncIndex] = '<li><a href="'+nl+'">'+nt+'</a> <span class="news-small">('+nd+')</span></li>';
				ncIndex++;
				k++;
			}
		}
	}
	else {
		if (k<=5) {
			newsContent[ncIndex] = '<li><a href="'+nl+'">'+nt+'</a> <span class="news-small">('+nd+')</span></li>';
			ncIndex++;
			k++;
		}
	}
}

function newsOutput(newsContent) {
	if (newsContent.length == 0) {
		document.getElementById('newsTeaser').style.display = 'none';
	}
	else {
		for(var i=0; i<newsContent.length; i++) {
			document.write(newsContent[i]);
		}
	}
}
