var igMoreLabW = 67; /* morenav width */
var igItemsBoxW; 
var gcMinTextH = 150;
var gcMaxTextH = 355;
var iActAsset;
var g_pfx;
    

var g_arAWs = new Array();
var g_arDists = new Array();
var asset_padding_space = 7+1;
var UpLimit;
var icurPos1, icurPos2
var startIndex = 1;

/* large view variables */
var bHeader = 65;
var bBody = 500;
var vwL_Step = 10; /* end*/

/* frontpage */
//Detecting iPhone,iPod or iPad------------------------------------------------------------------------------------------------->VV->START

if((navigator.userAgent.match(/iPhone/i)) || (navigator.userAgent.match(/iPod/i)) || (navigator.userAgent.match(/iPad/i))) {
 var apple = 1;

  }else{
   var apple = 0;
  }


//----------------------------------------------------------------------------------------------------------------------------> END
function init_FP(){
    
    //**  if text box exists, set height of the text box according to the size of the fp image - 75%
    if (GE('txtwrap')){
        var iH, iH2, oFPImg, a;
            
        iH = GE('txtwrap').offsetHeight;
        iH2 = GE('fptxt').offsetHeight;
       
        if (iH2 < iH) 
            GE('fptxt').style.bottom = '0px';
        else {
            YAHOO.util.Dom.setStyle( GE('fptxt'),'height', iH + 'px');
            initScrollbars();
        }
        
        GE('fptxt').style.visibility = 'visible';
        
    }
   
   var objILoading = document.createElement("div");
    objILoading.setAttribute('id','imgLoadingIN');
    GE('SiteLinks').appendChild(objILoading);
    myRemoveNode(objILoading);
}

/* portfolio */
function init_PF(){
    
    //** collect widths of gallery names
    g_pfx = 'g';
    igItemsBoxW = GE('dvGList').offsetWidth - igMoreLabW;
    oBox = GE('GTxtBo');
    oCont = GE('GTxtCo');
    if (oBox && oCont)
        if (oBox.offsetHeight<oCont.offsetHeight){
            YAHOO.util.Dom.setStyle(oCont, 'height', oBox.offsetHeight + 'px');
            initScrollbars();
               
           empty = true;
           flDoExec = false;
           if (entrMarker) iMarker = entrMarker;
        }  
    
    
    getAWidths();
    LoadTexts();
}



function getAWidths(){
    var bHasNext = false;
    var tmpS = 0;
    
    g_arAWs[0] = 0;
    g_arDists[0]=0;
    tmpS = g_arAWs[0];
    var ind = startIndex;
    
    while (GE(g_pfx+ind)){
        g_arAWs[ind] = GE(g_pfx+ind).offsetWidth + asset_padding_space;
        tmpS += g_arAWs[ind];
        g_arDists[ind] = tmpS;
        ind++;
    }
    
    var a=UpLimit=g_arAWs.length-1;
    var sUpLimit = 0;   
    while ( a>=0 ){

        if (sUpLimit+g_arAWs[a] > igItemsBoxW) {
            UpLimit = a+1;
            break;    
        }   
        sUpLimit += g_arAWs[a];
        a--;
    }  

    GE('itm_holder').style.width = tmpS +'px';
    if (tmpS > igItemsBoxW) {
         GE('a_next').className = 'menu_arr_next_act';   //GE('a_next').style.visibility = "visible"; 

        cropItemsBoxByWidth(1);
        GE('btnMore').style.display = 'block';
        GE('a_next').className = 'menu_arr_next_act';   //GE('a_next').style.visibility = "visible";
    }else 
        cropItemsBoxByWidth(1);

}

function cropItemsBoxByWidth(startInd){
    
    for (a=startInd; a<g_arDists.length; a++){
        
        if ((g_arDists[a]-g_arDists[startInd-1]) > igItemsBoxW ){
            icurPos1 = startInd;
            icurPos2 = a-1;
            break;
        }
    }
    GE('dvListWrap').style.width = (g_arDists[a-1]-g_arDists[startInd-1]) + 'px';
}
 
var iCurPos = 0;
var iCurIndex = 0; iNextStartIndex=0;
var iPass=0;
function MoveLine(dir){
    iCurPos = shiftA(dir);   
    document.getElementById('itm_holder').style.left = -g_arDists[iCurPos-1] + 'px';
    cropItemsBoxByWidth(iCurPos);
}

function shiftA(dir){
    
    var res = 0
    //dir>0 -> back; dir<0 -> next
    
    if (dir>0) {
        limit = 1;
        z = g_arDists[icurPos1-1]-igItemsBoxW;
        if (z<0) start = limit;
        else {
            for (a=icurPos1-1; a>0; a--){
                if (z>g_arDists[a]){
                    break;
                }
            }start = a+1;
        }
           
    } else {    
        limit = UpLimit; 
        start = icurPos2+1; 
        if (start>limit) start = limit;
    }
    
    res = start;

    if (start==limit && dir>0) 
        GE('a_prev').className = 'menu_arr_prev';   //.style.visibility = "hidden"; 
    else 
        GE('a_prev').className = 'menu_arr_prev_act';   //style.visibility = "visible"; //('Hide! back');   

    if (start==limit && dir<0) 
        GE('a_next').className = 'menu_arr_next';   //style.visibility = "hidden"; 
    else 
        GE('a_next').className = 'menu_arr_next_act';   //style.visibility = "visible"; //('Hide! Next');
    
    return res;
}

function  setMenuLineWidth(){
   var tmp = getObjectsByClassName('menuline');
   if (tmp.length>0){
        tmp = tmp[0];
        var sum = 0;
        var iBoxW = GE('h_ML').offsetWidth;
        var arDV = tmp.getElementsByTagName('div');
        for (o=0; o<arDV.length; o++)
            if (arDV[o]) sum += arDV[o].offsetWidth; 
        sum += 40 // margin right;
        if (iBoxW < sum) {
            tmp = getObjectsByClassName('logo_holder');
            if (tmp.length>0){
                tmp = tmp[0];
                tmp.style.width = (tmp.offsetWidth-(sum-iBoxW)) + 'px';
            }
            
            GE('h_ML').style.width=sum+'px';
       }
   }
}
 
 
var gBNa = "Container";
var arBoxL = Array('G', 'I');

function ShowImagePage(url, tgId, iind){
    
    var tgt1 = YAHOO.util.Dom.get('IContainer'); //1- IContainer
    var tgt2 = YAHOO.util.Dom.get('GContainer');

    var num = iind-1;
    if (tgt1.innerHTML.length > 0){
         YAHOO.util.Dom.setStyle( tgt1,'display', 'block');

        //** scroll to image clicked **/
       YAHOO.widget.slideshow.ScrollToImageSlide(num);
        
        YAHOO.util.Dom.setStyle( GE('Iinfoline'), 'display', 'block');
        YAHOO.util.Dom.setStyle( GE('Ginfoline'), 'display', 'none');

        YAHOO.util.Dom.setStyle( tgt2 ,'display', 'none');
        
   }else {
        makePOSTRequest(url, tgId );
        YAHOO.widget.slideshow.currentSlide = num;
   }
  
      entrMarker = iMarker;
}
var entrMarker;
function ShowGalleryPage(url){
    if (GE('GContainer')){
        YAHOO.util.Dom.setStyle( GE('GContainer'),'display', 'block');
        YAHOO.util.Dom.setStyle( GE('Ginfoline'), 'display', 'block');
        YAHOO.util.Dom.setStyle( GE('IContainer') ,'display', 'none');
        YAHOO.util.Dom.setStyle( GE('Iinfoline'), 'display', 'none');

         HideLoadingIN('imgLoadingIN', 'thumbHolder');
        
        YAHOO.util.Dom.replaceClass(GE('portfolioLnk'), 'topnav', 'topnav_act');
       
         iMarker = entrMarker;
   }else
        GoG(url);
}

