
function loadInfobox(strInfoTxt)
{
	self.scrollTo(0,0);
	
	var arrayPageSize	= getPageSize();
	
	var objShopMask	= document.createElement("div");
	objShopMask.setAttribute('id', 'dktinyshop_shop_mask');
	objShopMask.style.width = arrayPageSize[0] + 'px';
	objShopMask.style.height = arrayPageSize[1] + 'px';
	
	var objShopLayer	= document.createElement("div");
	objShopLayer.setAttribute('id', 'dktinyshop_shop_layer');
	
	var objShopWrap	= document.createElement("div");
	objShopWrap.setAttribute('id', 'dktinyshop_shop_wrap');
	
	var strHtml = '' + strInfoTxt;
	
	objShopWrap.innerHTML = strHtml;
	
	objShopLayer.appendChild(objShopWrap);
	
	document.body.appendChild(objShopMask);
	document.body.appendChild(objShopLayer);
}

function hideInfoBox()
{
	if(document.getElementById('dktinyshop_shop_layer'))
		document.body.removeChild(document.getElementById('dktinyshop_shop_layer'));
		
	if(document.getElementById('dktinyshop_shop_mask'))
		document.body.removeChild(document.getElementById('dktinyshop_shop_mask'));
}

function getPageSize() 
{
	var xScroll, yScroll;
		
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = window.innerWidth + window.scrollMaxX;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){ // all but Explorer Mac
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else { // Explorer Mac...would also work in Explorer 6 Strict, Mozilla and Safari
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
		
	var windowWidth, windowHeight;
		
	if (self.innerHeight) {	// all except Explorer
		if(document.documentElement.clientWidth){
			windowWidth = document.documentElement.clientWidth; 
		} else {
			windowWidth = self.innerWidth;
		}
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { // Explorer 6 Strict Mode
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { // other Explorers
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
		
	// for small pages with total height less then height of the viewport
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}
	
	// for small pages with total width less then width of the viewport
	if(xScroll < windowWidth){	
		pageWidth = xScroll;		
	} else {
		pageWidth = windowWidth;
	}

	return [pageWidth,pageHeight];
}


function dktinyshop_runSwapper()
{
	dktinyshop_swapObj(1);
	self.setTimeout('dktinyshop_runSwapper()', 10000);
}
						
function dktinyshop_swapObj(numDirection)
{
	var dktinyshop_numNextObj = numDirection>0 ? (dktinyshop_numCurObj+1) : (dktinyshop_numCurObj-1);
						
	if(dktinyshop_numNextObj > dktinyshop_numObj)
		dktinyshop_numNextObj = 1;
						 
	if(dktinyshop_numNextObj < 1)
		dktinyshop_numNextObj = dktinyshop_numObj;
	
	dktinyshop_objCur	= document.getElementById(dktinyshop_strDivPrefix + dktinyshop_numCurObj);
	dktinyshop_objNext	= document.getElementById(dktinyshop_strDivPrefix + dktinyshop_numNextObj);
	
	dktinyshop_shiftOpacity(dktinyshop_objCur.id, 500);
	
	dktinyshop_objCur.style.display = 'none';
	dktinyshop_objNext.style.display = 'block'; 
	
	dktinyshop_changeOpac(0, dktinyshop_objNext.id);
	dktinyshop_shiftOpacity(dktinyshop_objNext.id, 500);
							
	dktinyshop_numCurObj = dktinyshop_numNextObj;
}

function dktinyshop_opacity(id, opacStart, opacEnd, millisec) { 
    //speed for each frame 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 

    //determine the direction for the blending, if start and end are the same nothing happens 
    if(opacStart > opacEnd) { 
        for(i = opacStart; i >= opacEnd; i--) { 
            setTimeout("dktinyshop_changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } else if(opacStart < opacEnd) { 
        for(i = opacStart; i <= opacEnd; i++) 
            { 
            setTimeout("dktinyshop_changeOpac(" + i + ",'" + id + "')",(timer * speed)); 
            timer++; 
        } 
    } 
} 

//change the opacity for different browsers 
function dktinyshop_changeOpac(opacity, id) { 
    var object = document.getElementById(id).style; 
    object.opacity = (opacity / 100); 
    object.MozOpacity = (opacity / 100); 
    object.KhtmlOpacity = (opacity / 100); 
    object.filter = "alpha(opacity=" + opacity + ")"; 
}

function dktinyshop_shiftOpacity(id, millisec) { 
    //if an element is invisible, make it visible, else make it ivisible 
    if(document.getElementById(id).style.opacity == 0) { 
        dktinyshop_opacity(id, 0, 100, millisec); 
    } else { 
        dktinyshop_opacity(id, 100, 0, millisec); 
    }
    
    return true; 
} 

function dktinyshop_blendimage(divid, imageid, imagefile, millisec) { 
    var speed = Math.round(millisec / 100); 
    var timer = 0; 
     
    //set the current image as background 
    document.getElementById(divid).style.width = document.getElementById(imageid).width + 'px';
    document.getElementById(divid).style.height = document.getElementById(imageid).height + 'px';
    document.getElementById(divid).style.backgroundImage = "url(" + document.getElementById(imageid).src + ")"; 
     
    //make image transparent 
    dktinyshop_changeOpac(0, imageid); 
     
    //make new image 
    document.getElementById(imageid).src = imagefile; 

    //fade in image 
    for(i = 0; i <= 100; i++) { 
        setTimeout("dktinyshop_changeOpac(" + i + ",'" + imageid + "')",(timer * speed)); 
        timer++; 
    } 
} 
