

function popitup(url) {
	newwindow=window.open(url,'name','height=550,width=500');
	if (window.focus) {newwindow.focus()}
	return false;
}




function load_upload_objects_categories(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/objects/upload/'+id);
	
}

function delete_image_objects_categories(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/objects/upload/'+cat_id);
	});
}



function load_upload_objects_camera_categories(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/objects/upload_camera/'+id);
	
}

function delete_image_objects_camera_categories(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/objects/upload_camera/'+cat_id);
	});
}



function load_upload_solution_categories(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/solution/upload_solution/'+id);
	
}

function delete_image_solution_categories(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/solution/upload_solution/'+cat_id);
	});
}

function load_upload_avp_categories(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/avp/upload/'+id,null,function(){$('#button_div').show();});
	
}

function load_upload_myfuji_categories(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/myfuji/upload/'+id,null,function(){$('#button_div').show();});
	
}

function delete_image_myfuji_categories(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/myfuji/upload/'+cat_id);
	});
}


function delete_image_avp_categories(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/avp/upload/'+cat_id);
	});
}


function load_upload_avp_education_categories(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/avp/upload_education_categories/'+id);
	
}

function delete_image_avp_education_categories(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/avp/upload_education_categories/'+cat_id);
	});
}


function load_upload_mfp(cat_id,id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/mfp/upload_mfp/'+cat_id+'/'+id);
	
}



function delete_image_mfp(id,mfp_id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/mfp/upload_mfp/'+cat_id+'/'+mfp_id);
	});
}


function load_upload_avp_product(cat_id,id)
{
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/avp/upload_avp_product/'+cat_id+'/'+id,null,function(){$('#button_div').show();});
}
function load_upload_avp_lcd_product(cat_id,id)
{
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/avp/upload_avp_lcd_product/'+cat_id+'/'+id,null,function(){$('#button_div').show();});
}


function load_upload_avp_education_product(cat_id,id)
{
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/avp/upload_avp_education_product/'+cat_id+'/'+id,null,function(){$('#button_div').show();});
}


function delete_image_avp_education_product(id,avp_id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/avp/upload_avp_education_product/'+cat_id+'/'+avp_id);
	});
}



function delete_image_avp_product(id,avp_id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/avp/upload_avp_product/'+cat_id+'/'+avp_id);
	});
}

function delete_image_avp_lcd_product(id,avp_id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/avp/upload_avp_lcd_product/'+cat_id+'/'+avp_id);
	});
}




function delete_image_(id,cameras_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/archive/upload/'+cameras_id);
	});
}

function load_upload_(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/archive/upload/'+id,null,function(){$('#button_div').show();});
	
}

function delete_image(id,cameras_id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/cameras/upload/'+cameras_id+'/'+cat_id);
	});
}

function load_upload(id,categories_id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/cameras/upload/'+id+'/'+categories_id,null,function(){$('#button_div').show();});
	
}

function load_upload_cameras_categories_images(id)
{
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/cameras/upload_cameras_categories_images/'+id,null,function(){$('#button_div').show();});
}


function load_upload_cameras_categories_images(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/cameras/upload_categories_image/'+id);
	
}

function delete_image_cameras_categories(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/cameras/upload_categories_image/'+cat_id);
	});
}

function load_upload_fuji(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/fuji_products/upload/'+id,null,function(){$('#button_div').show();});
	
}

function delete_image_fuji(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/fuji_products/upload/'+cat_id);
	});
}

function delete_image_solution(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/solution/upload/'+cat_id);
	});
}

function load_upload_solution(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/solution/upload/'+id,null,function(){$('#button_div').show();});
	
}


function delete_image_news(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/news/upload/'+cat_id);
	});
}

function load_upload_news(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/news/upload/'+id,null,function(){$('#button_div').show();});
	
}

function load_upload_products(id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/home/upload/'+id);
	
}
function load_upload_paper(paper_id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/paper/upload/'+paper_id);
	
}



function delete_image_products(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/home/upload/'+cat_id);
	});
}

function delete_image_paper(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/paper/upload/'+cat_id);
	});
}

function load_upload_paper_products(products_id)
{
	
	$('#upload_image').html('<img src="/images/admin/ajax_loader.gif" />');
	$('#button_div').hide();
	$('#upload_image').load('/admin/paper/upload_products/'+products_id);
	
}

function delete_image_paper_products(id,cat_id)
{
	$('#upload_image').load(id,null,function()
	{
		$('#upload_image').load('/admin/paper/upload_products/'+cat_id);
	});
}


