function mga_body_onload()
{
/*
 vscroller_init('featured'); //init the vertical scroller
 //init the content vertical scrollbar
 myScrollbar1 = new MyScrollBar( 'myScrollbar1', 'myScrollBar1TD', 'content_div', 'scrollup', 'scrolldown' );
 */
}
function popup( adr, w, h ) {
    var dlg = window.open( adr, "send_mail",
                  "toolbar=no,menubar=no,personalbar=no,width="+w+",height="+h+",left=40,top=120" +
                  "scrollbars=no,resizable=no");
}

function popups( addr )
{
   window.open( addr , '',
   "status=no,toolbar=no,menubar=no,personalbar=no,width=360,height=400,left=20,top=40" +
                  ",scrollbars=no,resizable=no");
}

function cssGetValue( str )
{
  return new Number (str.replace('px', ''));
}

var debug_window;
function debug_write( msg ) {
if ( !debug_window)
 debug_window = window.open('','',"status=no,toolbar=no,menubar=no" +
                                  ",personalbar=no,width=360,height=400,left=20,top=40" +
                                  ",scrollbars=yes,resizable=yes");
debug_window.document.write( msg + '</br>');
}

if (document.images)
   {
     pic1on= new Image(26,26);
     pic1on.src="/images/cart_add_hover.gif";  
     pic2on= new Image(26,26);
     pic2on.src="/images/recommand_hover.gif"; 
     pic3on= new Image(26,26);
     pic3on.src="/images/cart_view_hover.gif"; 
     pic4on= new Image(26,26);
     pic4on.src="/images/sugestii_hover.gif"; 

     pic1off= new Image(26,26);
     pic1off.src="/images/cart_add.gif";
     pic2off= new Image(26,26);
     pic2off.src="/images/recommand.gif"; 
     pic3off= new Image(26,26);
     pic3off.src="/images/cart_view.gif"; 
     pic4off= new Image(26,26);
     pic4off.src="/images/sugestii.gif"; 
   }
   
function lightup(imgName)
 {
   if (document.images)
    {
      imgOn=eval(imgName + "on.src");
      document[imgName].src= imgOn;
    }
 }

function turnoff(imgName)
 {
   if (document.images)
    {
      imgOff=eval(imgName + "off.src");
      document[imgName].src= imgOff;
    }
 }



// return the value of the radio button that is checked
// return an empty string if none are checked, or
// there are no radio buttons
function getCheckedValue(radioObj) {
	if(!radioObj)
		return "";
	var radioLength = radioObj.length;
	if(radioLength == undefined)
		if(radioObj.checked)
			return radioObj.value;
		else
			return "";
	for(var i = 0; i < radioLength; i++) {
		if(radioObj[i].checked) {
			return radioObj[i].value;
		}
	}
	return "";
}

// set the radio button with the given value as being checked
// do nothing if there are no radio buttons
// if the given value does not exist, all the radio buttons
// are reset to unchecked
function setCheckedValue(radioObj, newValue) {
	if(!radioObj)
		return;
	var radioLength = radioObj.length;
	if(radioLength == undefined) {
		radioObj.checked = (radioObj.value == newValue.toString());
		return;
	}
	for(var i = 0; i < radioLength; i++) {
		radioObj[i].checked = false;
		if(radioObj[i].value == newValue.toString()) {
			radioObj[i].checked = true;
		}
	}
}




function validate_fara_masuri(){

  var f = document.forms.formular;
  
  if ( f.color!= undefined && !getCheckedValue(f.color) )	   
  {
     alert("Alegeti materialul!");
	  return false;
  }
      
  if ( !f.inaltime.value)
  {       
       alert('Specificati inaltimea!');
       f.inaltime.focus();       
       return false;
  }  
  return true;
  
  }	

function validate(){

  var f = document.forms.formular;
  
  if(!getCheckedValue(f.masura)){// nici un radio - masura - selectat(a)
    alert("Indicati masura!");
    return false;}
  else{
    if ( f.circumferinta_bust.selectedIndex == 0 ){
      alert("Indicati circumferinta bust");
      f.circumferinta_bust.focus();               
      return false;
      }
    if ( f.circumferinta_talie.selectedIndex == 0 ){
      alert("Indicati circumferinta talie");
      f.circumferinta_talie.focus();               
      return false;
      }
    if ( f.circumferinta_sold.selectedIndex == 0 ){
      alert("Indicati circumferinta sold");
      f.circumferinta_sold.focus();               
      return false;
      }
    }
  if ( f.color!= undefined && !getCheckedValue(f.color) )	   
  {
     alert("Alegeti materialul!");
	  return false;
  }
      
  if ( !f.inaltime.value)
  {       
       alert('Specificati inaltimea!');
       f.inaltime.focus();       
       return false;
  }  
  return true;
  
  }	

  
  function reset_masura()
  {
    var f = document.forms.formular
    var masura = f.masura
    for ( i=0; i<masura.length; i++)
    {
        if ( masura[i].checked )
        {
           masura[i].checked = false;
           break;
        }
    }
    var ultima = masura.length
    masura[6].checked = true;
  }
  
  function reset_dimensiuni(x,y,z)
  {
     var f = document.forms.formular
     f.circumferinta_bust.selectedIndex = x
     f.circumferinta_talie.selectedIndex = y
     f.circumferinta_sold.selectedIndex = z
  }

