/*********************
//* jQuery Multi Level CSS Menu (horizontal)- By Dynamic Drive DHTML code library: http://www.dynamicdrive.com
//* Menu instructions page: http://www.dynamicdrive.com/dynamicindex1/ddlevelsmenu/
//* Last modified: Sept 6th, 08'. Usage Terms: http://www.dynamicdrive.com/style/csslibrary/tos/
*********************/

//Specify full URL to down and right arrow images (25 is padding-right to add to top level LIs with drop downs):
var arrowimages={down:['downarrowclass', 'down.gif', 23], right:['rightarrowclass', 'right.gif']}

var jquerycssmenu={

fadesettings: {overduration: 350, outduration: 100}, //duration of fade in/ out animation, in milliseconds

buildmenu:function(menuid, arrowsvar){
	jQuery(document).ready(function($){
		var $mainmenu=$("#"+menuid+">ul")
		var $headers=$mainmenu.find("ul").parent()
		$headers.each(function(i){
			var $curobj=$(this)
			var $subul=$(this).find('ul:eq(0)')
			this._dimensions={w:this.offsetWidth, h:this.offsetHeight, subulw:$subul.outerWidth(), subulh:$subul.outerHeight()}
			this.istopheader=$curobj.parents("ul").length==1? true : false
			$subul.css({top:this.istopheader? this._dimensions.h+"px" : 0})
			$curobj.children("a:eq(0)").css(this.istopheader? {paddingRight: arrowsvar.down[2]} : {}).append(
				'<img src="'+ (this.istopheader? arrowsvar.down[1] : arrowsvar.right[1])
				+'" class="' + (this.istopheader? arrowsvar.down[0] : arrowsvar.right[0])
				+ '" style="border:0; margin-top: -5px;" />'
			)
			$curobj.hover(
				function(e){
					var $targetul=$(this).children("ul:eq(0)")
					this._offsets={left:$(this).offset().left, top:$(this).offset().top}
					var menuleft=this.istopheader? 0 : this._dimensions.w
					menuleft=(this._offsets.left+menuleft+this._dimensions.subulw>$(window).width())? (this.istopheader? -this._dimensions.subulw+this._dimensions.w : -this._dimensions.w) : menuleft
					$targetul.css({left:menuleft+"px"}).fadeIn(jquerycssmenu.fadesettings.overduration)
				},
				function(e){
					$(this).children("ul:eq(0)").fadeOut(jquerycssmenu.fadesettings.outduration)
				}
			) //end hover
		}) //end $headers.each()
		$mainmenu.find("ul").css({display:'none', visibility:'visible'})
	}) //end document.ready
}
}

var mainmenu={
	buildmenu:function(){
		jQuery(document).ready(function($){
			var $menu=$("top-left")
		    var $menu_home=$("#top-left-home")
			var $menu_technology=$("#top-left-technology")
			var $menu_products=$("#top-left-products")
			var $menu_offers=$("#top-left-offers")
			var $menu_portfolio=$("#top-left-portfolio")
			var $menu_contact=$("#top-left-contact")
			var $logo=$("#top-logo-link")
			$menu_home.mouseover(function(e){
				document.getElementById("top-left").style.backgroundPosition = "0px -140px";
			})
			$menu_home.mouseout(function(e){
				document.getElementById("top-left").style.backgroundPosition = "top left";
			})
			$menu_home.click(function(e){
				location.href="index.html";
			})
			$menu_technology.mouseover(function(e){
				document.getElementById("top-left").style.backgroundPosition = "0px -280px";
			})
			$menu_technology.mouseout(function(e){
				document.getElementById("top-left").style.backgroundPosition = "top left";
			})
			$menu_technology.click(function(e){
				location.href="tehnologie.html";
			})
			$menu_products.mouseover(function(e){
				document.getElementById("top-left").style.backgroundPosition = "0px -420px";
			})
			$menu_products.mouseout(function(e){
				document.getElementById("top-left").style.backgroundPosition = "top left";
			})
			$menu_products.click(function(e){
				location.href="produse.html";
			})
			$menu_offers.mouseover(function(e){
				document.getElementById("top-left").style.backgroundPosition = "0px -560px";
			})
			$menu_offers.mouseout(function(e){
				document.getElementById("top-left").style.backgroundPosition = "top left";
			})
			$menu_offers.click(function(e){
				location.href="promotii.html";
			})
			$menu_portfolio.mouseover(function(e){
				document.getElementById("top-left").style.backgroundPosition = "0px -700px";
			})
			$menu_portfolio.mouseout(function(e){
				document.getElementById("top-left").style.backgroundPosition = "top left";
			})
			$menu_portfolio.click(function(e){
				location.href="portofoliu.html";
			})
			$menu_contact.mouseover(function(e){
				document.getElementById("top-left").style.backgroundPosition = "0px -840px";
			})
			$menu_contact.mouseout(function(e){
				document.getElementById("top-left").style.backgroundPosition = "top left";
			})
			$menu_contact.click(function(e){
				location.href="contact.html";
			})
			$logo.click(function(e){
				location.href="index.html";
			})
		}) //end document.ready
	}
}

