
var isSingleCrew;
var updatingImage = true;
var RequestUrl = "functions/json.aspx";
var ReqGetSearchResult;

window.addEvent('domready', function() {

    $$(".sidebar_spectext").setOpacity(0.7);

    if ($('theCrewSideBar_theCatBrowser') != null) {
        var tmpGroups = $$('#theCrewSideBar_theCatBrowser .cat_group');
        var tmpItemHeight = tmpGroups[0].getFirst().getStyle('height').toInt() + tmpGroups[0].getFirst().getStyle('padding-top').toInt() + tmpGroups[0].getFirst().getStyle('padding-bottom').toInt();
        tmpGroups.setStyle('height', tmpItemHeight);
        $$('#theCrewSideBar_theCatBrowser .cat_item').addEvent('click', onCatItemClick);
    }

    if ($('theProjectsTable') != null) {
        $('theProjectsTable').getElements('tr:odd').setStyle('background-color', '#f6f6f6');
        $('theProjectsTable').getElements('tr:even').setStyle('background-color', '#f0f0f0');
    }

    if ($('theProjectSearch') != null)
        $('theProjectSearch').addEvent('keyup', goSearchProject);

    if ($('theCrewSearch') != null)
        $('theCrewSearch').addEvent('keyup', goSearchCrew);

    $('theSearchInput').addEvent('keyup', goSearch);
    $('theSearchContent').fx = new Fx.Morph($('theSearchContent'), { duration: 500, link: 'cancel', transition: Fx.Transitions.Quad.easeOut });
    //$('theSearchInput').addEvent('focus', searchIn);
    //$('theSearchInput').addEvent('blur', searchOut);

    //ReqGetSearchResult
    ReqGetSearchResult = new Request({ method: "post", data: "func=GetSearchResult&word={word}&crewonly={crewonly}&projectonly={projectonly}", link: 'cancel', url: RequestUrl, onSuccess: reqGetSearchResultSuccess, onFailure: reqGetSearchResultFailure, onCancel: killCall, onComplete: killCall });

    //H4PhotoView
    if ($('H4PhotoView') != null) {
        new Request({ method: "post", data: "", link: 'cancel', url: $('H4PhotoView').get('dataref'), onSuccess: reqGetContentSuccess, onFailure: reqGetContentFailure, onCancel: killCall, onComplete: killCall }).send();
    }
});

function mainCategoryChanged(tmpItem) {
    var tmpItemSub = $('selCatSecond_' + tmpItem.id.split('_')[1]);
    tmpItemSub.options.length = 1;

    if (tmpItem.options[tmpItem.selectedIndex].value != "") {
        var tmpCats = eval("catGroup_" + tmpItem.options[tmpItem.selectedIndex].value);

        tmpCats.cats.each(function(cat) {
            var tmpOption = new Element('option');
            tmpOption.set("value", cat.value);
            tmpOption.set("text", cat.text);
            tmpItemSub.adopt(tmpOption);
        });
    }
}

function callInsertFile(type) {
    updatingImage = (type == "image" ? true : false);

    var editor1 = $('CE_theCTEditor_ID');
    editor1.FocusDocument();
    editor1.setHTML("");
    editor1.ExecCommand('new');
    if (updatingImage)
        editor1.ExecCommand('ImageGalleryByBrowsing');
    else
        editor1.ExecCommand('insertdocument');
        //editor1.ExecCommand('YouTube');
    InputURL();
}
function InputURL() {
    var editor1 = $('CE_theCTEditor_ID');
    var editdoc = editor1.GetDocument();
    var imgs = editdoc.images;
    var links = editdoc.getElementsByTagName("a");
    if (imgs.length > 0 && updatingImage) {
        $("thePortrait").src = imgs[imgs.length - 1].src;
        $("thePortraitImage").set('value', imgs[imgs.length - 1].src);
        $("theFirstName").focus();
    }
    else if (!updatingImage && links.length > 0 && links[links.length - 1].href != "") {
        $("thePdfCV").set('value', links[links.length - 1].href);
    }  
    else {
        setTimeout(InputURL, 800);
    }
} 