function GoL(){
    GoG(this.href)
}

function makePOSTRequest(url, tgId) {
        ShowLoadingIN('dvGImgThumbs', 'thumbHolder');     
       
       var callback = DefCallback(tgId);
       var conn = YAHOO.util.Connect.asyncRequest("POST", url, callback, 'z=1');
}
function DefCallback(target){
    
    var callback = {
            success : function(o) {
                var rst = o.responseText;
                var otemp = document.createElement("div");
                otemp.innerHTML = rst;
               
    		    ar1 = otemp.getElementsByTagName('div');
    		    for (a=0; a<ar1.length; a++){
    	            var dvId = ar1[a].getAttribute('id');
    	            if (dvId=='IContainer' || dvId=='Iinfoline' || dvId=='LgIContainer')
    	                GE(dvId).innerHTML = ar1[a].innerHTML;
    	            else if (dvId=='i_rsv_child'){
    	                    var ch = ar1[a], tg = GE('img_reserve');
    	                    if (tg) tg.appendChild(ch)    
                        }
        	    }
                
                YAHOO.util.Dom.setStyle( GE('IContainer'),'display', 'block');

                YAHOO.util.Dom.setStyle( GE('GContainer'),'display', 'none' );
                YAHOO.util.Dom.setStyle( GE('Iinfoline'), 'display', 'block');
                YAHOO.util.Dom.setStyle( GE('Ginfoline'), 'display', 'none' );
                
                
                YAHOO.util.Dom.replaceClass(GE('portfolioLnk'), 'topnav_act', 'topnav');
                
                checkGNameWidth();
                
                init_IP();
            },
            failure : function(o) {
            }
        }
    return callback;
}
function makePOSTRequestA(url, tgId, aid, objA) {
       ShowLoading(tgId);
       if (url.indexOf('http://')== 0) {
        if (objA){
                url = url.replace('&ajx=1','');
                //win_target = objA.target;
                win_target = objA.attributes['target'].value
                if (win_target.length>0) // open in new window
                    window.open (url);
                else // open in parent window
                     document.location.href = url;
            }
        }
       else {
           GE(g_pfx+iActAsset).className = 'nav';
           GE(g_pfx+aid).className = 'navSel';
           iActAsset = aid;
           var callback = DefCallbackA(tgId);
           var conn = YAHOO.util.Connect.asyncRequest("POST", url, callback, 'z=1');
       }
}
function DefCallbackA(target){
    var callback = {
            success : function(o) {
                var rst = o.responseText;
                GE(target).innerHTML = rst;
            },
            failure : function(o) {
            }
        }
    return callback;
}

function  checkGNameWidth(){
    var oG = GE('gname');
    var iGNameLimit = GS('ginfo','width')-GS('space1', 'width')-GS('space1', 'border-right-width')-GS('space1', 'margin-right')-GS('iimgname', 'width');
    if (oG) if (oG.offsetWidth > iGNameLimit) YAHOO.util.Dom.setStyle(oG, 'width', iGNameLimit+'px');
}

var empty = true;
var flDoExec = false;
function setDescField(sBox, sCont){
    var oBox, oCont;
    oBox = GE(sBox);
    oCont = GE(sCont);
    if (oBox && oCont)
        if (oBox.offsetHeight>oCont.offsetHeight){
            oCont.style.bottom = '0px';
            YAHOO.util.Dom.removeClass(oCont, 'scrollable');
         }
        else {
            YAHOO.util.Dom.setStyle(oCont, 'bottom', 'auto');
            YAHOO.util.Dom.setStyle(oCont, 'height', oBox.offsetHeight + 'px');
            flDoExec = true;
        }
        
    if (flDoExec && empty){
           initScrollbars();
           
           empty = true;
           flDoExec = false;
           if (entrMarker) iMarker = entrMarker;
   }
    
   if(oCont) oCont.style.visibility = 'visible';
}


/**** Image page  ****/
function init_IP(){

    YAHOO.widget.slideshow.init();
    YAHOO.util.Event.addListener('prevSlide', 'click', YAHOO.widget.slideshow.moveLeftRight, {dir:-1}, true);
    YAHOO.util.Event.addListener('StartStopSlide', 'click', YAHOO.widget.slideshow.StartStopSlide, YAHOO.widget.slideshow, true);
    YAHOO.util.Event.addListener('nextSlide', 'click', YAHOO.widget.slideshow.moveLeftRight,{dir:1}, true);
    
    YAHOO.util.Event.addListener('prevSlide', 'mouseover', replaceClass, {ide: 'prevSlide', add:'ps_mo', remove:'ps', label:'Previous'}, true);
    YAHOO.util.Event.addListener('prevSlide', 'mouseout',  replaceClass, {ide: 'prevSlide', add:'ps', remove:'ps_mo', label:''}, true);
    YAHOO.util.Event.addListener('nextSlide', 'mouseover', replaceClass,{ide: 'nextSlide', add:'ns_mo', remove:'ns', label:'Next'}, true);
    YAHOO.util.Event.addListener('nextSlide', 'mouseout',  replaceClass,{ide: 'nextSlide', add:'ns', remove:'ns_mo', label:''}, true);
    YAHOO.util.Event.addListener('StartStopSlide', 'mouseover', replaceClass, {ide: 'StartStopSlide', add:'StartStopSlide2_mo', remove:'StartStopSlide2', label:'Slideshow'}, true);
    YAHOO.util.Event.addListener('StartStopSlide', 'mouseout', replaceClass, {ide: 'StartStopSlide', add:'StartStopSlide2', remove:'StartStopSlide2_mo', label:''}, true);
 
    YAHOO.util.Event.addListener('shThumbs', 'mouseover', replaceClass, {ide: 'shThumbs', add:'shThumbs_mo', remove:'shThumbs', label:'Thumbnails'},   true);
    YAHOO.util.Event.addListener('shThumbs', 'mouseout',  replaceClass, {ide: 'shThumbs', add:'shThumbs',    remove:'shThumbs_mo', label:''},true);

 //**   YAHOO.util.Event.addListener('iEnlarge', 'mouseover', replaceClass, {ide: 'iEnlarge', add:'enlarge_mo',  remove:'enlarge'},    true);
 //**   YAHOO.util.Event.addListener('iEnlarge', 'mouseout',  replaceClass, {ide: 'iEnlarge', add:'enlarge',     remove:'enlarge_mo'}, true);


}
/*************************************** common functions ***************************/
function change(id,clas) {
    GetElement(id).className = clas;
}
function GetElement(id){
    return document.getElementById(id);
}
function GE(id) { return GetElement(id); }

function GS(id,style_property){
    return parseInt(YAHOO.util.Dom.getStyle(id, style_property) );
}
function GoG(link){
    if (link.length > 0 ) document.location.href = link;
}
function GoGLink(link, obj){
    
    if (obj.getAttribute('target') && obj.getAttribute('target')=='_blank'){
        window.open(link);
   }else
        GoG(link)
}
function getObjectsByClassName(className, parent){
    var oParent;
    var arr = new Array();
    if (parent) oParent = GetElement(parent); else oParent=document;
    var elems = oParent.getElementsByTagName("div");
    for(var i = 0; i < elems.length; i++)
    {
        var elem = elems[i];
        var cls = elem.className
        if(cls == className){
            arr[arr.length] = elem;
        }
    }
    return arr;
}
function isDef(var_ble){
    return (typeof var_ble == 'undefined'? false : true);
 }
 
 function MM_openBrWindow(theURL,winName,features) { 
  window.open(theURL,winName,features);
}
function myRemoveNode(obj){
  if (obj)   
      if (obj.removeNode)
                obj.removeNode(true);
       else { 
            var parent = obj.parentNode;
            parent.removeChild(obj);
        } 
}
/*********************  SLIDESHOW  *******************************/

