/* ***********************************************************************
   @Nazwa:   /js/main.js
   @Autor:   Tomasz Łabacki
   @Email:   tomasz@labacki.com
   @www:     http://labacki.com
   @Data:    28 sep 2010, 20:19
   @Opis:    Elementary javascripting
   @License: Licensed to Agencja Reklamowa MiroArt (http://miroart.pl)
   @Require: jQuery 1.4 or above
   @Language: PL
*********************************************************************** */
$j(window).load(function(){  //wykonanie po kompletnym wczytaniu okna
    popraw_img();           //uzupełnienie brakujących atrybutów width i height
    wyrownaj_menu();
    wyrownaj_opis();
});

function popraw_img(){
    var width, height;
    $j("img").each(function(index,elem){
            width=$j(elem).attr("width");
            height=$j(elem).attr("height");
            if(width===undefined) {$j(elem).attr("width",$j(elem).width());}
            if(height===undefined) {$j(elem).attr("height",$j(elem).height());}
    });
}

function wyrownaj_menu(){
    var content_bg=$j("div#content_bg").height();
    var content_left=$j("div#content_left").height();
    var max=Math.max(content_bg,content_left);

    if(content_left<max) $j("div#content_left").css("height",max);
}

function wyrownaj_opis(){
    var offer_desc_contact=$j("div#offer_desc_contact").height();
    var offer_desc_map=$j("div#offer_desc_map").height();
    var max=Math.max(offer_desc_contact,offer_desc_map);
    $j("div#offer_desc_contact,div#offer_desc_map").css("height",max);
}

function input_text(id,text){
var el=document.getElementById(id);
switch (el.value)
	{
	case text:el.value="";break;
	case "":el.value=text;break;
	default:;
	}
}