var contor=0;
function add_image()
{
	
	txt = '<br/><input type="file" name="userfile_'+contor+'"  id="user_file" />';
	$('#upload_input').append(txt);
	contor++;
	
}	

var cont=0;
function add_benefit()
{
	

	txt = '<br/><input type="text" name="benefit_'+cont+'"  id="benefit" />';
	$('#upload_input').append(txt);
	cont++;
	
}	

function add_benefit_()
{
	k=$('#var').val();
	k++;
	$('#var').val(k);
	
	txt = '<br/><input type="text" name="benefit_'+cont+'"  id="benefit" /><br/><textarea name="benefit_'+cont+'"  id="benefit" ></textarea>';
	$('#upload_input').append(txt);
	
	cont++;
}	


function add_fdi_()
{
	k=$('#var1').val();
	k++;
	$('#var1').val(k);
	
	txt = '<br/><input type="text" name="fdi_'+cont+'"  id="fdi" /><br/><textarea name="fdi_'+cont+'"  id="fdi" ></textarea>';
	$('#upload_input').append(txt);
	
	cont++;
}	


function add_overview_()
{
	k=$('#var').val();
	k++;
	$('#var').val(k);
	txt = '<br/><textarea name="overview_'+cont+'"  id="overview" ></textarea>';
	$('#upload_overview').append(txt);
	cont++;
}
var ceva=0
function add_specs_()
{
	k2=$('#var_').val();
	k2++;
	$('#var_').val(k2);
	txt = '<br/><input type="text" name="specs_title_'+ceva+'" id="specs'+ceva+'" /><br/><textarea name="specs_'+ceva+'"  id="specs_'+ceva+'" ></textarea>';
	$('#upload_specs').append(txt);
	ceva++;
}	

var w=0
function add_images_cameras_()
{
	k6=$('#war').val();
	k6++;
	$('#war').val(k6);
	txt = '<br/><textarea name="image_description_'+w+'"  id="image_description_'+w+'" ></textarea><br/><input type="file" name="image_small_'+w+'"  id="image_small" /></textarea><br/><input type="file" name="image_big_'+w+'"  id="image_big" />';
	$('#upload_images_cameras').append(txt);
	w++;
}	

var nr=0
function add_reviews_()
{
	k3=$('#variable').val();
	k3++;
	$('#variable').val(k3);
	txt = '<br/><input type="text" name="reviews_title_'+nr+'" id="specs'+nr+'" /><br/><textarea name="reviews_'+nr+'"  id="reviews_'+nr+'" ></textarea><br/><input type="file" name="reviews_image_'+nr+'"  id="reviews_image" />';
	$('#upload_reviews').append(txt);
	nr++;
}	
function add_overviewimage_()
{
	k3=$('#variable').val();
	k3++;
	$('#variable').val(k3);
	txt = '<br/><input type="file" name="overviews_image_'+nr+'"  id="overviews_image_" />';
	$('#upload_overviewimage').append(txt);
	nr++;
}	

var t=0
function add_soft_()
{
	k4=$('#s').val();
	k4++;
	$('#s').val(k4);
	txt = '<br/><input type="text" name="soft_title_'+t+'" id="soft'+t+'" /><br/><textarea class="mceEditor" name="soft_'+t+'"  id="soft_'+t+'" ></textarea><br/><input type="file" name="soft_exe_'+t+'"  id="soft_exe" />';
	$('#upload_soft').append(txt);
	t++;
}	

var t=0
function add_optional_()
{
	k4=$('#s').val();
	k4++;
	$('#s').val(k4);
	txt = '<br/><input type="text" name="opt_title_'+t+'" id="opt'+t+'" /><br/><textarea class="mceEditor" name="opt_'+t+'"  id="opt_'+t+'" ></textarea>';
	$('#upload_opt').append(txt);
	t++;
}	

var t=0
function add_tips_()
{
	k4=$('#s').val();
	k4++;
	$('#s').val(k4);
	txt = '<br/><input type="text" name="tips_title_'+t+'" id="tips'+t+'" /><br/><textarea class="mceEditor" name="tips_'+t+'"  id="tips_'+t+'" ></textarea>';
	$('#upload_tips').append(txt);
	t++;
}	

var t=0
function add_fdi_()
{
	k4=$('#m').val();
	k4++;
	$('#m').val(k4);
	txt = '<br/><input type="text" name="fdi_title_'+t+'" id="fdi'+t+'" /><br/><textarea class="mceEditor" name="fdi_'+t+'"  id="fdi_'+t+'" ></textarea>';
	$('#upload_fdi').append(txt);
	t++;
}	