var ua = navigator.userAgent.toLowerCase();
var isOpera = (ua.indexOf('opera') > -1);
var isSafari = (ua.indexOf('safari') > -1);
var isIE = (window.ActiveXObject);

if (isIE) {
    //MSIE HACK
    document.execCommand("BackgroundImageCache", false, true);
}

if (typeof YAHOO != 'undefined'){
    YAHOO.namespace('widget.slideshow');

    //Seconds Timeout
    YAHOO.widget.slideshow.timeOut = 5;
    //Current Slide
    //stef3:YAHOO.widget.slideshow.currentSlide = 0;
    //** indesx of thubnail selected
    if (typeof iActImg == 'undefined') iActImg = 0;
    //stef3: YAHOO.widget.slideshow.selected = iActImg;
    YAHOO.widget.slideshow.currentSlide = iActImg;
    YAHOO.widget.slideshow.currentLarge = iActImg;

    //zindex
    YAHOO.widget.slideshow.currentZindex = 1;
    //Timer Holder
    YAHOO.widget.slideshow.timer = null;
    YAHOO.widget.slideshow.timer2 = null; 
    //StartStop Button Status
    YAHOO.widget.slideshow.isStop = true;
    //Direction Holder
    YAHOO.widget.slideshow.dirT = 1;
    // image fields array - pricing and description
    YAHOO.widget.slideshow.arIInfoFields = ['desc', 'price'];
    //YAHOO.widget.slideshow.arImageFields = ['itxt1', 'itxt2', 'iimgname', 'imgPD'];
//    YAHOO.widget.slideshow.arImageFields = ['itxtwrap', 'iimgname', 'imgPD']; 
    YAHOO.widget.slideshow.arImageFields = ['itxtwrap', 'imgPD']; 
    YAHOO.widget.slideshow.arImageName = ['iimgname'];

    YAHOO.widget.slideshow.slides = new Array();
    YAHOO.widget.slideshow.arImgHe = new Array();
    YAHOO.widget.slideshow.arImgHe_t = [];
    
    YAHOO.widget.slideshow.arImg_STOcounter = new Array();
    YAHOO.widget.slideshow.Images = new Array();
    YAHOO.widget.slideshow.IDsToIndex = new Array();
    // animation Object
    YAHOO.widget.slideshow.animSlide = null;

    //Effect Attrs
    YAHOO.widget.slideshow.effects1 = { opacity: { from: 0, to: 1 } };
    YAHOO.widget.slideshow.effects2 = { opacity: { from: 1, to: 0 } };

    YAHOO.widget.slideshow.effects = YAHOO.widget.slideshow.effects1;

    //*** booleans 
    YAHOO.widget.slideshow.ILoaded = false;
    YAHOO.widget.slideshow.TLoaded = false;
    YAHOO.widget.slideshow.isLargeViewEventSet = false;

    //animation speeds
    var iShowSpeed = 1;
    var iHideSpeed = 2;


     var cached_frames;
    YAHOO.widget.slideshow.init = function(slideID) {
        //YAHOO.widget.slideshow.box = new YAHOO.widget.Overlay("slideshow");
        //YAHOO.widget.slideshow.box.cfg.setProperty("visible", true);
        //YAHOO.widget.slideshow.box.cfg.setProperty("fixedcenter", true);
        
        cached_frames = YAHOO.util.Dom.getElementsByClassName("yui-sldshw-frame", null, YAHOO.util.Dom.get('img_reserve'));
        YAHOO.widget.slideshow.slides = cached_frames;
        
        YAHOO.widget.slideshow.slide_holder = YAHOO.util.Dom.get('slide_holder');

        //*** load 1st the active image
        i = YAHOO.widget.slideshow.currentSlide
        if (!YAHOO.util.Dom.get('slideshow_' + i)) {
          if (YAHOO.widget.slideshow.slides[i]) {
                var dv_ssImg = document.createElement('div');
                dv_ssImg.id = 'slideshow_' + i;
                YAHOO.widget.slideshow.slide_holder.appendChild(dv_ssImg);
                YAHOO.widget.slideshow.arImg_STOcounter[i] = 0;
                YAHOO.widget.slideshow.setDims(i);
            }
        }

        //** YAHOO.widget.slideshow.preloadImages();
    }
    
    YAHOO.widget.slideshow.slide_src = function(i){
       return YAHOO.widget.slideshow.slides[i].getAttribute('src');
    }
    
    YAHOO.widget.slideshow.preloadImages = function() {
 
        //*** preload all other images
        var sL = YAHOO.widget.slideshow.slides.length;
        for (var i1 =0 ; i1 < sL; i1++ ) {
           if (i1!= YAHOO.widget.slideshow.currentSlide)
               if (!YAHOO.util.Dom.get('slideshow_' + i1)) {
                     if (YAHOO.widget.slideshow.slides[i1]) {
                     
                        var dv_ssImg = document.createElement('div');
                        dv_ssImg.id = 'slideshow_' + i1;
                        YAHOO.widget.slideshow.slide_holder.appendChild(dv_ssImg);
                     
                        YAHOO.widget.slideshow.arImg_STOcounter[i1] = 0;
                    
                        YAHOO.widget.slideshow.setDims(i1);
                    }
                }
        }
    }

    YAHOO.widget.slideshow.setDimsT = function(){
        for(z in YAHOO.widget.slideshow.arImgHe_t) {
            if(YAHOO.widget.slideshow.arImgHe_t[z]) YAHOO.widget.slideshow.setDims(parseInt(z))
        }
    }


    var gc_AttemptImgLoadsCount = 20;
    var iLoadCounter=0;
    YAHOO.widget.slideshow.setDims = function(i2){
          
        if(YAHOO.widget.slideshow.arImgHe_t[i2]) {
            clearTimeout(YAHOO.widget.slideshow.arImgHe_t[i2]);
            YAHOO.widget.slideshow.arImgHe_t[i2]=0
         }
    
        var oSta, calc_pos;
        var sISrc = YAHOO.widget.slideshow.slide_src(i2);
        var oDV = GE('slideshow_' + i2);
        
        if (!YAHOO.widget.slideshow.Images[i2]) {
            YAHOO.widget.slideshow.Images[i2] = new Image();
            YAHOO.widget.slideshow.Images[i2].src = sISrc;
        }
        mm = YAHOO.widget.slideshow.Images[i2];
        if (mm.height>0) {
            oDV.className = "ibox";
            
            sISrc = sISrc.replace(/ /g, '%20')
            YAHOO.util.Dom.setStyle(oDV, 'background-image', "url('"+ sISrc + "')");
            //*** new 12.12.08
            YAHOO.util.Dom.setStyle(oDV, 'background-position', 'center center');
            YAHOO.util.Dom.setStyle(oDV, 'background-repeat', 'no-repeat');
             
            YAHOO.util.Dom.setStyle(oDV, 'opacity', 0);
            YAHOO.util.Dom.setStyle(oDV, 'position', 'relative');
            
            YAHOO.util.Event.addListener('slideshow_'+i2, 'click', YAHOO.widget.slideshow.ViewLarge, {ind: i2}, true);
           
           oSta = GE('sta'+ (i2+1));
           if (oSta){
                myRemoveNode(oSta);
                oDV.appendChild(oSta);
               
               calc_pos = (GS('slideshow_'+i2, 'height') - mm.height )/2;
               if (calc_pos<0) calc_pos=0;
               YAHOO.util.Dom.setStyle(oSta, 'bottom', calc_pos+'px');
               calc_pos = (GS('slideshow_'+i2, 'width') - mm.width )/2
               if (calc_pos<0) calc_pos=0;
               YAHOO.util.Dom.setStyle(oSta, 'right', calc_pos+'px');
           }
            
            if(YAHOO.widget.slideshow.currentSlide == i2) {
                YAHOO.widget.slideshow.loadSlide(YAHOO.widget.slideshow.currentSlide);
                YAHOO.widget.slideshow.preloadImages();
            }
            
            //*** show move controls id all images loaded
            if (!(YAHOO.widget.slideshow.arImg_STOcounter[i2]> gc_AttemptImgLoadsCount) ) ShowSSNav();
            
            
       }else {
            YAHOO.widget.slideshow.arImg_STOcounter[i2]++;
            YAHOO.widget.slideshow.arImgHe_t[i2] = setTimeout(YAHOO.widget.slideshow.setDimsT,50);
            if ( YAHOO.widget.slideshow.arImg_STOcounter[i2]> gc_AttemptImgLoadsCount ) ShowSSNav();
         }
    }
    
    function ShowSSNav(){
        //*** show move controls id all images loaded
            iLoadCounter++;
            if (iLoadCounter == YAHOO.widget.slideshow.slides.length) {
                GE('lbLoading').style.display = 'none';
                if (iLoadCounter>1){
                    GE('prevSlide').style.visibility = 'visible';
                    GE('nextSlide').style.visibility = 'visible';
                    GE('StartStopSlide').style.visibility = 'visible';
                }
            }
    }


    YAHOO.widget.slideshow.loadSlide = function(slideID) {

        if (YAHOO.widget.slideshow.slides[slideID]) {
            
           if (YAHOO.widget.slideshow.isStop){
                //if(!arILText[YAHOO.widget.slideshow.currentSlide+1])// not assigned values to the array yet //-- stef, jan/03/2011 
                if(!getBoolean(arILText[YAHOO.widget.slideshow.currentSlide+1]))
                    GetImageInfo(arIL[YAHOO.widget.slideshow.currentSlide+1].mlink, '', YAHOO.widget.slideshow.arImageFields, slideID); 
                else
                    GetImageInfo_Noajx(YAHOO.widget.slideshow.currentSlide+1);
           }   
           else {
                YAHOO.widget.slideshow.TLoaded = true;
                GE(YAHOO.widget.slideshow.arImageName[0]).innerHTML = arIL[YAHOO.widget.slideshow.currentSlide+1].title;
                checkGNameWidth();
                }
            
            var dv_ssImg1 = YAHOO.util.Dom.get('slideshow_' + slideID);
            var dv_slideHolder = YAHOO.widget.slideshow.slide_holder;
            var nextImage = YAHOO.widget.slideshow.slide_src(slideID);
        
            YAHOO.util.Dom.setStyle(dv_ssImg1, 'display', 'block');  

            var mm = new Image;
            mm.src = nextImage;
            YAHOO.widget.slideshow.arImgHe[slideID] = mm.height;
          
            YAHOO.util.Dom.setStyle(dv_ssImg1, 'z-index', YAHOO.widget.slideshow.currentZindex);
           
            YAHOO.widget.slideshow.clearAnim();
            YAHOO.widget.slideshow.animSlide = new YAHOO.util.Anim(dv_ssImg1, YAHOO.widget.slideshow.effects, iShowSpeed, YAHOO.util.Easing.easeOut);
            YAHOO.widget.slideshow.animSlide.onComplete.subscribe(YAHOO.widget.slideshow.GII)
            YAHOO.widget.slideshow.animSlide.animate();
            
            YAHOO.widget.slideshow.currentZindex++;
            
        //**    YAHOO.util.Event.removeListener('iEnlarge', 'click');
        //**    YAHOO.util.Event.addListener('iEnlarge', 'click', YAHOO.widget.slideshow.ViewLarge, {ind: slideID}, true); 
        }

    }

// this piece of code was moved here on 30/12/2010
   var XMLHttpRequestObject;
     if (window.XMLHttpRequest) {
        XMLHttpRequestObject = new XMLHttpRequest();
    }else if (window.ActiveXObject){
        XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
        }
 //-- end of the piece of code 

    function GetImageInfo(dataSource, data, divIDs, slideID)
    { 
        //*** load image title
        GE(YAHOO.widget.slideshow.arImageName[0]).innerHTML = arIL[YAHOO.widget.slideshow.currentSlide+1].title;
        checkGNameWidth();
        
        if (divIDs.length>1) ShowLoading('itxt1'); 
/*       
        var XMLHttpRequestObject;
        if (window.XMLHttpRequest) {
            XMLHttpRequestObject = new XMLHttpRequest();
        }else if (window.ActiveXObject){
            XMLHttpRequestObject = new ActiveXObject("Microsoft.XMLHTTP");
            }
 */ 
        XMLHttpRequestObject.slideID = slideID;
          
          //********* stef 30.12.2010
          // Check to see if there is an AJAX request already in
          // progress that needs to be stopped.
        if(XMLHttpRequestObject) {
            // Abort the AJAX request.
          // XMLHttpRequestObject.abort();
         }
         //*** end stef  
         
                      
        if(XMLHttpRequestObject) {
          //  var obj = document.getElementById(divID);
            try{
                XMLHttpRequestObject.open("POST", dataSource, true);
                XMLHttpRequestObject.setRequestHeader('Content-Type','application/x-www-form-urlencoded');
                XMLHttpRequestObject.onreadystatechange = function()
                    {   if (XMLHttpRequestObject.readyState == 4 && XMLHttpRequestObject.status == 200) {
                               var cnt = XMLHttpRequestObject.responseText;
                               var otemp = document.createElement("div");
		                       //otemp.setAttribute('id','imgLoading2');
		                       otemp.innerHTML = cnt;

    //changed on 5-jan-2011-- if (YAHOO.widget.slideshow.currentSlide == slideID)
   // wlog(YAHOO.widget.slideshow.currentSlide+' == '+XMLHttpRequestObject.slideID+'/'+otemp)
                              if (YAHOO.widget.slideshow.currentSlide == XMLHttpRequestObject.slideID)  
                                   for (i=0; i< divIDs.length; i++){
                                       GetUsefulData(otemp, divIDs[i]);
                                   }
                              //** not needed: checkGNameWidth();
                               
                               YAHOO.widget.slideshow.TLoaded = true; 
                   
                               if (YAHOO.widget.slideshow.checkThreads()) YAHOO.widget.slideshow.HideImage();
                        }
                    }
                XMLHttpRequestObject.send(data);
           }
            catch (e) {
                window.open(dataSource)
           }
        }
        
     }  

     YAHOO.widget.slideshow.clearAnim = function(){
        if(YAHOO.widget.slideshow.animSlide){
            YAHOO.util.AnimMgr.stop(YAHOO.widget.slideshow.animSlide);
            YAHOO.util.AnimMgr.unRegister(YAHOO.widget.slideshow.animSlide);
            clearTimeout(YAHOO.widget.slideshow.timer);
         }
    }
    YAHOO.widget.slideshow.moveLeftRight = function(){
       
        YAHOO.widget.slideshow.dirT = this.dir;
        YAHOO.widget.slideshow.loadNextSlide();
    }

    YAHOO.widget.slideshow.loadNextSlide = function() {
        clearTimeout(YAHOO.widget.slideshow.timer);
        //*** hide previous
        var dv_ssImg = YAHOO.util.Dom.get('slideshow_' + YAHOO.widget.slideshow.currentSlide);
        if (dv_ssImg){
            YAHOO.util.Dom.setStyle(dv_ssImg, 'display', 'none');
        }

        var nextSlideT = (YAHOO.widget.slideshow.currentSlide + YAHOO.widget.slideshow.dirT);
        if (!YAHOO.widget.slideshow.slides[nextSlideT]) {
            var lmt = YAHOO.widget.slideshow.slides.length;
            nextSlideT = (nextSlideT-lmt)*(1-lmt)/(1+lmt);
        }
        YAHOO.widget.slideshow.ILoaded = false;
        YAHOO.widget.slideshow.TLoaded = false;
        YAHOO.widget.slideshow.currentSlide = nextSlideT;
        YAHOO.widget.slideshow.dirT = 1;

        YAHOO.widget.slideshow.loadSlide(nextSlideT);
    }

    YAHOO.widget.slideshow.StartStopSlide = function(){
        
        YAHOO.widget.slideshow.isStop = !YAHOO.widget.slideshow.isStop;
        
        if (YAHOO.widget.slideshow.isStop) { //stop pressed
            clearTimeout(YAHOO.widget.slideshow.timer);
            YAHOO.util.Dom.get('StartStopSlide').className = 'StartStopSlide2';
        //**old    YAHOO.util.Dom.get('StartStopSlide').title = "Play Slideshow"
            //*** set mouseover event
            YAHOO.util.Event.addListener('StartStopSlide', 'mouseover', replaceClass, {ide: 'StartStopSlide', add:'StartStopSlide2_mo', remove:'StartStopSlide2', label:'Slideshow'}, true);
            YAHOO.util.Event.addListener('StartStopSlide', 'mouseout', replaceClass, {ide: 'StartStopSlide', add:'StartStopSlide2', remove:'StartStopSlide2_mo', label:''}, true);


            if(!arILText[YAHOO.widget.slideshow.currentSlide+1])// not assigned values to the array yet //-- stef, jan/03/2011 
                GetImageInfo(arIL[YAHOO.widget.slideshow.currentSlide+1].mlink, '', YAHOO.widget.slideshow.arImageFields, YAHOO.widget.slideshow.currentSlide);  
            else
                GetImageInfo_Noajx(YAHOO.widget.slideshow.currentSlide+1);
                
            YAHOO.util.Dom.setStyle('imgPD', 'visibility', 'visible');

       }else { //start pressed
            YAHOO.widget.slideshow.loadNextSlide();
            
            //*** remove previous mouseover and mouseout events
            YAHOO.util.Event.removeListener('StartStopSlide', 'mouseover');
            YAHOO.util.Event.removeListener('StartStopSlide', 'mouseout');
            YAHOO.util.Dom.get('StartStopSlide').className = 'StartStopSlide1';
        //**old     YAHOO.util.Dom.get('StartStopSlide').title = "Stop Slideshow"
           //*** set mouseover events
            YAHOO.util.Event.addListener('StartStopSlide', 'mouseover', replaceClass, {ide: 'StartStopSlide', add:'StartStopSlide1_mo', remove:'StartStopSlide1', label:'Stop'}, true);
            YAHOO.util.Event.addListener('StartStopSlide', 'mouseout', replaceClass, {ide: 'StartStopSlide', add:'StartStopSlide1', remove:'StartStopSlide1_mo', label:''}, true);


            //** hide text field
            YAHOO.util.Dom.get('itxt1').innerHTML = '';
            YAHOO.util.Dom.get('itxt2').innerHTML = '';
            //** hide PRICING|DESCRIPTION labels
            YAHOO.util.Dom.setStyle('imgPD', 'visibility', 'hidden');
        }
    }
    YAHOO.widget.slideshow.GII = function(){
        YAHOO.widget.slideshow.ILoaded = true;
        if (YAHOO.widget.slideshow.checkThreads()) YAHOO.widget.slideshow.HideImage();
    }


    YAHOO.widget.slideshow.checkThreads = function(){
        return YAHOO.widget.slideshow.ILoaded && YAHOO.widget.slideshow.TLoaded;
    }

    YAHOO.widget.slideshow.HideImage = function(){
        YAHOO.widget.slideshow.timer2 = setTimeout(YAHOO.widget.slideshow.HideImage1, 3000);
       // YAHOO.widget.slideshow.HideImage1();
        
    }
    YAHOO.widget.slideshow.HideImage1 = function(){
            if (!YAHOO.widget.slideshow.isStop) {
                 clearTimeout(YAHOO.widget.slideshow.timer2);
                   //** hide current image
                var div = YAHOO.util.Dom.get('slideshow_'+YAHOO.widget.slideshow.currentSlide)
                
                YAHOO.widget.slideshow.clearAnim();
                YAHOO.widget.slideshow.animSlide = new YAHOO.util.Anim(div, YAHOO.widget.slideshow.effects2, iHideSpeed, YAHOO.util.Easing.easeOut);
                YAHOO.widget.slideshow.animSlide.animate();
                YAHOO.widget.slideshow.animSlide.onComplete.subscribe(YAHOO.widget.slideshow.loadN)
            }
    }
    YAHOO.widget.slideshow.loadN = function(){
        YAHOO.widget.slideshow.timer = setTimeout(YAHOO.widget.slideshow.loadNextSlide, 1);
       
    }

    YAHOO.widget.slideshow.ViewLarge = function(){
        //** id 'viewer' or 'Video' button has been pressed - does not show large image
        if (bIsBtnPressed) return;

        var act = this.ind+1; 
        var bgr = arIL[act].biglink;
        var lg_co = GE('LgIContainer');
        if (lg_co){ 
            var lg_img = GE('LgImg');
            YAHOO.util.Dom.setStyle(lg_img, 'background', "url('"+bgr+"') center center no-repeat");
            YAHOO.util.Event.addListener('LgImg', 'click', YAHOO.widget.slideshow.closeLarge, YAHOO.widget.slideshow, true);
            
            YAHOO.util.Dom.setStyle(GE('header'), 'height', (bHeader-vwL_Step)+'px');
            YAHOO.util.Dom.setStyle(GE('main_content'), 'height', (bBody+vwL_Step)+'px');
            
            
            //** if showing for 1st time - set events on Prev/Next large image - i.e. the events are set once
            if( !YAHOO.widget.slideshow.isLargeViewEventSet){
                YAHOO.util.Event.addListener('prevSlide1', 'click', YAHOO.widget.slideshow.moveLarge, {dir:-1}, true);
                YAHOO.util.Event.addListener('CloseLarge', 'click', YAHOO.widget.slideshow.closeLarge, YAHOO.widget.slideshow, true);
                YAHOO.util.Event.addListener('nextSlide1', 'click', YAHOO.widget.slideshow.moveLarge,{dir:1}, true);
                
                YAHOO.util.Event.addListener('prevSlide1', 'mouseover', replaceClass, {ide: 'prevSlide1', add:'ps_mo', remove:'ps'}, true);
                YAHOO.util.Event.addListener('prevSlide1', 'mouseout',  replaceClass, {ide: 'prevSlide1', add:'ps', remove:'ps_mo'}, true);
                YAHOO.util.Event.addListener('CloseLarge', 'mouseover', replaceClass, {ide: 'CloseLarge', add:'closeL_mo', remove:'closeL'}, true);
                YAHOO.util.Event.addListener('CloseLarge', 'mouseout',  replaceClass, {ide: 'CloseLarge', add:'closeL', remove:'closeL_mo'}, true);
                YAHOO.util.Event.addListener('nextSlide1', 'mouseover', replaceClass, {ide: 'nextSlide1', add:'ns_mo', remove:'ns'}, true);
                YAHOO.util.Event.addListener('nextSlide1', 'mouseout',  replaceClass, {ide: 'nextSlide1', add:'ns', remove:'ns_mo'}, true);
                

                YAHOO.widget.slideshow.isLargeViewEventSet = true;
            }
            
            YAHOO.util.Dom.setStyle(lg_co, 'display', 'block');
            YAHOO.util.Dom.setStyle(GE('IContainer'), 'display', 'none');
            YAHOO.util.Dom.setStyle(GE('Iinfoline'), 'display', 'none');
        
            YAHOO.widget.slideshow.currentLarge = this.ind;
        }
    }

var bIsNavPush = false;    
    YAHOO.widget.slideshow.moveLarge = function(){
        var nextSlideT = YAHOO.widget.slideshow.currentLarge + this.dir;
        if (!YAHOO.widget.slideshow.slides[nextSlideT]) {
            var lmt = YAHOO.widget.slideshow.slides.length;
            nextSlideT = (nextSlideT-lmt)*(1-lmt)/(1+lmt);
        }
        YAHOO.widget.slideshow.currentLarge = nextSlideT;
        
        var bgr = arIL[YAHOO.widget.slideshow.currentLarge+1].biglink;
        var lg_co = GE('LgImg');
        if (lg_co){ 
            YAHOO.util.Dom.setStyle(lg_co, 'background', "url('"+bgr+"') center center no-repeat");
        }
    }

    YAHOO.widget.slideshow.closeLarge = function(){
            YAHOO.util.Dom.setStyle(GE('header'), 'height', bHeader+'px');
            YAHOO.util.Dom.setStyle(GE('main_content'), 'height', bBody+'px');
            
            YAHOO.util.Dom.setStyle(GE('IContainer'), 'display', 'block');
            YAHOO.util.Dom.setStyle(GE('Iinfoline'), 'display', 'block');
            YAHOO.util.Dom.setStyle(GE('LgIContainer'), 'display', 'none');
             
            if(YAHOO.widget.slideshow.currentLarge != YAHOO.widget.slideshow.currentSlide) 
                YAHOO.widget.slideshow.ScrollToImageSlide(YAHOO.widget.slideshow.currentLarge);
   }
   
   YAHOO.widget.slideshow.ScrollToImageSlide = function(num){
    //** scroll to image clicked **/
           var dv_ssImg = YAHOO.util.Dom.get('slideshow_' + YAHOO.widget.slideshow.currentSlide);
           if (dv_ssImg){
                YAHOO.util.Dom.setStyle(dv_ssImg, 'opacity', 0);
                YAHOO.util.Dom.setStyle(dv_ssImg, 'display', 'none');
            }
            
            YAHOO.widget.slideshow.currentSlide = num-1;
           
           YAHOO.widget.slideshow.loadNextSlide();
       /* end of scroll panel */
}

    
    function ShowLoading(target){
            oMI = document.getElementById(target);
            if (oMI){ 
               //* if (oMI.innerHTML.length >0) {
                    oMI.innerHTML = '';
                    var objILoading = document.createElement("div");
		            objILoading.setAttribute('id','imgLoading2');
		            oMI.appendChild(objILoading);
        		    
		            objILoading.innerHTML = "<img src='CommonFiles/spacer.gif' />"
		       //*  }
            }
     } 
     function ShowLoadingIN(target, sTranspClass){
        oMI = document.getElementById(target);
         if (oMI){ 
                //** make semi-transparent the thumbnails grid
               // var z1 = getObjectsByClassName(sTranspClass);
              //  if (z1.length>0){
              //      z1 = z1[0];
                    z1 = GE(sTranspClass)
                    if (z1) YAHOO.util.Dom.addClass(z1, 'LowOpacityClass');
               // }
                //** show loading image
                var objILoading = document.createElement("div");
	            objILoading.setAttribute('id','imgLoadingIN');
	            
	            oMI.appendChild(objILoading);
    		    
	            objILoading.innerHTML = "<img src='CommonFiles/spacer.gif' />"
        }
     }
     function HideLoadingIN(target, sTranspClass){
        myRemoveNode(GE(target));
        //var z1 = getObjectsByClassName(sTranspClass);alert(z1.length)
       // if (z1.length>0){
       //     z1 = z1[0];
            z1 = GE(sTranspClass)
            if(z1) YAHOO.util.Dom.replaceClass(z1, 'LowOpacityClass', 'AutoOpacityClass');
       // }
     }
     
     function GetUsefulData(o, field){
        if (o){
            var arO, i;
            arO = o.getElementsByTagName('div');
            
            if (isDef(entrMarker)) iMarker = entrMarker;             
                         
            for (i=0; i< arO.length; i++){
                if (arO[i].getAttribute('id') == field) {
                
                    if (YAHOO.util.Dom.get(field)){
                         YAHOO.util.Dom.get(field).innerHTML = arO[i].innerHTML;
                         mm = arO[i].innerHTML//.replace(/</g, '&lt;');
                         //wlog(YAHOO.widget.slideshow.currentSlide+'('+arIL[YAHOO.widget.slideshow.currentSlide+1].title+')::'+mm.length)
                         
                         //** added on 4-jan-2011 by stef:: if the arILText array has not values for this index yet - fill them 
                         if(!arILText[YAHOO.widget.slideshow.currentSlide+1]) arILText[YAHOO.widget.slideshow.currentSlide+1]=new Array();
                         switch(field){
                            case YAHOO.widget.slideshow.arImageFields[0]: 
                                if(!arILText[YAHOO.widget.slideshow.currentSlide+1][0]) arILText[YAHOO.widget.slideshow.currentSlide+1][0]=arO[i].innerHTML;
                                break;
                            case YAHOO.widget.slideshow.arImageFields[1]: 
                                if(!arILText[YAHOO.widget.slideshow.currentSlide+1][1]) arILText[YAHOO.widget.slideshow.currentSlide+1][1]=arO[i].innerHTML;
                         }
                         //*** end 4-jan add

                         if ( field == 'itxtwrap' ){
                               if(GE('itxtwrap')){
                                   GE('itxtwrap').style.visibility = 'visible';
                                    var arT = ['itxt1', 'itxt2']
                                    for (a=0; a<arT.length; a++){
                                        switch (arT[a]){
                                            case 'itxt1': empty=false; break;
                                            case 'itxt2': empty=true; 
                                        }
                                        setDescField('itxtwrap', arT[a]);
                                   }

                                   chMode(1); 
                               }
                         }
                         return;
                     }
                }
           }

        }
    }
    
}//** close if(YAHOO)
    function  chMode(ind){
    
        if(GE('itxt'+ind)) 
           GE('itxt'+ind).style.display = "block";
        if(GE('itxt'+2/ind))   
           GE('itxt'+2/ind).style.display = "none";
        
        var z1 = GE('i'+YAHOO.widget.slideshow.arIInfoFields[ind-1]+'box');
        if (z1) z1.className = 'pd_act';
        z1 = GE('i'+YAHOO.widget.slideshow.arIInfoFields[2/ind-1]+'box')
        if (z1) 
            if (z1.className == 'pd_act') z1.className = 'pda';    //'pd_inact';
   }
    
    
 function init_GB(){
    var src, oIBox = GE('aphoto'), oIm;
    
    if (oIBox){
        oIm = oIBox.getElementsByTagName('img')
        if (oIm.length>0){
            oIm = oIm[0]
            src = oIm.src;
            myRemoveNode(oIm);
            //oIm.src="";
            oIBox.style.background = "url(" + src + ") center center no-repeat";
        }
        oIBox.style.visibility = "visible";
    }    
 }
 
 function SetAssetNav(){
    SetAssetLink();
    if (GE('g1')){
     //*** remove 1st asset from the asset links list
        myRemoveNode(GE('g1'));
        myRemoveNode(GE('sep1'));
     //*** inser content of 11st asset in the 'contact' box
        makePOSTRequestSet( _1stAsset+'&ajx=1', 'GTxtCo')
    }
 }
 function SetAssetLink(){
    if (arAst[2]){
        YAHOO.util.Event.addListener('infoLnk_a', 'click', GoLink, {link: arAst[2]}, true);
        GE('infoLnk').style.display='block';
   }else if (arAst[1]){
            YAHOO.util.Event.addListener('infoLnk_a', 'click', GoLink, {link: arAst[1]}, true);
             GE('infoLnk').style.display='block';
          }
         
     //** show asset content if not the 1st
     if (iActAsset!=1) YAHOO.util.Dom.setStyle(GE('dvGImgThumbs'), 'visibility', 'visible');
 }
 
 function makePOSTRequestSet(url, tgId) {
       var callback = DefCallbackSet(tgId);
       var conn = YAHOO.util.Connect.asyncRequest("POST", url, callback, 'z=1');
}
function DefCallbackSet(target){
    var callback = {
            success : function(o) {
                var rst = o.responseText;
                GE(target).innerHTML = rst;
                
                setDescField('GTxtBo', 'GTxtCo');
            },
            failure : function(o) {
            }
        }
    return callback;     

}
 function GoLink(){
    GoG(this.link);
 }
 function alertNoLink(){
    alert("Sorry, this link doesn't exist!");
 }
 
 function replaceClass(){
    var el = GE(this.ide);
    YAHOO.util.Dom.replaceClass(el, this.remove, this.add);
    if (isDef(this.label)) setLabelText(this.label);
    
 }
 
 function setLabelText(txt){
        var oLbl = GE('altext');
        if (isDef(oLbl)) oLbl.innerHTML = txt;
    
 }
