var ns6;var d=document;var ie=d.all;var ns=d.layers;if(ie&&ns){ns6=ie};top.vie=false;
var ww = wwh = 600;var wh = 400; if(ie){wwh = screen.availWidth;wh = screen.availHeight;} else {wwh = parent.outerWidth; wh = parent.outerHeight;}

// Cookies
function setCook(Nazwa, wartosc) {
var dzisiaj = new Date()
var wygasnie = new Date()
wygasnie.setTime(dzisiaj.getTime() + 96422400000)
document.cookie = Nazwa + "=" + escape(wartosc) + ((wygasnie == null) ? "" : ("; expires=" + wygasnie.toGMTString()))}

function getCook(name) {
var szukaj = name + "=";
if (document.cookie.length > 0) {
	offset = document.cookie.indexOf(szukaj)
	if (offset != -1) {
		offset += szukaj.length
		koniec = document.cookie.indexOf(";", offset)
		if (koniec == -1) koniec = document.cookie.length; return unescape(document.cookie.substring(offset, koniec))}} else return 0;}

function txt(tekst) {window.status = tekst; return true;}

function usecss() {
	if (ie) {return('<link rel="STYLESHEET" type="text/css" href="/styl-ie.css">');}
	else {return('<link rel="STYLESHEET" type="text/css" href="/styl-ntsc.css">');}}

function wineat() {if (!parent) {top.document.location.href="/"}}

function wo(url,w,h){
if (self.pageWindow){
	if (ie) {self.pageWindow.close();}
	else if (self.pageWindow.top) {self.pageWindow.close();}}
self.pageWindow = window.open(url,'Page','resizable=yes,scrollbars=no,width=' + w + ',height=' + h + ',top=' + (wh-h)/2 + ',left=' + (wwh-w)/2 + '');
if (self.pageWindow) {self.pageWindow.focus();}}

var whitespace = " \t\n\r";
function isEmpty(s){
return ((s == null) || (s.length == 0))}
function isWhitespace (s){
	var i;
    if (isEmpty(s)) return true;
    for (i = 0; i < s.length; i++){   
        var c = s.charAt(i);
        if (whitespace.indexOf(c) == -1) return false;
    }
    // All characters are whitespace.
    return true;
}
function isEmail(s){   	
	if (isEmpty(s)) {return false;}
    if (isWhitespace(s)) return false;
    var i = 1;
    var sLength = s.length;
    while ((i < sLength) && (s.charAt(i) != "@"))
    { i++ }

    if ((i >= sLength) || (s.charAt(i) != "@")) return false;
    else i += 2;

    while ((i < sLength) && (s.charAt(i) != "."))
    { i++ }

    if ((i >= sLength - 1) || (s.charAt(i) != ".")) return false;
    else return true;
}
function sprawdzlog()
	{
	if (!document.login.mail.value) {error(1);}
	else if (!document.login.pass.value) {error(2);}
	else {rejestruj("SessionID", document.login.mail.value); document.login.submit();}
	}
function error(nr)
	{
	if (nr == 1) {alert("Ange giltig e-mail adress!");}
	if (nr == 2) {alert("Ange ditt lösenord!");}
	if (nr == 3) {alert("Dina uppgifter är inte rätt eller ditt användarkonto är avstängt! Försök igen eller kontakta StockLetters kundtjänst.");}
	}
//Cookies
function Set_Cookie( name, value, expires, path, domain, secure ) 
{
var today = new Date();
today.setTime( today.getTime() );

if ( expires )
{
expires = expires * 1000 * 60 * 60 * 24;
}
var expires_date = new Date( today.getTime() + (expires) );

document.cookie = name + "=" +escape( value ) +
( ( expires ) ? ";expires=" + expires_date.toGMTString() : "" ) + 
( ( path ) ? ";path=" + path : "" ) + 
( ( domain ) ? ";domain=" + domain : "" ) +
( ( secure ) ? ";secure" : "" );
}

function setCook(name, value) 
	{
	Delete_Cookie(name, "/");
	Set_Cookie( name, value, null, "/");
	//document.cookie = name + "=" + escape(value);
	}
function getCook(name)
	{var szukaj = name + "=";
	if (document.cookie.length > 0) {
		offset = document.cookie.indexOf(szukaj)
		if (offset != -1)
			{
			offset += szukaj.length
			koniec = document.cookie.indexOf(";", offset)
			if (koniec == -1)
			koniec = document.cookie.length
			return unescape(document.cookie.substring(offset, koniec))}}
		else {return 0;}}
function rejestruj(Nazwa, wartosc) {
        var dzisiaj = new Date()
        var wygasnie = new Date()
        wygasnie.setTime(dzisiaj.getTime() + 1000*60*60*24*31)
        ustawCookie(Nazwa, wartosc, wygasnie)}
function ustawCookie(nazwa, wartosc, wygasnie) {
        document.cookie = nazwa + "=" + escape(wartosc)
        + ((wygasnie == null) ? "" : ("; expires=" + wygasnie.toGMTString()))}
function Delete_Cookie( name, path, domain ) {
if (getCook(name)) document.cookie = name + "=" +
( ( path ) ? ";path=" + path : "") +
( ( domain ) ? ";domain=" + domain : "" ) +
";expires=Thu, 01-Jan-1970 00:00:01 GMT";}
if (document.login && document.login.mail) 
	{
	var SID = getCook("SessionID");
	if (SID) {document.login.mail.value = SID;}
	}
function showCirAct(LINK_ID) {
	if (getCook("LINK_ID") == LINK_ID) {res="_on";}
	else {res="";}
	document.write("<img src='/images/circle"+ res +".gif' width=17 height=19>");
}
function setgrpID(grpID) {
	setCook("GRP_ID", grpID);
} 
function setLinkID(lnkID) {
	setCook("LINK_ID", lnkID);
} 
//window.status = document.cookie;