$j(document).ready(function(){
          //ajaxSearch();
		//JQuery ready is quicker than onload
		tb_init('a.thickbox, area.thickbox, input.thickbox');//pass where to apply thickbox
                imgLoader = new Image();// preload image
                imgLoader.src = tb_pathToImage;
		 var loading = '<p>loading</p><img src="http://www5.webon.net/webon_ekstranett/frontend/css/loadingAnimation.gif">';
               openPopup();
	   });
	   var choice;
	   function setchoice(selectBox) {
	    var opt = selectBox.options[selectBox.selectedIndex];
	    choice = opt.value;
	    insert_opt("result");
}
jQuery.fn.extend({
  getInputs:function(type){
     if(type){
       return $j(this).children().filter(function(){return $j(this).attr("type")== type;});
     }else{
       return $j(this).children();
     }
  }, 
  ajaxElementsValue: function(){
     var elem = $j(this).getInputs();
     var r='';
     $j(elem).each(function(){r+=this.id+'='+escape(this.value)+"&"});
     return r;
  }
});
function openPopup(){
   var a = $j('a[@rel="popup"]');
       $j(a).click(function(e){
         var url = this.href+'&height=450&width=470&ajax=yes&modal=true';
          tb_show(this.title, url, false);
          $j("#TB_iframeContent").css({overflow:'hidden'});
          $j("#TB_ajaxContent").css({padding:'0px', width:'auto'});
          $j("#TB_overlay").click(function(){ tb_remove(); });
         $j("#TB_ajaxContent").ajaxSuccess(function(){ setTimeout('submitRequest()', 200)  });
          return false;
       });
}
function submitRequest() {
        var f = $j("#tell_friend_form");
        $j("send-mail > *").css({padding:'0px 20px'});
        $j("#tell_friend_form > p, #greyBox_logo").css({padding:'0px'});
        $j("#tell_friend_form > .submit-button input").css({width:'66px',paddingBottom:'5%'});
        tellFriendSubmit();
      
}