// JavaScript Document

function addElement(parent) {
  	var ni = document.getElementById(parent);
	var numi = document.getElementById('theValue');
  	var num = (numi.value -1)+ 2;
	numi.value = num;
  	var newdiv = document.createElement('div');
  	var divIdName = parent + num;
  	newdiv.setAttribute('id',divIdName);
	newdiv.setAttribute('class','browseImage');
  	newdiv.innerHTML = '<input type="file" name="img[]" /><br/><a href="javascript:;" onclick="removeElement(\''+parent+'\',\''+divIdName+'\')">Sterge element</a>';
  	ni.appendChild(newdiv);
}

function removeElement(parent,divNum) {
	var d = document.getElementById(parent);
  	var olddiv = document.getElementById(divNum);
  	d.removeChild(olddiv);
}

function win(url,width,height) {
	//if (width == '') { var width = 700; }
	//if (height == '') { var height = 450; }
	//var el = document.getElementById("conf");
	//el.style.width = document.documentElement.clientWidth + 'px';
	//el.style.height = document.documentElement.clientHeight + 'px';
	width = document.documentElement.clientWidth;
	height = document.documentElement.clientHeight;
	mywindow = window.open("" + url + "","ww","menubar=0,location=0,status=0,scrollbars=1,width="+ width +",height="+ height +"");
}

function confirmation(msg,url) {
	var answer = confirm(""+msg+"")
	if (answer){
		window.location = ""+url+"";
	}
}

function s(Id) {
	$(""+Id+"").show();
}

function h(Id) {
	$(""+Id+"").hide();
}

function drop(Id) {
	$(""+Id+"").DropToggleDown(500, null, 'easein');	
}

function slide(Id) {
	$(""+Id+"").slideDown("slow");
}

function grow(Id) {
	$(""+Id+"").Grow("slow");
}

function shrink(Id) {
	$(""+Id+"").Shrink("slow");
}

function show(Id,State) {
	if (State == "1") {
		$(""+Id+"").fadeIn("slow");
	}
	if (State == "0") {
		$(""+Id+"").hide("slow");
	}
}
