var applycook=document.getElementsByTagName('*');
for(var cook=0; cook < applycook.length; cook++){
	var newclass=getCookie(applycook[cook].id+'_style');
	var display=getCookie(applycook[cook].id+'_display');
	if(newclass.length > 0 && applycook[cook].id+'_style'!=='_style')applycook[cook].className=newclass;
	if(display.length > 0 && (applycook[cook].id=='menformular' || applycook[cook].id=='menarhiva')){}
	if(display.length > 0 && (applycook[cook].id.match('mainsubcontent') || applycook[cook].id.match('mainsubcontent'))){}
	else if(display.length > 0 && applycook[cook].id!==''){applycook[cook].style.display=display;}
	}
if(existtag('a','alink')){
	var removehref=entireTag('a','alink');
	for(ahr=0; ahr < removehref.length; ahr++ ){
		if(element(removehref[ahr]).getAttribute('type')=='folder')element(removehref[ahr]).href='javascript:void(0)';
		else eventRemove(element(removehref[ahr]),"onclick",'');
	}
}
if(existtag('div','folder'))outputType('folder');
if(existtag('div','file'))outputType('articole');
if(existtag('div','folder') && document.location.href.match('imagini'))outputType('image');
if(document.location.href.match('/fisiere'))outputType('file');
document.onmousemove = getMouseXY;
if(existtag('div','accordion')){
// Functie armonica
	$(function() {
			$("#accordion").accordion({ autoHeight: false});
		});
}

$(document).ready(function () {
	var men=$('div.folder');
	var den=false;
	for(xi=0; xi < men.length; xi++){
		if(men[xi].style.display=='block')den=true;
		}
	if(!den)$('div#menoff').css("display","block");
	$('.ascPrice').button();
	$('#openfilter').button();
	$('#homebtn').button();
	$('.login .form input.button').button();
	$('button').button();
	$formularA="Completati formularul pentru a primi informatii pe mail<hr><table style='margin-top:30px;'><tr><td>Nume/Preunue</td><td><input type='text' class='forA'></td></tr><tr><td>Email</td><td><input type='text'  class='forA'></td></tr><tr><td>Telefon</td><td><input type='text' class='forA'></td></tr></table>";
	$('.ascPrice').click(function(){
		$.confirm({
			height:300,
			title:"Cerere cotatie de pret",
			text:$formularA,
			text_true:"Send",
			ontrue:function(){
			  //$('input').each(function(i){alert($(this).val());})
			}
		});
	});
	
	if(document.location.href.match('/admin')){
		$('input[name="radioDom"]').each(function(){
			if($(this).val().match($.cookie('radioDom'))){//alert($(this).val());
				$(this).attr('checked',true);
				$(this).click();
			}
		});
	}
$('img.openimg').each(function(){
	var src=$(this).attr('src');
	if(src.match('img.php')){
		var pice=src.split('?');
		pice=pice[1].split('&');
		pice=pice[0].split('=');
		$(this).attr('src','/'+pice[1]);
	}
	$(this).attr("onclick","");
	});
$('img.openimg').click(function(){
	var tit='';
	if($(this).attr('title')!=='')tit=$(this).attr('title');
	else if($(this).attr('alt')!=='')tit=$(this).attr('alt');
	else tit='Afisare imagine';
	
	$('body').append('<div id="imgopen" title="'+tit+'" style="text-align:center;"><img src="'+$(this).attr('src')+'"/></div>');
	$("#imgopen").dialog({
		modal:true,
		width:($('#imgopen>img').width()+44),
		height:($('#imgopen>img').height()+44),
show: "fade",
hide: "drop",
		close:function(){$('#imgopen').dialog('destroy'); $('#imgopen').remove();}
	});
	$("#imgopen").find('img').click(function(){
			//$('#imgopen').effect('slide',{direction:'left',mode:'hide'},500,function(){
//				$('#imgopen').dialog('destroy'); $('#imgopen').remove();
				$('#imgopen').dialog('close');
			//	});
			});
});

});
