function hoverLink(src,hoverClass)
{
    AppendToClassName(src,hoverClass);

}

function unhoverLink(src,hoverClass)
{
    RemoveClassName(src,hoverClass);

} 
    
 function showPicture(popImageUrl) 
    {
  //  alert(popImageUrl);
        src=window.event.srcElement;
      
        imgUrl=src.src.replace("tm_","");
        url=popImageUrl + "?" + imgUrl;
  //      alert(url);
        _top=screen.availHeight-50;
        _left=screen.availWidth-50;
     //   p=window.createPopup();
     //   pBody=p.document.body;
     //   pBody.innerHTML = "<DIV>This is a popup.</DIV>";
         // Parameters of the show method are in the following order: x-coordinate,
    // y-coordinate, width, height, and the element to which the x,y 
    // coordinates are relative. Note that this popup object is displayed
    // relative to the body of the document.

        //p.show(15, 150, 50, 50, document.body);
    //    p.show(100,100,100,100,document.body);
         
        window.open(url,null,"height=100,width=100,top=" + _top + ",left=" + _left + ",resizable=yes");
    
    }
    
    
    
     //popups upload dialog,which uploads file and updates imgTextBox by return
     //пишем абс. урл, надо будет обновить при аплоаде
function uploadPicture(controlID,table) {
    window.open (cfg['applicationRoot'] + "popup.aspx?ControlID=" + controlID + '&table=' + table ,null,"height=150px,width=400px");
}
	
function deletePicture(hiddenFieldID) {

    hiddenField =window.document.getElementById(hiddenFieldID);
    hiddenField.value='';
    
    img =window.document.getElementById(hiddenFieldID + '_Display');
    img.src= cfg['applicationRoot'] + 'images/defaultPic.jpg';

}
    
    
    
//лучше прятать пустые имиджи локально, т.е., по месту темплаты    
function hideEmptyImages(containerID)
{
    
    var container=document.getElementById(containerID);
    var images=container.getElementsByTagName('IMG');
    for (i=0;i<images.length;i++)
    {
       // debug;
        if (images[i].src.lastIndexOf('upload/')==(images[i].src.length-7)) {
            images[i].style.width='0px';
            images[i].style.height='0px';
            images[i].style.display='none';
        }
    }
    
}

//прячет имидж если он пуст
function hideEmptyImage(id)
{
    
    var image=document.getElementById(id);
    if (image.src.lastIndexOf('upload/')==(image.src.length-7)) {
        image.style.width='0px';
        image.style.height='0px';
        image.style.display='none';

    }

}


//videoContainerID - это содержащий видео див
//imgId содержащийся в нем имид
function hideEmptyVideo(videoContainerID,videoId)
{
    
    var container=document.getElementById(videoContainerID);
    var video=document.getElementById(videoId);
    if (video.innerHTML.indexOf('VALUE="JBvideo.swf?flvURL="')>-1) {
        container.style.width='0px';
        container.style.height='0px';
        container.style.display='none';
    }

}




    
//фция для обновления картинки в админе после аплоада. должна еще смотреть, если это флэш - то ставтьи объект для флэша
function updatePicture(openerClientID,imageUrl,uploadDir)
{

    if (uploadDir.charAt(uploadDir.length-1)!='/')
            uploadDir +='/';
                
    //это скрытое поле
    window.opener.document.getElementById(openerClientID).value= imageUrl;
    if (imageUrl.substr(imageUrl.length-3)=='swf') 
    {
    
        //флэш объект - если уже есть - то заменить видео, если нет - то создать
        var flash=window.opener.document.getElementById(openerClientID + '_Display');
        
        
        if (flash.tagName=='OBJECT')
        {
            flash.movie=uploadDir + imageUrl;
            flash.src=uploadDir + imageUrl;
            
        } else {
            
         
            buf= '<OBJECT id=' + flash.id;
            buf += ' codeBase=http://fpdownload.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0 ';
            buf += ' height=50 width=200 align=middle classid=clsid:d27cdb6e-ae6d-11cf-96b8-444553540000>';
            buf += ' <PARAM NAME=\"_cx\" VALUE=\"5292\">';
            buf += ' <PARAM NAME=\"_cy\" VALUE=\"1323\">';
            buf += ' <PARAM NAME=\"FlashVars\" VALUE=\"\">';
            buf += ' <PARAM NAME=\"Movie\" VALUE=\"' + uploadDir + imageUrl + '\">';
            buf += ' <PARAM NAME=\"Src\" VALUE=\"'  + uploadDir + imageUrl + '\">';
            buf += ' <PARAM NAME=\"WMode\" VALUE=\"Window\">';
            buf += ' <PARAM NAME=\"Play\" VALUE=\"-1\">';
            buf += ' <PARAM NAME=\"Loop\" VALUE=\"-1\">';
            buf += ' <PARAM NAME=\"Quality\" VALUE=\"High\">';
            buf += ' <PARAM NAME=\"SAlign\" VALUE=\"\">';
            buf += ' <PARAM NAME=\"Menu\" VALUE=\"-1\">';
            buf += ' <PARAM NAME=\"Base\" VALUE=\"\">';
            buf += ' <PARAM NAME=\"AllowScriptAccess\" VALUE=\"sameDomain\">';
            buf += ' <PARAM NAME=\"Scale\" VALUE=\"ShowAll\">';
            buf += ' <PARAM NAME=\"DeviceFont\" VALUE=\"0\">';
            buf += ' <PARAM NAME=\"EmbedMovie\" VALUE=\"0\">';
            buf += ' <PARAM NAME=\"BGColor\" VALUE=\"E1E7F3\">';


            buf += '<PARAM NAME=\"SWRemote\" VALUE=\"\">';
            buf += '<PARAM NAME=\"MovieData\" VALUE=\"\">';
            buf += ' <PARAM NAME=\"SeamlessTabbing\" VALUE=\"1\">';
            buf += ' <PARAM NAME=\"Profile\" VALUE=\"0\">';
            buf += ' <PARAM NAME=\"ProfileAddress\" VALUE=\"\">';
            buf += ' <PARAM NAME=\"ProfilePort\" VALUE=\"0\">';
            buf += ' <PARAM NAME=\"AllowNetworking\" VALUE=\"all\">';
            buf += ' <PARAM NAME=\"AllowFullScreen\" VALUE=\"false\">';

						
		    buf +='<embed src=\"' + uploadDir + imageUrl + '\"';
		    buf += ' quality = \"high\"   bgcolor = \"#e1e7f3\"  Width = \"200px\"';
		    buf += '  Height = \"50px\"	 ';
		    buf += '  align = \"middle\"	 allowScriptAccess = \"sameDomain\" ';
		    buf += '  Type = \"application/x-shockwave-flash\"'; 
		    buf += ' pluginspage=\"http://www.macromedia.com/go/getflashplayer\" />';
		    buf += ' </OBJECT>';

     
            flash.outerHTML=buf;    
                
        
        }
                
    } else {
        //имидж = если есть - заменить имидж, если нет то создать
        var img= window.opener.document.getElementById(openerClientID + '_Display')
        if (img.tagName=='IMG')
        {
            img.src=uploadDir + 'tm_' + imageUrl;
            
        } else {
            
            img.outerHTML='<img id=' + img.id + ' border=0 src=\"' + uploadDir +'tm_' +  imageUrl + '\"/>';
            
        }
        
    
    }
    
}    
    
                            

