
function open_view(sImage,titlu) {
	var sURL = '../view.php?img=' + String(sImage) +'&titlu='+titlu ;
	var imageWin = window.open(sURL, 'imageWin', 'height=420,width=410,scrollbars=1,resizable=1')	
}


function isEMailAddr(elem) {
    var str = elem.value;
    var re = /^[\w-]+(\.[\w-]+)*@([\w-]+\.)+[a-zA-Z]{2,7}$/;
    if (!str.match(re)) {
        return false;
    } else {
        return true;
    }
}

var sErrorFields = '';
var sErrorTexts = '';
function addError(errorText, errorField) {
	sErrorTexts += '   ' + errorText + '\n';
	sErrorFields += errorField + ',';
}
function setFormFocus(f, e) {
	if(e) {
		f.elements[e].focus();
	}
}
function unhighlightErrors(f, s) {
	a = s.split(',');
	if(a.length > 0) {
		for(i = 0; i < (a.length -1); i++) {
			if(a[i].toString().length > 0) { f.elements[a[i]].style.backgroundColor = '#ffffff'; f.elements[a[i]].style.borderColor = ''; }
		}
	}
}
function highlightErrors(f, s) {
	if(s.length > 0) {
		a = s.split(',');
		if(a.length > 0) {
			for(i = 0; i < (a.length -1); i++) {
				if(a[i].toString().length > 0) { f.elements[a[i]].style.backgroundColor = '#ffffff'; f.elements[a[i]].style.borderColor = '#bc4646'; }
			}
			setFormFocus(f, a[0])
		}
	}
}


function checknumber(x){
	var anum=/(^\d+$)|(^\d+\.\d+$)/
	if (anum.test(x))
		return false
	else
		return true
}

   

function emailValid(str) {
	var at="@"
	var dot="."
	var lat=str.indexOf(at)
	var lstr=str.length
	var ldot=str.indexOf(dot)
	if (str.indexOf(at)==-1){ return false}
	if (str.indexOf(at)==-1 || str.indexOf(at)==0 || str.indexOf(at)==lstr){ return false }
	if (str.indexOf(dot)==-1 || str.indexOf(dot)==0 || str.indexOf(dot)==lstr){ return false }
	if (str.indexOf(at,(lat+1))!=-1){ return false }
	if (str.substring(lat-1,lat)==dot || str.substring(lat+1,lat+2)==dot){ return false }
	if (str.indexOf(dot,(lat+2))==-1){ return false }		
	if (str.indexOf(" ")!=-1){ return false }
	return true
}

function openMenuItem2(divon) {
	if ($(divon).style.display!="none"){
		new  Effect.SlideUp($(divon), { duration:0.5 });
	} else {
	new Effect.SlideDown($(divon), { duration:0.5 });
	}

}

function alphanumeric(alphane)
{
	var numaric = alphane;
	for(var j=0; j<numaric.length; j++)
		{
		  var alphaa = numaric.charAt(j);
		  var hh = alphaa.charCodeAt(0);
		  if((hh > 47 && hh<58) || (hh > 64 && hh<91) || (hh > 96 && hh<123))
		  {
		  }
		else	{
			 return false;
		  }
		}
 return true;
}