/*********************************************************/

function init_AP(){
    startIndex = 2;
    
    //** collect widths of gallery names
    g_pfx = 'g';
    igItemsBoxW = GE('dvGList').offsetWidth - igMoreLabW;
    getAWidths();
}


function SetL(){
    ShowLoadingIN("fpimg", "fpimgFrame");
   //ShowLoadingIN("main_content", "co_container");
   //  ShowLoadingIN("fpimg", "co_container");
    
}

    window.onload = setMenuLineWidth;
    var f = window.onload; 
    if (typeof f == 'function'){
        window.onload = function() {
            f();
            OnloadFunc();
        }
    }else window.onload = OnloadFunc;
    
    
    var bIsBtnPressed = false;
/**** panel  *****/
    YAHOO.namespace("example.container");
    
    YAHOO.example.container.oname = '';
    var oBox;
    function initZ(SID, W, H, type) {
    
        //** set button flag pressed to avoid showing large image
        bIsBtnPressed = true;
        
        oname='ft';
        
         oBox = eval('YAHOO.example.container.'+oname);
        YAHOO.example.container.oname = oname;

        if (!oBox) {
            oBox = new YAHOO.widget.Panel(oname,  
                                                { width: W+'px',
                                                  height: H+'px',
                                                  fixedcenter: false, 
                                                  close: true, 
                                                  draggable: true, 
                                                  zindex:9999,
                                                  visible: false,
                                                  modal: true
                                                } 
                                            );
            oBox.renderEvent.subscribe(	function(){this.header.style.display='none'    });

	     eval('YAHOO.example.container.'+oname+'=oBox');
      }

	init_more( oBox, SID, W, H, type);

        //*** Show the Panel
        oBox.show();
        
    }
    
 function init_more(oContainer, iSource, iW, iH, iType){

    if (iType == 1) {//** stack viewer
	   if(apple==0){
       code = AC_FL_RunContent(
	        'codebase', 'http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,24,0',
	        'width', iW,
	        'height', iH,
	        'src', 'SlideShow',
	        'quality', 'autohigh',
	        'pluginspage', 'http://www.macromedia.com/go/getflashplayer',
	        'align', 'top',
	        'play', 'false',
	        'loop', 'true',
	        'scale', 'noscale',
	        'wmode', 'transparent',
	        'bgcolor', '',
	        'devicefont', 'false',
	        'id', 'SlideShow',
	        'name', 'SlideShow',
	        'menu', 'false',
	        'allowFullScreen', 'false',
	        'allowScriptAccess','sameDomain',
	        'movie', 'SlideShow', 
'flashvars','folderId='+iSource+'&isSlideshow=0&sKey='+sSKey+'&customerId='+sArtistID+'&cKey='+sSKey+'&isFA=1&fileFrom='+sAppurl+'fl5s.asp&path='+sAppurl+'fl5.asp&isPreview=0&toShowCloseButton=1&closeFunctName=CloseStackView&paramForCloseFinction=oBox',
	        'salign', 'lt'
	        );
	   }
	   else if(apple==1){ //------------------------------------------------------------------------------------------------------>VV->START Slide show for iPad,iPhone etc
		  //scroll(0,0);
		   slideShowOn=1;
	
		  code= document.createElement("div");	   
		   code.setAttribute('id', "SlideShowSV");
		   code.setAttribute('class', "SlideShowSV");	
	      
		   iH = iH+200;
		   
		   
		 if (window.XMLHttpRequest)
                 {// code for IE7+, Firefox, Chrome, Opera, Safari
                     xmlhttp=new XMLHttpRequest();
                      }
             else
                  {// code for IE6, IE5
                          xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
                      } 
					
					xmlhttp.open("GET","fl5.asp?customerId="+sArtistID+"&sKey="+sSKey+"&folderId="+iSource+"&isSlideshow=1",true);
                   
				   xmlhttp.send();
                   xmlhttp.onreadystatechange=function()
                   { 
                        if (xmlhttp.readyState==4 && xmlhttp.status==200)
                           {
					 		var xx,Aurl,description;
						 	var yy ="";
							var imgs="";
							
							var myImg = new Array();
                               xx =xmlhttp.responseXML.documentElement.getElementsByTagName("image");
							   description = xmlhttp.responseXML.documentElement.getElementsByTagName("iDescription");
						 	    Aurl = xmlhttp.responseXML.documentElement.getElementsByTagName("url_base")[0].firstChild.nodeValue;
								
							  var srcvar ="'"+Aurl+""+xx[0].attributes[3].nodeValue+"'";
								for(var i=0;i<xx.length;i++){
								    var option ="";
									price = new Array();
									Wi = new Array();
									Heig = new Array();
									weig = new Array();
									OI = new Array();
									var oo = xx[i].getElementsByTagName("PriceOption");	
									var oi= xx[i].getElementsByTagName("poSaleInfo");	
									if(oo.length>0){
								           for(var j=0; j<oo.length; j++){
											   price[j] = oo[j].attributes[2].nodeValue;
											   Wi[j] = oo[j].attributes[3].nodeValue;
											   Heig[j] =  oo[j].attributes[4].nodeValue;
											   weig[j] = oo[j].attributes[5].nodeValue;
											   if(oi.length>0){
											  OI[j] = oi[j].firstChild.nodeValue;
											   }
											   else{
												 OI[j] = "No Information";  
											   }
									          option = option + "<option value='"+price[j]+", "+Wi[j]+", "+Heig[j]+", "+weig[j]+", "+OI[j]+"'>"+oo[j].attributes[1].nodeValue+"</option>";
							   
									         }
									
							            var info = "<table><tr><td>Select Options:</td><td colspan='3'><select id='selectPrice' onchange='dispPriceinfo(this.value)'>"+option+"</select></td></tr><tr><td>Price </td><td colspan='3'><span class='tdborder' id='newSS0'>"+price[0]+"</span> USD</td></tr><tr><td>Dimensions </td><td>Width <span class='tdborder' id='newSS1'>"+Wi[0]+"</span></td><td>Height <span class='tdborder' id='newSS2'>"+Heig[0]+"</span></td><td>Weight <span class='tdborder' id='newSS3'>"+weig[0]+"</span></td></tr><tr><td>Other Info</td><td colspan='3'  class='tdborderOI' id='newSS4'>"+OI[0]+"</td></tr><tr><td></td><td colspan='3'><a href='#'>Add to Cart</a> &nbsp;&nbsp;&nbsp;&nbsp;<a href='#'>Checkout</a></td></tr></table>";
							  
								}
								    else{
										  var info = "";
										 
									}
							  	
							  
									
							
								if(document.images)
								{
									preload_image_object = new Image();
									image_url = new Array();
									image_url[i]=Aurl+""+xx[i].attributes[3].nodeValue;
									preload_image_object.src=image_url[i];
									yy=yy+"<li><img src='"+preload_image_object.src+"'/><span>"+description[i].firstChild.nodeValue+"</span><div class='priceOP'>"+info+"</div><div>"+xx[i].attributes[1].nodeValue+"</div><div>"+xx[i].attributes[2].nodeValue+" / "+xx.length+"</div></li>";
									
								}
								
								}
							
								
								
							var slideShow = "<div class='closestk' onclick='CloseStackView(oBox)'> X </div><ul id='slideS'>"+yy+"</ul>";
							  document.getElementById("SlideShowSV").innerHTML= slideShow;
					
							 galview(iW,iH, xx.length);
							
                             }
                       }
                     
 	} //--------------------------------------------------------------------------------------------------------------------------------------->VV->END Slide show for iPad,iPhone etc
			
			
			 }
    else { //** video
	if(apple==0){
       code =AC_FL_RunContent(
			"src", "FLVPlayer",
			"width", iW,
			"height", iH,
			"align", "middle",
			"id", "FLVPlayer",
			"quality", "high",
			"bgcolor", "#869ca7",
			"wmode", "transparent",
			"name", "FLVPlayer",
			"flashvars",'source='+encodeURIComponent(iSource)+'&bgcolor=0x000000&closeFunctName=CloseStackView&paramForCloseFinction=oBox',
			"allowScriptAccess","sameDomain",
			"type", "application/x-shockwave-flash",
			"pluginspage", "http://www.adobe.com/go/getflashplayer",
			"scaleContent", "false",
			"allowFullScreen", "true"
	        );}
	   else if(apple==1){code="<div onclick='CloseStackView(oBox)' class='cc2_i'>CLOSE&nbsp;&nbsp;&nbsp;<span >X</span>&nbsp;&nbsp;</div>";
var videoobj="<video src='"+iSource+"' autoplay='autoplay' controls='controls' width="+iW+" height="+iH+"></video>";
code = code+videoobj;   
		   }
	}
	 oContainer.setBody(code);
//       oContainer.renderEvent.subscribe(function(){this.header.style.display='none'});
       oContainer.render(document.body);
     CenterIt(oContainer, iW, iH);
     //  oContainer.center();
       
    }
    
 function CenterIt(obj, W, H){

    mTop = -H/2 +  GS('header', 'height') + GS('IContainer', 'paddingTop') - (GS('holder2', 'height') - H)/2 + (GS('fpimg', 'height')-H)/2
    mLeft = -W/2 + GS('IContainer', 'paddingLeft') - (GS('holder2', 'width') - W)/2 + (GS('fpimg', 'width')-W)/2
    GE('ft_c').style.marginTop = mTop+'px';

    GE('ft_c').style.marginLeft = mLeft+'px';
 }
 
 function CloseStackView(o){
    var obj = eval(o);
    obj.setBody('');
    obj.hide();
    if(apple==1){
		box=0;
		slideShowOn=0;
	}
   //** set the flag for 'Viewer'/'Video' as released
   bIsBtnPressed = false;
}


