
function accordion() {		
		
//we define two arrays, containing our toggles and divs.
var myDivs = document.getElementsByClassName('helpstretcher');
var myLinks = document.getElementsByClassName('stretchtoggle');

//then we create the effect.
var myAccordion = new fx.Accordion(myLinks, myDivs, {opacity: true});


			
}
	
function init()
	{
		toggle_retailer = new fx.Height('retailer', {duration: 500});
		toggle_retailer.hide();
		
		toggle_service = new fx.Height('servicenav', {duration: 500});
		toggle_service.hide();

		toggle_manufacturer = new fx.Height('manufacturer', {duration: 500});
		toggle_manufacturer.hide();
		
		toggle_photonum2 = new fx.Height('photonum2', {duration: 100});
		toggle_photonum2.hide();		
		toggle_photonum3 = new fx.Height('photonum3', {duration: 100});
		toggle_photonum3.hide();		
		toggle_photonum4 = new fx.Height('photonum4', {duration: 100});
		toggle_photonum4.hide();		
		toggle_photonum5 = new fx.Height('photonum5', {duration: 100});
		toggle_photonum5.hide();
		

}

	
function selectall() {
        for (var i=0;i < document.gallery.length;i++) {
                fldObj = document.gallery.elements[i];
                if (fldObj.type == 'checkbox')
                        fldObj.checked = true;
        }
}

function deselectall() {
        for (var i=0;i < document.gallery.length;i++) {
                fldObj = document.gallery.elements[i];
                if (fldObj.type == 'checkbox')
                        fldObj.checked = false;
        }
}


		

function ConfirmDelete(varURL)
{
    if (confirm("Are you sure you want to delete this?"))
    {
        //window.open(varURL, "_top");
        location.href = varURL;
		return true;
    }
    return false; 
}

function ConfirmRemove(varURL)
{
    if (confirm("Are you sure you want to remove this from your favourite pictures?"))
    {
        //window.open(varURL, "_top");
        location.href = varURL;
		return true;
    }
    return false;
}
function pagejump(){
	var temp=document.page.pages.value;
 	window.location=temp;
}
function pagejump2(){
	var temp=document.page2.pages2.value;
 	window.location=temp;
}


function toggleLayer(whichLayer)
{
	if (document.getElementById)
	{
		// this is the way the standards work
		var style2 = document.getElementById(whichLayer).style;
		style2.display = style2.display? "":"block";
	}
	else if (document.all)
	{
		// this is the way old msie versions work
		var style2 = document.all[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
	else if (document.layers)
	{
		// this is the way nn4 works
		var style2 = document.layers[whichLayer].style;
		style2.display = style2.display? "":"block";
	}
}


function swapImage(ImName) {

  if (document.images){
        if(document.form.elements){

                if(document.images[ImName].src=="/layout_img/adv-top.gif")
                {
                         document.images[ImName].src="/layout_img/adv-top-on.gif"
                }
                else
                {
                         document.images[ImName].src="/layout_img/adv-top.gif";
                }
        }
     }

}
function textCounter(field,cntfield,maxlimit) {
if (field.value.length > maxlimit) // if too long...trim it!
field.value = field.value.substring(0, maxlimit);
// otherwise, update 'characters left' counter
else
cntfield.value = maxlimit - field.value.length;
}
function getObject(obj) {
  var theObj;
  if(document.all) {
    if(typeof obj=="string") {
      return document.all(obj);
    } else {
      return obj.style;
    }
  }
  if(document.getElementById) {
    if(typeof obj=="string") {
      return document.getElementById(obj);
    } else {
      return obj.style;
    }
  }
  return null;
}

//Contador de caracteres.
function Contar(entrada,salida,texto,caracteres) {
  var entradaObj=getObject(entrada);
  var salidaObj=getObject(salida);
  var longitud=caracteres - entradaObj.value.length;
  if(longitud <= 0) {
    longitud=0;
    texto='<span class="disable"> '+texto+' </span>';
    entradaObj.value=entradaObj.value.substr(0,caracteres);
  }
  salidaObj.innerHTML = texto.replace("{CHAR}",longitud);
}