function onCatItemClick() {

    var tmpArrayId = this.id.split('_');
    var tmpParentValue = tmpArrayId[3];
    var tmpChildValue = tmpArrayId[2];

    if (isSingleCrew == true) {
        window.location = "?catid=" + tmpChildValue;
        return;
    }

    new Fx.Scroll(window, { duration: 1 }).toTop();

    if (this.hasClass('cat_parent')) {
        var tmpGroups = $$('#theCrewSideBar_theCatBrowser .cat_group');
        var tmpItemHeight = tmpGroups[0].getFirst().getStyle('height').toInt() + tmpGroups[0].getFirst().getStyle('padding-top').toInt() + +tmpGroups[0].getFirst().getStyle('padding-bottom').toInt();
        tmpGroups.setStyle('height', tmpItemHeight);

        this.getParent().setStyle('height', (tmpItemHeight+2) * this.getParent().getChildren().length - 1);
    }

    if (tmpParentValue == 'all' && tmpChildValue == 'all') {
        var tmpChildren = $('theContactContent').getChildren();
        tmpChildren.setStyle('display', 'block');
        $('theCrewCounter').set('html', "<span class='text2'>" + this.get('text') + "</span><span class='text3'>" + tmpChildren.length + ' contacts</span>');
    }
    else {
        var tmpItemId = tmpChildValue;  //(tmpParentValue == 'all' ? tmpChildValue : tmpParentValue);

        var tmpItems = $('theContactContent').getElements('.cat_1_' + tmpItemId + ', .cat_1_0_' + tmpItemId + ', .cat_2_' + tmpItemId + ', .cat_2_0_' + tmpItemId + ', .cat_3_' + tmpItemId + ', .cat_3_0_' + tmpItemId);
        $('theContactContent').getChildren().setStyle('display', 'none');
        tmpItems.setStyle('display', 'block');
        $('theCrewCounter').set('html', "<span class='text2'>" + this.get('text') + "</span><span class='text3'>" + tmpItems.length + ' contacts</span>');
    }

    $$('#theCrewSideBar_theCatBrowser .cat_item').removeClass('cat_item_selected');
    this.addClass('cat_item_selected');
}

function onCatItemPreSelect(id) {
    var tmpObject = $$('#theCrewSideBar_theCatBrowser [id^=theCrewSideBar_theCatItem_' + id + ']');
    tmpObject.fireEvent('click');
}
function showRefr() {
    $$('.refr').setStyle('color', '#000');
    $$('.refrview').destroy();
}
function renameMenu() {
    var tmpMenuObject = $('theMenuId' + $('theEditorHolder').menuid);
    var answer = prompt("Enter a new name for the menu:", tmpMenuObject.get('text'));

    if (answer == null)
        return;

    if (answer == tmpMenuObject.get('text'))
        return;
        
    if(answer.trim() == "")
    {
        alert("Empty name not allowed.");
        return;
    }

    ReqSaveData.send(ReqSaveData.options.data.replace("{id}", $('theEditorHolder').menuid).replace('{func}', 'SetCaptionForMenu').replace('{content}', escape(answer)));
}

function deletePage() {
    if (confirm("Are you sure you want to delete this page?")) {
        ReqSaveData.send(ReqSaveData.options.data.replace("{id}", $('theEditorHolder').menuid).replace('{func}', 'RemovePageForMenu'));
    }
}

function saveProfile() {
    $("theItemAction").value = "save";
    $("theForm").submit();
}
function goPublishMe() {
    if (confirm("Are you sure you want to publish this profile?")) {
        $("theItemAction").value = "publish";
        $("theForm").submit();
    }
}
function goUnpublishMe() {
    if (confirm("Unpublishing your profile will make it unaccessable for anyone except you. Are you sure you want to unpublish your profile?")) {
        $("theItemAction").value = "unpublish";
        $("theForm").submit();
    }
}

///********************************************************************************************** */
function killCall() {}

