

















function dsl_provider_popup() {
    newWindow("/common/empty.html", 'popup', 480, 640, 1, 1, 0, 0, 0, 1, 0);
}


function dsl_forward_popup(tariff, provider, location) {
    var w = screen.width - 80;
	var h = screen.height;
    var targetLink = "/dslweb/forward?_sourcePage=%2FWEB-INF%2Fdsl%2Fjsp%2Fsearch%2Fresult.jsp&tariffId="+ tariff + "&providerId=" + provider + "&location=" + location; 
    newWindow(targetLink, 'forwardPopup', w, h, 1, 1, 1, 1, 1, 1, 0);
}

function dsl_provider2forward_popup(tariff, provider, location) {
    var targetLink = "/dslweb/forward?_sourcePage=%2FWEB-INF%2Fdsl%2Fjsp%2Fsearch%2Fresult.jsp&tariffId="+ tariff + "&providerId=" + provider + "&location=" + location; 
    newWindow(targetLink, 'provider2forwardPopup', getScreenSizeOfParentWindow()[0], getScreenSizeOfParentWindow()[1], 1, 1, 1, 1, 1, 1, 0);
}

function getScreenSize() {  
    
    var myWidth = 0, myHeight = 0;  

    if( typeof( window.innerWidth ) == 'number' ) {  
        //Non-IE  
        myWidth = window.innerWidth;  
        myHeight = window.innerHeight;  
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {  
        //IE 6+ in 'standards compliant mode'  
        myWidth = document.documentElement.clientWidth;  
        myHeight = document.documentElement.clientHeight;  
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {  
        //IE 4 compatible  
        myWidth = document.body.clientWidth;  
        myHeight = document.body.clientHeight;  
    }  
    return [ myWidth, myHeight ];  
} 

function getScreenSizeOfParentWindow() {  
    
    var myWidth = 0, myHeight = 0;  

    if( typeof( window.opener.innerWidth ) == 'number' ) {  
        //Non-IE  
        myWidth = window.opener.innerWidth;  
        myHeight = window.opener.innerHeight;  
    } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {  
        //IE 6+ in 'standards compliant mode'  
        myWidth = document.documentElement.clientWidth;  
        myHeight = document.documentElement.clientHeight;  
    } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {  
        //IE 4 compatible  
        myWidth = document.body.clientWidth;  
        myHeight = document.body.clientHeight;  
    }  
    return [ myWidth, myHeight ];  
} 

function submitCompareForm()
{
	$('#compareAction').submit();
}

var doCompare = {
    jump: function() {
        var tariffCodes = $("input:checkbox[name='comparisonTariffs']");
        var checked = 0;
        for(var i=0; i < tariffCodes.length; i++) {
            if(tariffCodes[i].checked) {
                checked++;
            }
        }

        if(checked > 2 || checked == 0) {
        	this.showError();
          return false;
        }
        $('#compareAction').submit();
        return false;
    },

    showError: function() {
    	if (this.errorVisible) {
    		$("#formValidationErrors_surrounding").fadeOut("fast", function() {
    			$("#formValidationErrors_surrounding").fadeIn("fast");
    		});
    	}
    	else {
	      this.errorVisible = true;
	      $("#formValidationErrors_surrounding").fadeIn();
	      $("#formValidationErrors").append('<li> Bitte w&auml;hlen Sie ein bis zwei Tarife f&uuml;r den Detailvergleich. </li>');
    	}
    },

    errorVisible: false
}


var obj_window;

function newWindow(a_str_windowURL, a_str_windowName, a_int_windowWidth, a_int_windowHeight, a_bool_scrollbars, a_bool_resizable, a_bool_menubar, a_bool_toolbar, a_bool_addressbar, a_bool_statusbar, a_bool_fullscreen) {
  var int_windowLeft = (screen.width - a_int_windowWidth) / 2;
  var int_windowTop = (screen.height - a_int_windowHeight) / 2;
  var str_windowProperties = 'height=' + a_int_windowHeight + ',width=' + a_int_windowWidth + ',top=' + int_windowTop + ',left=' + int_windowLeft + ',scrollbars=' + a_bool_scrollbars + ',resizable=' + a_bool_resizable + ',menubar=' + a_bool_menubar + ',toolbar=' + a_bool_toolbar + ',location=' + a_bool_addressbar + ',statusbar=' + a_bool_statusbar + ',fullscreen=' + a_bool_fullscreen + '';
  obj_window = window.open(a_str_windowURL, a_str_windowName, str_windowProperties)
    if (parseInt(navigator.appVersion) >= 4) {
      obj_window.window.focus();
    }
}

function closePopupWindow() {
	if(obj_window!=null) obj_window.close();
}

function searchSubmit(form) 
{
	// form.action = form.action + '#content_top';
	return true;
}

$(document).ready(function(){
 //here comes sth that we would like to start on page load ("ondocumentload")


//make field focus when page is loaded
$('#startelem').focus();



//IE6 austricksen (:hover f�r nicht "a" elemente)
$('table#dsl_table_resultList tr').hover(function() {
  $(this).css("background", "#E0E1E2");
}, function() {
  $(this).css("background", "");
});



 
 $("span.tooltip, div.tooltip, td.tooltip").Tooltip({
  delay: 0,
  track: true,
  showURL: false
});



//neueinzug event
 	$(".toogleHide").css("display","none");

 	$("div#moveInModalLayer").bgiframe();

 $("input:radio[name='tariffOrderCriteria.clientData.moveIn'][value='true']").click(function()
 {
 	$("div#moveInModalLayer").show();
 });

 $("a[name='moveIn_ja']").click(function()
 {
 	$("div#moveInModalLayer").css("display","none");
 	$(".toogleHide").show();
 });

//hide
 $("a[name='moveIn_nein']").click(function()
 {
	$("div#moveInModalLayer").css("display","none");
 	$(".toogleHide").css("display","none");

 	// deselect the radio button (its true right now)
 	$("input[name='tariffOrderCriteria.clientData.moveIn']")[0].checked = false;
 	$("input[name='tariffOrderCriteria.clientData.moveIn']")[1].checked = true;
 });
//hide
 $("input:radio[name='tariffOrderCriteria.clientData.moveIn'][value='false']").click(function()
 {
 	$(".toogleHide").css("display","none");
 });

 $('input:radio').css({background:"none"});
 $('input:radio').css({border:"none"});
 $('input:checkbox').css({background:"none"});
 $('input:checkbox').css({border:"none"});
 $('input:image').css({border:"none"});

});