var p=0
function add_mac_()
{
	k6=$('#m').val();
	k6++;
	$('#m').val(k6);
	txt = '<br/><input type="text" name="mac_title_'+p+'" id="mac'+p+'" /><br/><textarea class="mceEditor" name="mac_'+p+'"  id="mac_'+p+'" ></textarea><br/><input type="file" name="mac_exe_'+p+'"  id="mac_exe" />';
	$('#upload_mac').append(txt);
	p++;
}	


var z=0
function add_manual_()
{
	k5=$('#b').val();
	k5++;
	$('#b').val(k5);
	txt = '<br/><input type="text" name="manual_title_'+z+'" id="manual'+z+'" /><br/><textarea class="mceEditor" name="manual_'+z+'"  id="manual_'+z+'" ></textarea><br/><input type="file" name="manual_pdf_'+z+'"  id="manual_pdf" />';
	$('#upload_manual').append(txt);
	z++;
}	


function print_it (id, width_i)
{
	if (document.getElementById)
	{
		var content = document.getElementById (id).innerHTML;
		/*content = content.substring (0, content.indexOf ('<script')) + content.substring (content.indexOf ('</script>')+9);*/

		var printWin = window.open ('','', 'width='+width_i+',height=800');
		printWin.document.open ();
		printWin.document.write ('<html><head><link rel=\"stylesheet\" type=\"text/css\" href=\"http://www.way2web.ro/css/domenii.css\" /></head><body style=\"background-color:#fff;\">');

// 		printWin.document.write ('<div style="width:1000px; margin:0px auto;">');
		printWin.document.write (content);
// 		printWin.document.write ("</div>");
		printWin.document.write ('</body></html>');
		printWin.document.close ();
		printWin.focus ();
		printWin.print ();

		setTimeout ("", 1000);

		printWin.close();
	}
	return false;
}

function wopen(url, name, w, h)
{
// Fudge factors for window decoration space.
 // In my tests these work well on all platforms & browsers.
w += 32;
h += 96;
 var win = window.open(url,
  name,
  'width=' + w + ', height=' + h + ', ' +
  'location=no, menubar=no, ' +
  'status=no, toolbar=no, scrollbars=yes, resizable=no');
 win.resizeTo(w, h);
 win.focus();
}

function validate_required(field,alerttxt)
{
with (field)
{
if (value==NULL||value=='Nume' && value=='')
  {alert(alerttxt);return false}
else {return true}
}
}



function popup(url, img)
			{
				
				if (typeof window.innerWidth != 'undefined')
 				{
     				viewportwidth = window.innerWidth;
     				viewportheight = window.innerHeight;
					offwidth = document.getElementsByTagName('html')[0].offsetWidth;
			        offheight = document.getElementsByTagName('html')[0].offsetHeight;
				}

				// IE6 in standards compliant mode (i.e. with a valid doctype as the first line in the document)

				else if (typeof document.documentElement != 'undefined' && typeof document.documentElement.clientWidth != 'undefined' && document.documentElement.clientWidth != 0)
				{
			       viewportwidth = document.documentElement.clientWidth;
			       viewportheight = document.documentElement.clientHeight;
			       offwidth = document.getElementsByTagName('html')[0].offsetWidth;
			       offheight = document.getElementsByTagName('html')[0].offsetHeight;
				}

				// older versions of IE

				else
				{
			       viewportwidth = document.getElementsByTagName('html')[0].clientWidth;
			       viewportheight = document.getElementsByTagName('html')[0].clientHeight;
				   offwidth = document.getElementsByTagName('html')[0].offsetWidth;
			       offheight = document.getElementsByTagName('html')[0].offsetHeight;
				}
				if(url!=null)
				{
				$('<div id="overall_page" onclick="cancel_mail()" class="overall_page" style="width:'+offwidth+'px; height:'+offheight+'px" ></div>').appendTo("body");
				}
				else
				{
					$('<div id="overall_page" class="overall_page" style="width:'+offwidth+'px; height:'+offheight+'px" ></div>').appendTo("body");
				}
				$('#overall_page').fadeTo("slow", 0.65 ,function(){
					$('#overall_page').after('<div class="main_panel" id="main_panel"></div>');

			if(url!=null){
					$('#main_panel').load( url , null, function(){
						p_width = document.getElementById('main_panel').offsetWidth;
						p_height = document.getElementById('main_panel').offsetHeight;

						new_width  = viewportwidth/2-p_width/2;
						new_height = viewportheight/2-p_height/2;
						document.getElementById('main_panel').style.top = new_height+'px';
						document.getElementById('main_panel').style.left = new_width+'px';
					});}
			else if(img!=null)
			{
				
						$('#main_panel').html('<div class="loading"> <img src="'+img+'" alt="Loading..."/> </div>');
						p_width = document.getElementById('main_panel').offsetWidth;
						p_height = document.getElementById('main_panel').offsetHeight;

						new_width  = viewportwidth/2-p_width/2;
						new_height = viewportheight/2-p_height/2;
						document.getElementById('main_panel').style.top = new_height+'px';
						document.getElementById('main_panel').style.left = new_width+'px';
				

			}


				});



			}

			function cancel_mail()
			{
				$('#overall_page').remove();
				//$('select').css({visibility: 'visible'});
				$('#main_panel').empty();
				$('#main_panel').remove();

			}

			function submit_mail()
			{
				$('#em_form').ajaxSubmit({ target:        '#main_panel'});
			}


			function hoverOn(message)
			{
				$('.help').empty();
				$('.help').html($('#'+message).html());
			//
			}

			function hoverOff()
			{
				$('.help').empty();

			}


