// <![CDATA[	


function setWaiterComments(content_id,waiter_id){
    var ypos = ( ( $(content_id).offsetHeight-$(waiter_id).offsetHeight ) / 2 ) + 50;

    $(waiter_id).style.top = ypos+"px";
    expCol( content_id, 'opacity');
    $(waiter_id).style.visibility='visible';

}



function getQvGB(url,element_name){

var rcount=randomnumber=Math.floor(Math.random()*50000);

var myAjax = new Ajax.Updater(element_name, url, {asynchronous:true,method: 'post' } );
}


	// ********related clips section 
    // previous related clip  cycle 
    function p_relclip(){
        if (rclip != 3 ) { 
            clips[rclip-1 ].className = 'hidden';
        }
        lclip--;
        rclip--;
        relclips_cycle ( );
    }

    //next related clip cycle
    function n_relclip(){
        lclip++;
        rclip++;
        relclips_cycle ( );
        if (lclip != 0 ) { 
            clips[lclip -1].className = 'hidden';
        }
    }

    var numshowclips = 3; 
    var lclip = 0; 
    var rclip = 3; 
    // *** action: cycle through related clips ***
    function relclips_cycle ( ){

       clips = $('relclips_ul').getElementsByTagName('li');

       //total clips
       numclips = clips.length;

       // too few rel clips
       if (rclip > numclips ) { 
           rclip = numclips;
       }

       // end of list 
       if (rclip  <  numclips ) { 
           $('btn_next').style.display = "block"; 
       } else { 
           //hide forward arrow
           $('btn_next').style.display = "none"; 
       }

        i = lclip; 
        // hide left arrow
        if (lclip ==  0 ) { 
           $('btn_prev').style.display = "none"; 
        } else { 
           $('btn_prev').style.display = "block"; 
        }

        // exec
        for (i; i  < rclip; ++i ) { 
            clips[i].className = "visible";
        }
    }

// ****************


    // *** populate shared embed link ***
    function linkEmbed(){
        //$('VidEmbed').setAttribute('value', $('flashcontent').innerHTML);
    }

    // *** submit comment ***
    var captcha_msg;
    function ajxSubmit2(frmId){
        new Ajax.Updater('comment_wrap', 
            '/a/moli_roller/', 
            { asynchronous:true, parameters:Form.serialize(frmId)}); 
            $("message_area").value = ''; 
           hide_balloon();  
            return false;
    }

    // *** submit comment ***
    function ajxSubmit(frmId){
        new Ajax.Updater('comment_wrap', 
            '/a/moli_roller/', 
            { asynchronous:true, parameters:Form.serialize(frmId)}); 
            $("message_area").value = ''; 
            expCol ('add_comment_bg', 'z2' ); 
            return false;
    }

    // *** hide/show form divs ***
    function expDv(oId ) { 
        var val = document.getElementById( oId ); 
            if ( val.style.display == "block" ) { 
                 val.style.display = "none";
            } else { 
                 val.style.display = "block";
            }
    }


    // CSS/Display Related
    // *******  set_bg_sizes('number of related on the view') *********
    // retrieves information from about "" and related on the view divs' heights and positions 
    //to size and position the transparent bgs correctly.
    function set_bg_sizes(rotv_count) {
		
        var count = (rotv_count)?parseInt(rotv_count):0;
		
        var content = $("about_content");
        var bg = $("about_bg");	
        var bg2 = $("about_bg_inner");

        //Defines height and top for About Roller
        bg.style.height = content.offsetHeight+30+"px";
        bg2.style.height = content.offsetHeight+10+"px";
        //bg.style.left = content.style.left+"px";
        bg.style.top = (content.offsetTop-10)+"px";
        
        // Defines height and top for related to the view section.
        for ( i=1; i<=count; i++ ) {
            content = $("rotv_content_"+i);
            bg =  $("rotv_bg_"+i);
            bg2 =  $("rotv_bg2_"+i);
            //alert("rotv_bg_"+i)
            bg.style.height = content.offsetHeight+25+"px";
            bg2.style.height = content.offsetHeight+5+"px";
            bg.style.top = (content.offsetTop-7)+"px";
            //alert (bg.style.height)
        }
    }

    //function editor_viewall (maxheight ) { 
    function section_viewall (maxheight ,contentObj , bgObj, minheight ) { 
        if (maxheight == null ) { 
           return; 
        } 

       //$('bg_editor').style.height = maxheight + 'px';   
       //$('editor_ul').style.height = maxheight + 'px';   

        var offsetH = $(contentObj).offsetHeight ; 

        if (offsetH > minheight  ) { 
            maxheight = minheight ; 
           
        }

       $(bgObj).style.height = maxheight + 'px';   
       $(contentObj).style.height = maxheight + 'px';   
    }
		
		
