function WithoutContent(ss) {
if(ss.length > 0) { return false; }
return true;
}

function WithoutNewContent(ss) {
if(ss.value !== ss.defaultValue) { return false; }
return true;
}


function NoneWithContent(ss) {
for(var i = 0; i < ss.length; i++) {
        if(ss[i].value.length > 0) { return false; }
        }
return true;
}

function NoneWithCheck(ss) {
for(var i = 0; i < ss.length; i++) {
        if(ss[i].checked) { return false; }
        }
return true;
}

function WithoutCheck(ss) {
if(ss.checked) { return false; }
return true;
}

function WithoutSelectionValue(ss) {
for(var i = 0; i < ss.length; i++) {
        if(ss[i].selected) {
                if(ss[i].value.length) { return false; }
                }
        }
return true;
}

function change_vis( obj )
{
  if( navigator.userAgent.indexOf( "MSIE" ) == -1 )
  {
    var o = document.getElementById( obj );
    if( o.style.display == "none" )
    {
      if( o.tagName == "TR" )
        o.style.display = "table-row";
      else
        o.style.display = "block";
    }
    else
      o.style.display = "none";
  }
  else
  {
    if( document.all[obj].style.display == "none" )
      document.all[obj].style.display = "block";
    else
      document.all[obj].style.display = "none";
  }
}  

function set_vis( obj, vis )
{
  if( navigator.userAgent.indexOf( "MSIE" ) == -1 )
  {
    var o = document.getElementById( obj );
    if( vis )
    {
      if( o.tagName == "TR" )
        o.style.display = "table-row";
      else
        o.style.display = "block";
    }
    else
      o.style.display = "none";
  }
  else
  {
    if( vis )
      document.all[obj].style.display = "block";
    else
      document.all[obj].style.display = "none";
  }
}

//Pop-up Window Auto Center
var win= null;
function popWin(mypage,myname,w,h,scroll){
  var winl = (screen.width-w)/2;
  var wint = (screen.height-h)/2;
  var settings  ='height='+h+',';
      settings +='width='+w+',';
      settings +='top='+wint+',';
      settings +='left='+winl+',';
      settings +='scrollbars='+scroll+',';
      settings +='resizable=no';
  win=window.open(mypage,myname,settings);
  if(parseInt(navigator.appVersion) >= 4){win.window.focus();}
}

//functii pentru selectul care muta in sus si in jos optiunile sale
//-----------------------------------------------------------------------------

function in_array(the_value, the_array)
{
	var found = false;
    for (j=0; j<the_array.length; j++)
    {
    	if (the_array[j] == the_value)
    	{
    		found = true;
    		break;
    	}
    }
    return found;
}

/*
function move_up()
{
	var Obj=document.getElementById("ordonare");
  	for (i=0; i<Obj.length; i++)
    {
    	if (Obj.options[i].selected == true && i > 0)
    	{
    		var text = Obj.options[i-1].text;
    		var valoare = Obj.options[i-1].value;
    		
    		Obj.options[i-1].text = Obj.options[i].text;
    		Obj.options[i-1].value = Obj.options[i].value;
    		Obj.options[i-1].selected = true;
			    		
    		Obj.options[i].text = text;
    		Obj.options[i].value = valoare;
    		Obj.options[i].selected = false;
    	}
    }
  
}
function move_down()
{
	var Obj=document.getElementById("ordonare");
	var selectate = new Array();
	var nr = 0;
  	for (i=Obj.length -1 ; i >=0; i--)
    {
    	if (Obj.options[i].selected == true && i < Obj.length-1)
    	{
    		var text = Obj.options[i+1].text;
    		var valoare = Obj.options[i+1].value;
    		
    		Obj.options[i+1].text = Obj.options[i].text;
    		Obj.options[i+1].value = Obj.options[i].value;
    		
    		Obj.options[i].text = text;
    		Obj.options[i].value = valoare;
    		Obj.options[i].selected = false;
    		//alert("i="+i);
    		selectate[nr] = Obj.options[i+1].value;
    		nr++;
    	}
    }
       
   	for (i=0; i<Obj.length; i++)
	{
	   	if (in_array(Obj.options[i].value, selectate))
	   	{
	   		Obj.options[i].selected = true;
	   	}
	}
    
}
function new_order()
{
	var Obj=document.getElementById("ordonare");
	var nr=1;
	var str = "";
	
	for (i=0; i<Obj.length; i++)
    {
    	if (nr>1)
    	{
    		str += "," ;
    	}
    	
    	str += Obj.options[i].value;
    	nr++;
    }
    
    $('ord').value = str;
    
    return true;
}

*/
// JavaScript Document
/*
// ///////////////////////////
// isdefined v1.0
// 
// Check if a javascript variable has been defined.
// 
// Author : Jehiah Czebotar
// Website: http://www.jehiah.com
// Usage  : alert(isdefined('myvar'));
// ///////////////////////////
*/
function isdefined( variable)
{
    return (typeof(window[variable]) == "undefined")?  false: true;
}

function alertSize() 
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	 }
	 window.alert( 'Width = ' + myWidth );
	 window.alert( 'Height = ' + myHeight );
}


//MODAL BOX
function getLeftAndTop( box_width, box_height) 
{
	var myWidth = 0, myHeight = 0;
	if( typeof( window.innerWidth ) == 'number' ) 
	{
		//Non-IE
		myWidth = window.innerWidth;
		myHeight = window.innerHeight;
	} 
	else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) 
	{
	    //IE 6+ in 'standards compliant mode'
	    myWidth = document.documentElement.clientWidth;
	    myHeight = document.documentElement.clientHeight;
	}
	else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) 
	{
	    //IE 4 compatible
	    myWidth = document.body.clientWidth;
	    myHeight = document.body.clientHeight;
	 }
	 
	 if (box_width > myWidth)
	 	box_width = myWidth;
	 	
	 if (box_height > myHeight)
	 	box_height = myHeight;
     myWidth = (parseInt(myWidth) - parseInt(box_width))/2;
	 myHeight = (parseInt(myHeight) - parseInt(box_height))/2;
	 
	 var difference = (50* myHeight)/793;
	 var top = myHeight - difference;
	 
	 return myWidth + "/" + top;
}
//END MODAL BOX


function validateEmail(inValue) {
	var objRegExp = "^([a-zA-Z0-9_]|\\-|\\.)+@(([a-z0-9_]|\\-)+\\.)+[a-z]{2,4}\$";
	var objEmailRegExp = new RegExp(objRegExp);
	return objEmailRegExp.test(inValue.toLowerCase());
}


function checkPhone(objPhone) {
	var basePhone = "";
	var newPhone = "";
	if (objPhone.value.length > 0) {
		var intAllowed = "0123456789";
		for (var i=0;i<objPhone.value.length;i++) {
			for (var j=0;j<intAllowed.length;j++) {
				if (objPhone.value.charAt(i) == intAllowed.charAt(j)) {
					basePhone += objPhone.value.charAt(i);
					break;
				}
			}
		}
		if (basePhone != objPhone.value) {
			return false;
		}
		else return true;
	}
}