//ReqGetSearchResult - REQUEST HANDLING
function reqGetSearchResultSuccess(text, xml) {
    try {
        var tmpResponse = JSON.decode(text);
        if (!tmpResponse.success) {
            reqGetSearchResultFailure(ReqGetSearchResult);
            return;
        }

        if (tmpResponse.word == "stah4labts") {
//            $('theEditorHolder').setStyle('visibility', 'hidden');
//            $('theSearchContent').setStyle('display', 'none');
//            $('theContactContent').setStyle('display', 'none');

//            $('theContent').set('html', tmpResponse.content);
//            $('theContent').setStyle('display', 'block');
//            
//            new Fx.Scroll(window, { duration: 1 }).toTop();
        }
        else if (tmpResponse.crewonly) {

            var tmpChildren = $('theContactContent').getChildren();
            tmpChildren.setStyle('display', 'none');
            $$('#theCrewSideBar_theCatBrowser .cat_item').removeClass('cat_item_selected');
        
            /*$('theContent').setStyle('display', 'none');
            $('theEditorHolder').setStyle('visibility', 'hidden');
            $('theSearchContent').setStyle('display', 'none');
            $('theContactContent').setStyle('display', 'block');*/

            if (tmpResponse.contacts.length < 1) {
                $('theCrewCounter').set('html', "<span class='text2'>Search result</span><span class='text3'>No contacts found</span>");
            }
            else {
                $('theCrewCounter').set('html', "<span class='text2'>Crew found</span><span class='text3'>" + tmpResponse.contacts.length + " contacts found</span>");
                var tmpItemsRes = "";
                tmpResponse.contacts.each(function(tmpItem) {
                    tmpItemsRes += "#theCrew_" + tmpItem.id + ", ";
                });
                tmpItemsRes = tmpItemsRes.substring(0, tmpItemsRes.length - 2);

                $('theContactContent').getElements(tmpItemsRes).setStyle('display', 'block');

                /*$('theCrewCounter').set('html', tmpResponse.contacts.length + " contacts found.");
                $('theContactContent').getChildren().setStyle('display', 'none');
                $('theContactContent').getElements(tmpItemsRes).setStyle('display', 'block');*/
            }
            
            new Fx.Scroll(window, { duration: 1 }).toTop();
        }
        else if (tmpResponse.projectonly) {
            $('theProjectsTable').getElements('tr').setStyle('display', 'none');
            $('theProjectsTable').getElement('#theProjectRowHead').setStyle('display', 'table-row');
            if (tmpResponse.projects.length < 1) {
                $('theProjectsTable').getElement('#theProjectRowHead').getElement('td').set('html', 'No productions found.');
            }
            else {
                var tmpItemsRes = "";
                tmpResponse.projects.each(function(tmpItem) {
                    tmpItemsRes += "#theProjectRow" + tmpItem.id + ", ";
                });
                tmpItemsRes = tmpItemsRes.substring(0, tmpItemsRes.length - 2);
                $('theProjectsTable').getElement('#theProjectRowHead').getElement('td').set('html', tmpResponse.projects.length + " productions found.");
                $('theProjectsTable').getElements(tmpItemsRes).setStyle('display', 'table-row');
            }
        }
        else {
            $('theSearchContent').getElements('.loader').setStyle('display', 'none');

            var tmpHolder = $('theSearchResCrew');
            tmpHolder.empty();
            var tmpEl = null;
            tmpResponse.contacts.each(function(tmpItem) {
                tmpEl = new Element('a', { 'href': 'crew.aspx?crewitem=' + tmpItem.id });
                tmpEl.set('html', tmpItem.name);
                tmpHolder.adopt(tmpEl);
            });
            if (tmpResponse.contacts.length < 1)
                tmpHolder.set('html', "<span class='nores'>No crew found.</span>");
            tmpHolder = $('theSearchResContent');
            tmpResponse.items.each(function(tmpItem) {
                tmpEl = new Element('a', { 'href': tmpItem.url });
                tmpEl.set('html', tmpItem.title);
                tmpHolder.adopt(tmpEl);
            });
            if (tmpResponse.items.length < 1)
                tmpHolder.set('html', "<span class='nores'>No content found.</span>");
            tmpHolder = $('theSearchResProj');
            tmpResponse.projects.each(function(tmpItem) {
                tmpEl = new Element('a', { 'href': 'projects.aspx?prid=' + tmpItem.id });
                tmpEl.set('html', tmpItem.name);
                tmpHolder.adopt(tmpEl);
            });
            if (tmpResponse.projects.length < 1)
                tmpHolder.set('html', "<span class='nores'>No productions found.</span>");
        }

    } catch (error) { alert(error.message); }
}
function reqGetSearchResultFailure(instance) {
    alert('error getting search...');
}
function goSearch() {

    if (this.value.length > 0) {
        $('theSearchResContent').set('html', '');
        $('theSearchResCrew').set('html', '');
        $('theSearchResProj').set('html', '');
        $('theSearchContent').getElements('.loader').setStyle('display', 'block');
        ReqGetSearchResult.send(ReqGetSearchResult.options.data.replace("{word}", this.value));
        $('theSearchContent').fx.start({ 'height': 200, 'margin-bottom': 20 });
    }
    else {
        $('theSearchContent').fx.start({ 'height':0, 'margin-bottom':0 });
    }
}
function goSearchProject() {
    if (this.value.length > 0) {
        ReqGetSearchResult.send(ReqGetSearchResult.options.data.replace("{word}", this.value).replace("{projectonly}", '1'));
    }
    else {
        $('theProjectsTable').getElements('tr').setStyle('display', 'table-row');
        $('theProjectsTable').getElement('#theProjectRowHead').getElement('td').set('html', 'All ' + ($('theProjectsTable').getElements('tr').length -1) + ' productions.');
    }
}
function goSearchCrew() {
    if (this.value.length > 1) {
        ReqGetSearchResult.send(ReqGetSearchResult.options.data.replace("{word}", this.value).replace("{crewonly}", '1'));
    }
    else if(this.value.length < 1) {
        var tmpChildren = $('theContactContent').getChildren();
        tmpChildren.setStyle('display', 'block');
        $('theCrewCounter').set('html', "<span class='text2'>All SLFC members</span><span class='text3'>" + tmpChildren.length + ' contacts</span>');
        $$('#theCrewSideBar_theCatBrowser .cat_item').removeClass('cat_item_selected');
    }
}