function wlog( content,flAddNew){
    var  id="logger";
    var dv = GE(id);
    
    if (!dv){
        dv = document.createElement('div');
        dv.setAttribute('id',id);
	    document.body.appendChild(dv);
    }
    
    if (flAddNew)
        GE(id).innerHTML =content+ "<br>"
    else
        GE(id).innerHTML =  GE(id).innerHTML +content+"<br>"
        
}


//****** code added on 3 jan 2011, stef

var arILText=new Array(); // will start from index [1][0], [1][1]
function LoadTexts(x){
    if(!x) x=1
    if (x<arIL.length){
        GetDescPriceInfo(x, arIL[x].mlink);
        
  //      LoadTexts(x+1);
    }
    else {
        //stop
        //alert('MASIV::\n\n'+arILText)
      //  for (a=1;a<arILText.length; a++) alert('DESC::\n'+arILText[a][0]+'\n\n\nPRICE::\n'+arILText[a][1])
    }
}
function GetDescPriceInfo(ind, link){
    
    if(!arILText[ind]){
       // arILText[ind]=new Array();   
        
        var callback = CBack(ind);
        var conn = YAHOO.util.Connect.asyncRequest("GET", link, callback);
    }
    else
       LoadTexts(ind+1); 
}
function CBack(ind){
    var callback = {
            success : function(o) {
                var rst = o.responseText;
                var otemp = document.createElement("div");
                otemp.innerHTML = rst;
               
                var arO, i;
                var break1=false, break2=false;
                
                    arO = otemp.getElementsByTagName('div');//wlog('------fill:'+ind)
                    arILText[ind]=new Array();   
                    for (i=0; i< arO.length; i++){
                        if (arO[i].getAttribute('id') == YAHOO.widget.slideshow.arImageFields[0]) {
                           arILText[ind][0] = arO[i].innerHTML;
                           break1 = true;
                         }
    		            if (arO[i].getAttribute('id') == YAHOO.widget.slideshow.arImageFields[1]) {
                           arILText[ind][1] = arO[i].innerHTML;                  
                           break2 = true;
                         }
                        if (break1 && break2) break;
                    }
               
               
                LoadTexts(ind+1);
                
            },
            failure : function(o) {
               // alert('Error!')
            }
        }
    return callback;
}
    
