plugins/gallery/gallery-bits.js
changeset 42 7c6e2e97aa08
parent 10 b38afb86dcad
equal deleted inserted replaced
41:0944c9354e9c 42:7c6e2e97aa08
     2  * Misc functions for Snapr.
     2  * Misc functions for Snapr.
     3  */
     3  */
     4 
     4 
     5 function gal_toggle(elem, img, img_open, img_close)
     5 function gal_toggle(elem, img, img_open, img_close)
     6 {
     6 {
     7   if ( !img_close || !img_open )
     7 	if ( !img_close || !img_open )
     8   {
     8 	{
     9     img_close = scriptPath + '/plugins/gallery/toggle-closed.png';
     9 		img_close = scriptPath + '/plugins/gallery/toggle-closed.png';
    10     img_open  = scriptPath + '/plugins/gallery/toggle-open.png';
    10 		img_open  = scriptPath + '/plugins/gallery/toggle-open.png';
    11   }
    11 	}
    12   if ( elem.style.display == 'none' || !elem.style.display )
    12 	if ( elem.style.display == 'none' || !elem.style.display )
    13   {
    13 	{
    14     elem.style.display = 'block';
    14 		elem.style.display = 'block';
    15     try {
    15 		try {
    16       img.src = img_open;
    16 			img.src = img_open;
    17     } catch(e) {};
    17 		} catch(e) {};
    18   }
    18 	}
    19   else
    19 	else
    20   {
    20 	{
    21     elem.style.display = 'none';
    21 		elem.style.display = 'none';
    22     try {
    22 		try {
    23       img.src = img_close;
    23 			img.src = img_close;
    24     } catch(e) {};
    24 		} catch(e) {};
    25   }
    25 	}
    26 }
    26 }
    27 
    27 
       
    28 function gal_unset_radios(name)
       
    29 {
       
    30 	var radios = document.getElementsByTagName('input');
       
    31 	for ( var i = 0; i < radios.length; i++ )
       
    32 	{
       
    33 		var radio = radios[i];
       
    34 		if ( radio.name == name )
       
    35 		{
       
    36 			radio.checked = false;
       
    37 		}
       
    38 	}
       
    39 }
    28 
    40