function addlistType() {
    var val = $('#listtype').val();
    
    if(val == 'new'){
        $('#listtype_div').append('<div style="display:inline;margin-left:10px;"><input type="text" name="listtype_new"></div>');
    }
    
}

function deleteNlI2(counter) {
    elem = document.getElementById("n_li_" + counter);
	elem.parentNode.removeChild(elem);
}

function deletelI2(counter) {
    elem = document.getElementById("li_" + counter);
	elem.parentNode.removeChild(elem);
}


var newMICounter = 0;


$(document).ready(function() {
	//$("#sortable").sortable();

	$(".portitem_overlay").hover(function() {
		$(this).removeClass('portitem_overlay').addClass('partitem_overlayactive');
		classname = $(this).parent().attr('class');
		classname = classname.replace("portitem ","");
		$(".link_"+classname).css("text-decoration", "underline");

	}, function() {
		$(this).removeClass('partitem_overlayactive').addClass('portitem_overlay');
		$(".link_"+classname).css("text-decoration", "none");
	});

	$(".portfoliolinks a").hover(function() {
		$(this).css("text-decoration", "underline");
		classname = $(this).attr('class');
		classname = classname.replace("link_","");
		$("."+classname).children(".portitem_overlay").removeClass('portitem_overlay').addClass('partitem_overlayactive');
	}, function() {
		$(this).css("text-decoration", "none");
		$("."+classname).children("div").removeClass('portitem_overlayactive').addClass('portitem_overlay');
		/*
		$(this).removeClass('partitem_overlayactive').addClass('portitem_overlay');
		$(".link_"+classname).css("text-decoration", "none");
		*/
	});

});
function newPortfolioItem() { 
	showLoading(); 
	$.ajax({
		url: "modules/Portfolio/ajax/newListitem.php?counter=" + newMICounter,
		success: function(data) {

			$("#sortable").append(data); 
			$("#sortable").sortable({
				axis: 'y',
				cursor: 'n-resize'
			});

			//$("#sortable").disableSelection();
			$("#sortable li").hover(
			  function () {
			    $(this).find('.cms_cursor').html('<img src=\"img/icons/arrow_inoutgrey.png\" alt=\"sort\">');
			  },
			  function () {
			    $(this).find('.cms_cursor').html('&nbsp;');
			  }
			);
			hideLoading();
			
		}
	});
	newMICounter++;
}


