﻿//CURRENT SLIDES IN THE SHOW
//7151124 is the property ID number for     2900 Robertson Road (Carrier Distribution)
//1443736 is the property ID number for     One American Center
//6595836 is the property ID number for     Green Acres Shopping Village
//5003603 is the property ID number for     Macy’s Plaza
//1396332 is the property ID number for     Tyler Town Center
//6987717 is the property ID number for     13701 Hwy 31 W  (Goodyear Plant)


var hs4Arr=new Array;

hs4Arr=[

["Images/CarrierDistribution.jpg","http://www.costar.com/costarconnect/MasterPage/Main.aspx?SiteID=23272&CheckSum=833974402&InvestmentProperty=False&propertyid=7151124&IsCostar=Costar",""],
["Images/OneAmerican.jpg","http://www.costar.com/costarconnect/MasterPage/Main.aspx?SiteID=23272&CheckSum=833974402&InvestmentProperty=False&propertyid=1443736&IsCostar=Costar",""],
["Images/GreenAcres.jpg","http://www.costar.com/costarconnect/MasterPage/Main.aspx?SiteID=23272&CheckSum=833974402&InvestmentProperty=False&propertyid=6595836&IsCostar=Costar",""],
["Images/MacysPlaza.jpg","http://www.costar.com/costarconnect/MasterPage/Main.aspx?SiteID=23272&CheckSum=833974402&InvestmentProperty=False&propertyid=5003603&IsCostar=Costar",""],
["Images/TylerTownCenter.jpg","http://www.costar.com/costarconnect/MasterPage/Main.aspx?SiteID=23272&CheckSum=833974402&InvestmentProperty=False&propertyid=1396332&IsCostar=Costar",""],
["Images/Goodyear.jpg","http://www.costar.com/costarconnect/MasterPage/Main.aspx?SiteID=23272&CheckSum=833974402&InvestmentProperty=False&propertyid=6987717&IsCostar=Costar",""] // no comma at the end of last index

]

dir=0 // 0 = up 1 = down
speed=2
var scroll1;
imageSize=0  // % set to zero to use fixedWidth and fixedHeight values
fixedWidth=401 // set a fixed width
fixedHeight=104 // set a fixed height
spacerWidth=5 // space between images

alwaysCenter=1 // center the popup 0 = no 1 = yes
popupLeft=0 // popup default left, use if not centering
popupTop=0 // popup default top, use if not centering

biggest=0
ieBorder=0
totalWidth=0
totalHeight=0
hs4Timer=null

preload=new Array()
for(var i=0;i<hs4Arr.length;i++){
preload[i]=new Image()
preload[i].src=hs4Arr[i][0]
}
function GoUp(){
    dir=0;
    if(speed<0){
        speed=speed*-1
    }
    scrollHS4();
}
function GoDown(){
    dir=1;
    if(speed>0){
        speed=-speed
    }
    scrollHS4();
}
function initHS4(){
    scroll1=document.getElementById("scroller1")

    for(var j=0;j<hs4Arr.length;j++){
        scroll1.innerHTML+='<img id="pic'+j+'" src="'+preload[j].src+'" alt="'+hs4Arr[j][2]+'" title="'+hs4Arr[j][2]+'" onclick="showBigPic('+j+')">' 
        if(imageSize!=0){ // use percentage size
            newWidth=preload[j].width/100*imageSize
            newHeight=preload[j].height/100*imageSize
        }
        else{ // use fixed size
            newWidth=fixedWidth
            newHeight=fixedHeight
        }

        document.getElementById("pic"+j).style.width=newWidth+"px"
        document.getElementById("pic"+j).style.height=newHeight+"px"

        if(document.getElementById("pic"+j).offsetHeight>biggest){
            biggest=document.getElementById("pic"+j).offsetWidth
        }

        document.getElementById("pic"+j).style.marginTop=spacerWidth+"px"

        totalWidth+=document.getElementById("pic"+j).offsetWidth+spacerWidth
        totalHeight+=document.getElementById("pic"+j).offsetHeight+spacerWidth
    }
    totalHeight+=1
    totalWidth+=1

    for(var k=0;k<hs4Arr.length;k++){ // horizontally center images
        document.getElementById("pic"+k).style.marginLeft = (biggest-document.getElementById("pic"+k).offsetWidth)/2+"px"
    }

    scrollBox=document.getElementById("scroll_box")

    if(document.uniqueID && scrollBox.currentStyle && document.compatMode!="CSS1Compat"){
        ieBorder=parseInt(scrollBox.currentStyle.borderWidth)*2
    } 
    if(document.getElementById&&document.all){
        ieBorder=parseInt(scrollBox.style.borderTopWidth)*2
    }

    scrollBox.style.height=totalHeight+"px" 
    scroll1.style.width=biggest+ieBorder+"px"
    scroll2=document.getElementById("scroller2")
    scroll2.innerHTML=scroll1.innerHTML
    scroll2.style.top= scroll1.offsetHeight+"px"
    scroll2.style.left= 0+"px"
    scroll2.style.width=biggest+"px"

    if(dir==1){
        speed= -speed
    }

    scrollHS4()
}


function scrollHS4(){
    if(paused==1){return}
    clearTimeout(hs4Timer)
    scroll1Pos=parseInt(scroll1.style.top)
    scroll2Pos=parseInt(scroll2.style.top)
    scroll1Pos-=speed
    scroll2Pos-=speed
    scroll1.style.top=scroll1Pos+"px"
    scroll2.style.top=scroll2Pos+"px"
    hs4Timer=setTimeout("scrollHS4()",50)
    if(dir==0){
        if(scroll1Pos< -scroll1.offsetHeight){
            scroll1.style.top=scroll1.offsetHeight+"px"
        }
        if(scroll2Pos< -scroll1.offsetHeight){
            scroll2.style.top=scroll1.offsetHeight+"px"
        }
    }

if(dir==1){
if(scroll1Pos>parseInt(scrollBox.style.height)){
scroll1.style.top=scroll2Pos+ (-scroll1.offsetHeight)+"px"
}

if(scroll2Pos>parseInt(scrollBox.style.height)){
scroll2.style.top=scroll1Pos+ (-scroll2.offsetHeight)+"px"
}
}

}

st=null
function pause(){
clearTimeout(hs4Timer)
clearTimeout(st)
}

function reStartHS4(){
clearTimeout(st)
st=setTimeout("scrollHS4()",100)
}

paused=0
picWin=null

function showBigPic(p){
    var s = new String(hs4Arr[p][1]);
    window.open(s);
    //if (s.indexOf('.htm')>0){
    //    document.getElementById('fPlayer').src=hs4Arr[p][1];
    //}
    //else{
    //    document.getElementById('fPlayer').src='ImgContent1.htm?o='+hs4Arr[p][1];
    //}
}

window.onfocus=function(){
paused=0
//scrollHS4()
}

onunload=function(){ // close the popup when leaving page
if(picWin&&picWin.open&&!picWin.closed){
picWin.close()
}
}