var productsmenu={
	buildmenu:function(){
		jQuery(document).ready(function($){
			var $menu=$("top-right-menu");
			var $menu_reclame=$("#top-right-reclame");
			var $menu_personalizari=$("#top-right-personalizari");
			var $menu_copertine=$("#top-right-copertine");
			var $menu_inscriptionari=$("#top-right-inscriptionari");
			var $menu_tipografie=$("#top-right-tipografie");
			var $menu_decoratiuni=$("#top-right-decoratiuni");
			var $menu_print=$("#top-right-print");
			var $menu_proiecte=$("#top-right-proiecte");
			$menu_reclame.mouseover(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right -140px";
			})
			$menu_reclame.mouseout(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right top";
			});
			$menu_reclame.click(function(e){
				location.href="reclame.html";
			})			
			$menu_personalizari.mouseover(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right -280px";
			})
			$menu_personalizari.mouseout(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right top";
			});
			$menu_personalizari.click(function(e){
				location.href="personalizari.html";
			})					
			$menu_inscriptionari.mouseover(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right -420px";
			})
			$menu_inscriptionari.mouseout(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right top";
			});
			$menu_inscriptionari.click(function(e){
				location.href="inscriptionari.html";
			})
			$menu_tipografie.mouseover(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right -560px";
			})
			$menu_tipografie.mouseout(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right top";
			});
			$menu_tipografie.click(function(e){
				location.href="tipografie.html";
			})
			$menu_decoratiuni.mouseover(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right -700px";
			})
			$menu_decoratiuni.mouseout(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right top";
			});
			$menu_decoratiuni.click(function(e){
				location.href="decoratiuni.html";
			})
			$menu_proiecte.mouseover(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right -840px";
			})
			$menu_proiecte.mouseout(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right top";
			});
			$menu_proiecte.click(function(e){
				location.href="proiecte.html";
			})
			$menu_print.mouseover(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right -980px";
			})
			$menu_print.mouseout(function(e){
				document.getElementById("top-right-menu").style.backgroundPosition = "right top";
			});
			$menu_print.click(function(e){
				location.href="produse.html";
			})
		}); //end document.ready
	}
}

var order={
	buildorder:function(){
		jQuery(document).ready(function($){
			var $content=$("#content");
			var $products = $("div#content .products-block-info");
			$products.each(function(i){
				var $curobj=$(this);
				$curobj.click(
					function(e){
						var $prod_id=$(this).children(".products-block-info-content");
						var $prodNO = $prod_id.attr("id").substring($prod_id.attr("id").indexOf("-") + 1);
						window.location.href="comanda.html?p=" + $prodNO;
					}
				) //end click
			})
			$("div#content .products-block-projects").click(
				function(e){
					var $prod_id=$(this).children(".products-block-info-content");
					var $prodNO = $prod_id.attr("id").substring($prod_id.attr("id").indexOf("-") + 1);
					window.location.href="comanda.html?p=" + $prodNO;
				}
			) //end click
		})
	}

}

