function mycarousel_itemVisibleInCallback(carousel, item, i, state, evt) { 
// The index() method calculates the index from a 
// given index who is out of the actual item range. 
var idx = carousel.index(i, mycarousel_itemList.length); 
carousel.add(i, mycarousel_getItemHTML(mycarousel_itemList[idx - 1])); }; 
function mycarousel_itemVisibleOutCallback(carousel, item, i, state, evt) { 
carousel.remove(i); }; /** * Item html creation helper. */ 

function mycarousel_getItemHTML(item) { //return '<img src="' + item.url + '" width="75" height="75" alt="' + item.title + '"  />'; 
return '<li><a href="/avtosalon/index.php?ID=' + item.link + '" ><img src="' + item.url + '" class="png" alt="' + item.title + '" width="' + item.width + '" height="' + item.height + '"  /></a></li>'; };


var timeout;
 
function clickAction() {
    frameFitting();
    var fr = document.getElementById('demo_frame').getElementsByTagName('a');
    for (var i=0; i<fr.length; i++) {
        fr[i].onclick = function() {
            clearInterval(timeout);
            timeout = setInterval("frameFitting()",100);
        }
    }
}
 
function frameFitting() {
    document.getElementById('demo_frame').width = '100%';
    document.getElementById('demo_frame').height = document.getElementById('demo_frame').contentWindow.document.body.scrollHeight+4+'px';
    //document.getElementById('demo_frame').height = document.body.scrollHeight+4+'px';
    //document.getElementById('demo_frame').height = 200+'px';
}
 
//onload = clickAction;
//onload = frameFitting;