function show_pic(top_0)
{
		if(document.getElementById(top_0).style.display == 'block')
		{
			document.getElementById(top_0).style.display = 'none';
		}
		else if(document.getElementById(top_0).style.display == 'none')
		{
			document.getElementById(top_0).style.display = 'block';
		}
}


function verif()
{
	x=document.getElementById('id_level').value;
	count = $('#userfile_count').val();
	var i;
	
	if(x==' ')
	{
		alert("campul nu este completat");
		$('#id_level').focus();
		return false;
		
	}
	for(i=2;i<count;i++)
	{
		if($('#userfile_'+i).val()=='')
		{
			alert('s');
			$('#userfile_'+i).focus();
			return false;
		}
	}
	return true;
}
	


function setup()
{
	
	tinyMCE.init({
		mode : "textareas",
		theme : "advanced",
		
		editor_selector : "mceEditor",
		editor_deselector : "mceNoEditor",
		force_br_newlines : true,
		plugins : "safari,spellchecker,style,layer,table,save,advhr,advimage,advlink,emotions,iespell,inlinepopups,insertdatetime,preview,media,searchreplace,print,contextmenu,paste,directionality,fullscreen,noneditable,visualchars,nonbreaking,xhtmlxtras,template,pagebreak,imagemanager,filemanager,ibrowser",
		theme_advanced_buttons1_add_before : "save,newdocument,separator",
		theme_advanced_buttons1_add : "fontselect,fontsizeselect",
		theme_advanced_buttons2_add : "separator,insertdate,inserttime,preview,separator,forecolor,backcolor",
		theme_advanced_buttons2_add_before: "cut,copy,paste,pastetext,pasteword,separator,search,replace,separator",
		theme_advanced_buttons3_add_before : "tablecontrols,separator",
		theme_advanced_buttons3_add : "emotions,iespell,media,advhr,separator,print,separator,ltr,rtl,separator,fullscreen,ibrowser",
		theme_advanced_buttons4 : "insertlayer,moveforward,movebackward,absolute,|,styleprops,|,spellchecker,cite,abbr,acronym,del,ins,attribs,|,visualchars,nonbreaking,template,blockquote,pagebreak,|,insertfile,insertimage",
		theme_advanced_toolbar_location : "top",
		theme_advanced_toolbar_align : "left",
		theme_advanced_statusbar_location : "bottom",
		content_css : "/example_data/example_full.css",
	    plugin_insertdate_dateFormat : "%Y-%m-%d",
	    plugin_insertdate_timeFormat : "%H:%M:%S",
		external_link_list_url : "example_data/example_link_list.js",
		external_image_list_url : "example_data/example_image_list.js",
		flash_external_list_url : "example_data/example_flash_list.js",
		template_external_list_url : "example_data/example_template_list.js",
		theme_advanced_resize_horizontal : false,
		theme_advanced_resizing : true,
		apply_source_formatting : true,
		spellchecker_languages : "+English=en,Danish=da,Dutch=nl,Finnish=fi,French=fr,German=de,Italian=it,Polish=pl,Portuguese=pt,Spanish=es,Swedish=sv"
	});
}


	
	
	