var orderform={
	buildorderform:function(){
		jQuery(document).ready(function($){
			var $chosen = $("#chosen-product .product-name");
			var $ordersContainer = $("#orders-container"); 
			var $message = $("#message");
			var $submit = $("#submit");
			var $productId = jQuery.url.param("p");
			var $productName = "";
			var $iframe = $("#iframe");
			var $formSent = jQuery.url.param("s");
			if($formSent && $formSent == '1'){
				$ordersContainer.html('<div style="text-align: left;"><h4>Comanda a fost trimis&#259; cu succes. V&#259; mul&#355;umim.</h4><p>Accesa&#355;i sec&#355;iunea <a href="produse.html">produse</a> pentru a face noi comenzi.</p></div>');
			}
			if($productId){
				if($productId == "101"){
					$productName = "Mesh";
				}else if($productId == "102"){
				    $productName = "Poliplan Fontlite";
				}else if($productId == "103"){
				    $productName = "Backlite";
				}else if($productId == "104"){
				    $productName = "H&acirc;rtie Blueback";
				}else if($productId == "105"){
				    $productName = "Blockout 2 Fe&#355;e";
				}else if($productId == "106"){
				    $productName = "Autocolant";
				}else if($productId == "201"){
				    $productName = "Litere Volumetrice Plastic";
				}else if($productId == "202"){
				    $productName = "Litere Volumetrice Stiplex";
				}else if($productId == "203"){
				    $productName = "Litere Volumetrice Stiplex";
				}else if($productId == "204"){
				    $productName = "Litere Volumetrice Polistiren";
				}else if($productId == "205"){
				    $productName = "Reclam&#259; Stiplex";
				}else if($productId == "206"){
				    $productName = "Reclam&#259; Stiplex";
				}else if($productId == "207"){
				    $productName = "Totem Neluminos";
				}else if($productId == "208"){
				    $productName = "Totem Luminos";
				}else if($productId == "209"){
				    $productName = "Sistem afi&#351;aj";
				}else if($productId == "301"){
				    $productName = "Tricou POLO personalizat";
				}else if($productId == "302"){
				    $productName = "Tricou alb personalizat";
				}else if($productId == "303"){
				    $productName = "Can&#259; alb&#259; personalizat&#259;";
				}else if($productId == "304"){
				    $productName = "Geant&#259; personalizat&#259;";
				}else if($productId == "305"){
				    $productName = "Mouse Pad personalizat";
				}else if($productId == "306"){
				    $productName = "Tablouri personalizate";	
				}else if($productId == "401"){
				    $productName = "Produs 1";
				}else if($productId == "402"){
				    $productName = "Produs 2";
				}else if($productId == "403"){
				    $productName = "Produs 3";
				}else if($productId == "501"){
				    $productName = "Inscrip&#355;ionare auto";
				}else if($productId == "502"){
				    $productName = "Inscrip&#355;ionare auto";
				}else if($productId == "503"){
				    $productName = "Inscrip&#355;ionare auto";
				}else if($productId == "504"){
				    $productName = "Inscrip&#355;ionare auto";
				}else if($productId == "505"){
				    $productName = "Inscrip&#355;ionare vitrin&#259;";	
				}else if($productId == "506"){
				    $productName = "Inscrip&#355;ionare vitrin&#259;";	
				}else if($productId == "601"){
				    $productName = "Flutura&#351;i";
				}else if($productId == "602"){
				    $productName = "Pliante";
				}else if($productId == "603"){
				    $productName = "C&#259;r&#355;i de vizit&#259;";
				}else if($productId == "604"){
				    $productName = "Afi&#351;e A3";
				}else if($productId == "605"){
				    $productName = "Afi&#351;e A4";
				}else if($productId == "701"){
				    $productName = "Home Sticker decorativ";
				}else if($productId == "702"){
				    $productName = "Tablou decorativ";
				}else if($productId == "703"){
				    $productName = "Folie sablat&#259; decorativ&#259;";
				}else if($productId == "704"){
				    $productName = "Folie sablat&#259; decorativ&#259;";
				}else if($productId == "800"){
				    $productName = "Proiect";
				}else{
					$productName = "Nici un produs nu a fost selectat.";
				}
				$chosen.html($productName);
				if($iframe){
				  $iframe.attr("src", 'comanda_continut.html?p=' + $productId);
				}
				$submit.click(function(e){
					$message.attr("value", "[Produs: " + $productName + "]      " + $message.attr("value"));
					setTimeout(formSent, 4000);
				})
			}
		})
	}
}

function formSent(){
	$url = "comanda.html?s=1";
	parent.location = $url;
}

//build menu with ID="myjquerymenu" on page:
jquerycssmenu.buildmenu("myjquerymenu", arrowimages)
mainmenu.buildmenu()
productsmenu.buildmenu();
order.buildorder()
orderform.buildorderform()