function GetImageInfo_Noajx(current_slideID)
{ //wlog('GetImageInfo_Noajx('+current_slideID+')::'+arIL[YAHOO.widget.slideshow.currentSlide+1].title)
    //*** load image title
    GE(YAHOO.widget.slideshow.arImageName[0]).innerHTML = arIL[YAHOO.widget.slideshow.currentSlide+1].title;
    checkGNameWidth();
    
    //if (divIDs.length>1) 
    ShowLoading('itxt1'); 
     
                  
    //get description and pricing data from arILText array   
    SetDataToFields(current_slideID);
                               
   YAHOO.widget.slideshow.TLoaded = true; 

   if (YAHOO.widget.slideshow.checkThreads()) YAHOO.widget.slideshow.HideImage();
    
 }  
 
 function SetDataToFields(sID){
        
     if (isDef(entrMarker)) iMarker = entrMarker;             
//wlog('SetDataToFields('+sID+')::'+arILText[sID][0]+' // '+arILText[sID][1])
     GE(YAHOO.widget.slideshow.arImageFields[0]).innerHTML = arILText[sID][0];
     GE(YAHOO.widget.slideshow.arImageFields[1]).innerHTML = arILText[sID][1];
                   
     if(GE('itxtwrap')){
         GE('itxtwrap').style.visibility = 'visible';
        
         var arT = ['itxt1', 'itxt2']
         for (a=0; a<arT.length; a++){
            switch (arT[a]){
                case 'itxt1': empty=false; break;
                case 'itxt2': empty=true; 
            }
            setDescField('itxtwrap', arT[a]);
         }

         chMode(1); 
     }

}

function getBoolean(variable) {

    var vtype;
    var toReturn;

    if(variable != null) {

        switch(typeof(variable)) {
            case 'boolean':
                vtype = "boolean";
                return variable;
                break;
            case 'number':
                vtype = "number";
                if(variable == 0)
                    toReturn = false;
                else toReturn = true;
                break;
            case 'string':
                vtype = "string";
                if(variable == "true")
                    toReturn = true;
                else if(variable == "false")
                    toReturn = false;
                else if(variable.length > 0)
                    toReturn = true;
                else if(variable.length == 0)
                    toReturn = false;
                break;

                            }
        return toReturn; }
 }
 
 
 /*Slide show */
function galview(imageWidth,imgHeight,nofImg){
					
$('#slideS').PikaChoose({auto_play:true, image_height:imgHeight-250, image_width:imageWidth, number_images:nofImg});
	
	
}

//-------------------------------------------------------------------------------------------------------------------------------------------------------->VV
// JavaScript Document
