function barUp(){
    createCookie('statusBarStatus', '1', '1');
    new Effect.Move('barContent', {
        x: 0,
        y: -45,
        duration: '0.3'
    });
}

function barDown(){
    createCookie('statusBarStatus', '0', '1');
    new Effect.Move('barContent', {
        x: 0,
        y: 45,
        duration: '0.3'
    });
}

statusBarValue = readCookie('statusBarStatus');

if (statusBarValue == '0') {
    new Effect.Move('barContent', {
        x: 0,
        y: 45,
        duration: '0'
    });
}

function fadetoOne(time){
    new Effect.Morph('bodyid', {
        style: 'background-color: #7A6766;',
        duration: time
    });
    new Effect.Morph('wrapper', {
        style: 'border-color: #dcd2d3;',
        duration: time
    });
    createCookie('theme', '1', '1');
}

function fadetoTwo(time){
    new Effect.Morph('bodyid', {
        style: 'background-color: #6B0E40;',
        duration: time
    });
    new Effect.Morph('wrapper', {
        style: 'border-color: #cb89a5;',
        duration: time
    });
    createCookie('theme', '2', '1');
}

function fadetoThree(time){
    new Effect.Morph('bodyid', {
        style: 'background-color: #38495E;',
        duration: time
    });
    new Effect.Morph('wrapper', {
        style: 'border-color: #778a99;',
        duration: time
    });
    createCookie('theme', '3', '1');
}

valueTheme = readCookie('theme');
valueLoggedIn = readCookie('justloggedin');

if (valueLoggedIn == '1') {
    if (valueTheme == '1') {
        fadetoOne(1);
    }
    else 
        if (valueTheme == '2') {
            fadetoTwo(1);
        }
        else 
            if (valueTheme == '3') {
                fadetoThree(1);
            }
    createCookie('justloggedin', '0', '0');
}
else {
    if (valueTheme == '1') {
        fadetoOne(0);
    }
    else 
        if (valueTheme == '2') {
            fadetoTwo(0);
        }
        else 
            if (valueTheme == '3') {
                fadetoThree(0);
            }
}

function updateShopBagDB() {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}else{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
    if (req) {
        req.onreadystatechange = function(){
            if (req.readyState == 4 && (req.status == 200 || req.status == 304)) {
				//document.getElementById('headerShopBag').innerHTML = req.responseText;
            }
        };
        req.open('GET', '/inc/headerShopBag.php');
        req.send(null);
    }	
}
function updateTimeOutMSG() {
	/*if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}else{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
    if (req) {
        req.onreadystatechange = function(){
            if (req.readyState == 4 && (req.status == 200 || req.status == 304)) {
				document.getElementById('headerTimeOutMsgWrapper').innerHTML = req.responseText;
            }
        };
        req.open('GET', '/inc/headerTimeOut.php');
        req.send(null);
    }*/
}

function tafLoadPage(loadpage) {
	
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}else{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
    
    if (req) {
        req.onreadystatechange = function(){
            if (req.readyState == 4 && (req.status == 200 || req.status == 304)) {
				document.getElementById('taf_tabContent').innerHTML = req.responseText;
            }
        };
        req.open('GET', '/site/cmd/' + loadpage + '.php');
        req.send(null);
    }
}

function updateActiveSaleUsersMSG(saleID) {
	if (window.XMLHttpRequest) {
		req = new XMLHttpRequest();
	}else{
		req = new ActiveXObject("Microsoft.XMLHTTP");
	}
	
    if (req) {
        req.onreadystatechange = function(){
            if (req.readyState == 4 && (req.status == 200 || req.status == 304)) {
				//document.getElementById('activeSaleUsersWrapper').innerHTML = req.responseText;
            }
        };
        req.open('GET', '/crons/activeSaleUsers/' + saleID + '.php');
        req.send(null);
        flirintval = setInterval("updateCounterText()",700);
    }
}

function updateCounterText() {
	FLIR.init( { path: '/js/facelift/' } );
	FLIR.auto( [ 'span.dotmatrix' ] );
	clearInterval(flirintval);
}

updateTimeOutMSG();

setInterval("updateTimeOutMSG()", 10000);

setInterval("updateShopBagDB()", 60000);
