// JavaScript Document

function addfav()
{
	if (window.sidebar) { // Mozilla Firefox Bookmark
		window.sidebar.addPanel("Produse naturiste Aloe Vera", "http://aloe-vera.way2web.ro/","");
	} else if( window.external ) { // IE Favorite
		window.external.AddFavorite( "http://aloe-vera.way2web.ro/", "Produse naturiste Aloe Vera"); }
}


function print_it_old (id)
{
	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=600,height=600');
//		printWin.document.open ();
		printWin.document.write ('<html><body>');
		printWin.document.write (content);
		printWin.document.write ('</body></html>');
		printWin.document.close ();
		printWin.focus ();
		printWin.print ();
//		setTimeout ('oW.close()', 5000);
	}
}

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://aloe-vera.way2web.ro/css/style.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 ('<div align=\"right\">Sursa: <b>http://aloe-vera.way2web.ro</b></div>');
		printWin.document.write ('</body></html>');
		printWin.document.close ();
		printWin.focus ();
		printWin.print ();

		setTimeout ("", 1000);

		printWin.close();
	}
	return false;
}

function popup2(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.scrollHeight/2;
			       offwidth = document.getElementsByTagName('html')[0].offsetWidth;
			       offheight = document.getElementsByTagName('html')[0].scrollHeight;
				}

				// older versions of IE

				else
				{
			       
				   viewportwidth = document.getElementsByTagName('html')[0].clientWidth;
			       viewportheight = document.getElementsByTagName('html')[0].scrollHeight;
				   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("fast", 0.50 ,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();

			}
