
function insertVideo(video){
	var rnd = Math.round(Math.random() * 100000000)
	var id = "v" + rnd
	
	document.writeln("<div id=" + id + "></div>")
	var fo = new SWFObject("images/FlowPlayer.swf", id, "360", "288", "7", "#000000", true);
	fo.addParam("flashVars", "config={loop: false, autoPlay:false,hideControls: false, baseURL: '/Gallery', playList: [ {name:'video', url: '" + video + "' } ] }");
	fo.write(id);
}
function insertAudio(audio){
	var rnd = Math.round(Math.random() * 100000000)
	var id = "a" + rnd
	
	document.writeln("<div id=" + id + "></div>")
	var fo = new SWFObject("images/Mp3Player.swf?clip=/Gallery/" + audio, "mp3162", "188", "58", "7", "#000000", true);
	fo.write(id);
	
}

//09-04-08
function mtChangeImg(idObj,srcImg)
{
    var o = document.getElementById(idObj);
    o.src= "Images/"+srcImg;
}

//09-04-08
function showDiv(Question, divName)
{     
    var object= document.getElementById(Question);
    var objName= document.getElementById('DivName'+ divName);
    
    if(object)
    {       
     if (object.style.display=='block')
     {
        if(objName)
        {
           objName.style.color='#8F8181';
           objName.style.backgroundColor='transparent';     
        }
        object.style.display='none';  
     }
     else
     {
        if(objName)
        {
           objName.style.color='#FFFFFF';
           objName.style.backgroundColor='#E1AB0C';  //#FBB610   
        }
        object.style.display='block';  
     }                        
    }
}

/*function menuscroll_load ()
{
    alert('in');
    if($('mousemove'))
    {
        var scroll2 = new Scroller('mousemove', {area: 150, velocity: 1});
        alert(scroll2); 
        // Mousemove
        $('mousemove').addEvent('mouseover', scroll2.start.bind(scroll2));
        $('mousemove').addEvent('mouseout', scroll2.stop.bind(scroll2));
   }
}
window.addEvent("domready",menuscroll_load);*/

function CommentQuantityLeft(obj, left, length){  
    var Comment = obj;
    var CommentQuantityLeft = document.getElementById(left);								
    				
    //CommentQuantityLeft.innerHTML = length - Comment.value.length;
    CommentQuantityLeft.innerHTML = Comment.value.length;
    if(Comment.value.length>length){
        Comment.value = Comment.value.substring(0,length);
	    //CommentQuantityLeft.innerHTML = length - Comment.value.length;
	    CommentQuantityLeft.innerHTML = Comment.value.length;
    }
}

function checkOpen(obj)
{
    var control = obj;
    var label = document.getElementById('lblError');
    if (control.checked)
    {
        label.style.display = 'none';
    }
}
function openWindow(url, title)
{
    return window.open(url,title,'width=600 height=700 scrollbars=yes');
}

function controlCheck()
{
    var label = document.getElementById('lblError');
    var obj = document.getElementById('ckkConforme');
    
    if (obj)
    {
        if (!obj.checked)
        {
            label.style.display = 'block';
            return false;
        }
        else
            label.style.display = 'none';
    }
    return true;
}

var sliding=false;
var ctimeout;
function SlideUp(parentid,id,speed)
{
    sliding=true;
    Slide(parentid,id,speed,1);
}

function SlideDw(parentid,id,speed)
{
    sliding=true;
    Slide(parentid,id,speed,-1);
}

function Slide(parentid,id,speed,dir)
{
    if(sliding)
    {
        var parent=document.getElementById(parentid);
        var object=document.getElementById(id);
        if(object && parent)
        {
            var diference=0
            if(dir==-1)
            {
                
                diference=Number(parent.offsetWidth) - Number(object.offsetWidth); //-> para up dw es offsetHeight -SE agrega +20 por los margenes laterales del container
                //alert('parent: ' + parent.offsetWidth + ' object: ' + object.offsetWidth + ' dif-1: ' + diference) 
                if(diference>0)
                {
                    diference=0;
                }
            }
            //alert('dif: ' + diference);        
            if(!object.style.left)
            {   
                object.style.left="0px";
            }
            if(object.style.left)
            { 
                var s= new String(object.style.left); //alert('left: ' + s);
                s=s.replace(/px/g,'');
                var left=Number(s)*dir*-1;
                //alert('dif: ' + diference + ' left:' + top);
                if(left>diference) //-> para up dw es top<=diference
                {   
                    object.style.left=(Number(s)+Number(speed*dir))+'px';                    
                }
                 else
                    if (left<0)
                    {
                        object.style.left="0px";
                    }
                    else
                    {
                        diference=Number(parent.offsetWidth) - Number(object.offsetWidth);
                        object.style.left=diference + "px";
                    }
            }
        }
        ctimeout=window.setTimeout("Slide('"+parentid+"','"+id+"',"+speed+","+dir+");",33);
    }
    
}

function SlideStop(id)
{
    window.clearTimeout(ctimeout);
    sliding=false;
    ctimeout=null;
    
}