//H4PhotoView
function H4Play() {
    var tmpView = $('H4PhotoView');
    if (!tmpView.paused)
        H4GoRight();
}
function H4NavigEnter() {
    $('H4PhotoView').paused = true;
    this.getElements('img')[0].setStyle('visibility', 'visible');
    /*this.setStyle('background-color', '#000');
    this.setStyle('opacity', 0.5);
    this.setStyle('background-image', "none");*/
}
function H4NavigLeave() {
    $('H4PhotoView').paused = false;
    this.getElements('img')[0].setStyle('visibility', 'hidden');
    /*this.setStyle('background-color', 'transparent');
    this.setStyle('opacity', 1.0);
    this.setStyle('background-image', "url('resources/dummy.gif')");*/
}
function H4GoRight() {
    var tmpView = $('H4PhotoView');
    
    var tmpActiveIndex = tmpView.activeIndex;
    var tmpNextIndex = tmpActiveIndex + 1;
    if (tmpNextIndex > tmpView.data.length - 1)
        tmpNextIndex = 0;
    var tmpNextNextIndex = null;

    var activePage = tmpView.getElement('img[src="' + tmpView.data[tmpActiveIndex].url + '"]');
    var nextPage = tmpView.getElement('img[src="' + tmpView.data[tmpNextIndex].url + '"]');
    var nextNextPage = null;

    var allPages = tmpView.getElements('.h4showpage');
    if (allPages.length > 2) {
        tmpNextNextIndex = tmpNextIndex + 1;
        if (tmpNextNextIndex > tmpView.data.length - 1)
            tmpNextNextIndex = 0;
        allPages.each(function(tmpPage) {
            if (tmpPage != activePage && tmpPage != nextPage) {
                nextNextPage = tmpPage;
                return;
            }
        });
    }

    /*if (activePage != null) {
    activePage.fx.start({ 'left':(tmpView.getSize().x * -1) });
    }*/
    if (nextPage != null) {
        nextPage.setStyle('z-index', tmpView.zindex++);
        nextPage.setStyle('left', tmpView.getSize().x);
        nextPage.fx.start({ 'left': 0 });
        if (tmpView.data[tmpNextIndex].caption != null) {
            $('H4PVCaption').set('text', tmpView.data[tmpNextIndex].caption);
            $('H4PVDesc').set('text', tmpView.data[tmpNextIndex].description);
            $('H4PVCaption').getParent().setStyle("visibility", "visible");
        }
        else {
            $('H4PVCaption').set('text',"");
            $('H4PVDesc').set('text', "");
            $('H4PVCaption').getParent().setStyle("visibility", "hidden");
        }
    }
    if (nextNextPage != null) {
        nextNextPage.set('src', tmpView.data[tmpNextNextIndex].url);
        if (tmpView.data[tmpNextNextIndex].valign == "0") {
            nextNextPage.setStyle('bottom', '0');
            nextNextPage.setStyle('top', 'auto');
        }
        else{
            nextNextPage.setStyle('top', '0');
            nextNextPage.setStyle('bottom', 'auto');
        }
    }
    tmpView.activeIndex = tmpNextIndex;
}
function H4GoLeft() {
    var tmpView = $('H4PhotoView');

    var tmpActiveIndex = tmpView.activeIndex;
    var tmpNextIndex = tmpActiveIndex - 1;
    if (tmpNextIndex < 0)
        tmpNextIndex = tmpView.data.length - 1;
    var tmpNextNextIndex = null;

    var activePage = tmpView.getElement('img[src="' + tmpView.data[tmpActiveIndex].url + '"]');
    var nextPage = tmpView.getElement('img[src="' + tmpView.data[tmpNextIndex].url + '"]');
    var nextNextPage = null;

    var allPages = tmpView.getElements('.h4showpage');
    if (allPages.length > 2) {
        tmpNextNextIndex = tmpNextIndex - 1;
        if (tmpNextNextIndex < 0)
            tmpNextNextIndex = tmpView.data.length - 1;
        allPages.each(function(tmpPage) {
            if (tmpPage != activePage && tmpPage != nextPage) {
                nextNextPage = tmpPage;
                return;
            }
        });
    }
    if (nextPage != null) {
        nextPage.setStyle('z-index', tmpView.zindex++);
        nextPage.setStyle('left', 0 - tmpView.getSize().x);
        nextPage.fx.start({ 'left': 0 });
        if (tmpView.data[tmpNextIndex].caption != null) {
            $('H4PVCaption').set('text', tmpView.data[tmpNextIndex].caption);
            $('H4PVDesc').set('text', tmpView.data[tmpNextIndex].description);
            $('H4PVCaption').getParent().setStyle("visibility", "visible");
        }
        else {
            $('H4PVCaption').set('text', "");
            $('H4PVDesc').set('text', "");
            $('H4PVCaption').getParent().setStyle("visibility", "hidden");
        }
    }
    if (nextNextPage != null) {
        nextNextPage.set('src', tmpView.data[tmpNextNextIndex].url);
        if (tmpView.data[tmpNextNextIndex].valign == "0") {
            nextNextPage.setStyle('bottom', '0');
            nextNextPage.setStyle('top', 'auto');
        }
        else{
            nextNextPage.setStyle('top', '0');
            nextNextPage.setStyle('bottom', 'auto');
        }
    }
    tmpView.activeIndex = tmpNextIndex;
}
function reqGetContentSuccess(text, xml) {
    try {
        var tmpResponse = JSON.decode(text);
        if (!tmpResponse.success) {
            reqGetContentFailure(ReqGetSearchResult);
            return;
        }
        
        if (tmpResponse.items.length < 1) {
            reqGetContentFailure(ReqGetSearchResult);
            return;
        }

        var tmpView = $('H4PhotoView');
        tmpView.setStyle('overflow', 'hidden');
        tmpView.setStyle('position', 'relative');

        var tmpEl = new Element('img', { 'src': tmpResponse.items[0].url, 'class':'h4showpage' });
        tmpEl.setStyle('position', 'absolute');
        tmpEl.setStyle('width', tmpView.getSize().x);
        tmpEl.setStyle('left', '0px');
        if(tmpResponse.items[0].valign == '0')
            tmpEl.setStyle('bottom', '0');
        else
            tmpEl.setStyle('top', '0');
        tmpEl.setStyle('z-index', 9);
        tmpEl.fx = new Fx.Morph(tmpEl, { duration: 800, link: 'cancel', transition: Fx.Transitions.Quad.easeOut });
        tmpView.adopt(tmpEl);
        
        if (tmpResponse.items.length > 1) {
            tmpEl = new Element('img', { 'src': tmpResponse.items[1].url, 'class': 'h4showpage' });
            tmpEl.setStyle('position', 'absolute');
            tmpEl.setStyle('width', tmpView.getSize().x);
            tmpEl.setStyle('left', tmpView.getSize().x);
            if (tmpResponse.items[1].valign == '0')
                tmpEl.setStyle('bottom', '0');
            else
                tmpEl.setStyle('top', '0');
            tmpEl.setStyle('z-index', 10);
            tmpEl.fx = new Fx.Morph(tmpEl, { duration: 800, link: 'cancel', transition: Fx.Transitions.Quad.easeOut });
            tmpView.adopt(tmpEl);
        }
        if (tmpResponse.items.length > 2) {
            tmpEl = new Element('img', { 'src': tmpResponse.items[tmpResponse.items.length - 1].url, 'class': 'h4showpage' });
            tmpEl.setStyle('position', 'absolute');
            tmpEl.setStyle('width', tmpView.getSize().x);
            tmpEl.setStyle('left', tmpView.getSize().x * -1);
            if (tmpResponse.items[tmpResponse.items.length - 1].valign == '0')
                tmpEl.setStyle('bottom', '0');
            else
                tmpEl.setStyle('top', '0');
            tmpEl.setStyle('z-index', 8);
            tmpEl.fx = new Fx.Morph(tmpEl, { duration: 800, link: 'cancel', transition: Fx.Transitions.Quad.easeOut });
            tmpView.adopt(tmpEl);
        }
        
        //info bar
        tmpEl = new Element('div', {});
        tmpEl.setStyle('position', 'absolute');
        tmpEl.setStyle('width', tmpView.getSize().x);
        tmpEl.setStyle('left', "0px");
        tmpEl.setStyle('height', "35px");
        tmpEl.setStyle('bottom', '0px');
        try{
            tmpEl.setStyle('background-color', 'rgba(0,0,0,0.5)');
        }catch(error){}
        tmpEl.setStyle('z-index', 9999);
        tmpEl.setStyle('cursor', 'pointer');
        tmpEl.setStyle('visibility', 'hidden');
        tmpEl.set('html', "<span id='H4PVCaption' style='position:absolute; left:0px; top:0px; color:#fff; overflow:hidden; padding-left:15px; height:35px; width:" + tmpView.getSize().x + "px; line-height:35px;'></span><span id='H4PVDesc' style='position:absolute; right:0px; top:0px; color:#999999; text-align:right; overflow:hidden; padding-right:15px; height:35px; width:" + tmpView.getSize().x + "px; line-height:35px;'></span>");
        tmpView.adopt(tmpEl);

        if (tmpResponse.items[0].caption != null) {
            $('H4PVCaption').set('text', tmpResponse.items[0].caption);
            $('H4PVDesc').set('text', tmpResponse.items[0].description);
            tmpEl.setStyle("visibility", "visible");
        }

        if (tmpResponse.items.length > 1) {
            //navig right
            tmpEl = new Element('div', {});
            tmpEl.setStyle('position', 'absolute');
            tmpEl.setStyle('width', tmpView.getSize().x * 0.4);
            tmpEl.setStyle('left', tmpView.getSize().x * 0.6);
            tmpEl.setStyle('height', tmpView.getSize().y);
            tmpEl.setStyle('top', '0px');
            tmpEl.setStyle('background-color', 'transparent');
            tmpEl.setStyle('background-image', "url('resources/dummy.gif')");
            tmpEl.setStyle('z-index', 10000);
            tmpEl.setStyle('cursor', 'pointer');
            tmpEl.set('html', "<img src='resources/h4show_navig_right.png' style='position:absolute; right:-8px; top:" + (tmpView.getSize().y / 2 - 226.0 / 2.0) + "px; visibility:hidden;' />");
            tmpEl.addEvent('mouseenter', H4NavigEnter);
            tmpEl.addEvent('mouseleave', H4NavigLeave);
            tmpEl.addEvent('click', H4GoRight);
            tmpView.adopt(tmpEl);
            //navig left
            tmpEl = new Element('div', {});
            tmpEl.setStyle('position', 'absolute');
            tmpEl.setStyle('width', tmpView.getSize().x * 0.4);
            tmpEl.setStyle('left', '0px');
            tmpEl.setStyle('height', tmpView.getSize().y);
            tmpEl.setStyle('top', '0px');
            tmpEl.setStyle('background-color', 'transparent');
            tmpEl.setStyle('background-image', "url('resources/dummy.gif')");
            tmpEl.setStyle('z-index', 10000);
            tmpEl.setStyle('cursor', 'pointer');
            tmpEl.set('html', "<img src='resources/h4show_navig_left.png' style='position:absolute; left:-8px; top:" + (tmpView.getSize().y / 2 - 226.0 / 2.0) + "px; visibility:hidden;' />");
            tmpEl.addEvent('mouseenter', H4NavigEnter);
            tmpEl.addEvent('mouseleave', H4NavigLeave);
            tmpEl.addEvent('click', H4GoLeft);
            tmpView.adopt(tmpEl);
            
            tmpView.data = tmpResponse.items;
            tmpView.zindex = 10;
            tmpView.activeIndex = 0;
            tmpView.paused = false;
            tmpView.play = H4Play.periodical(4000);
        }
    } catch (error) { reqGetContentFailure(ReqGetSearchResult); }
}
function reqGetContentFailure(instance) {
    if ($('H4PhotoView') != null)
        $('H4PhotoView').destroy();
}
