﻿//same-height, ...
//$(document).ready(function($){
//	$(function(){
//		$('div.two-columns > div.fixed-left-column, div.three-columns > div.fixed-left-column').each(function(){
//			$('div.elastic-column', this.parentNode).css('margin-left', $(this).css('width'))
//		});
		
//		$('div.two-columns > div.fixed-right-column, div.three-columns > div.fixed-right-column').each(function(){
//			$('div.elastic-column', this.parentNode).css('margin-right', $(this).css('width'))
//		});
		
//		$('div.same-height').each(function(){
//			var height = $(this).outerHeight(true) - ( $(this).outerHeight(true) - $(this).height() );
//			$('> div', this).each(function(){
//				$(this).css('min-height', height);
//			});
//		});
		
//		$('div.full-height').each(function(){
//			$(this).css('min-height', $(this.parentNode).height() - ( $(this).outerHeight(true) - $(this).height() ));
//		});
//	});
//});

//Tooltip
$(document).ready(function($){
    $(function(){
	    $('[rel*="tooltipText"]').tooltip({ 
            track: true, 
            delay: 0, 
            showURL: false, 
            showBody: " - ", 
            fade: 250 
        })

        $('[rel*="tooltipImg"]').tooltip({
            track: true,
            delay: 0, 
            showURL: false, 
            bodyHandler: function() { 
                return $("<img/>").attr("src", $(this).attr("rel").replace('tooltipImg,', '')); 
            } 
        })
    });
});

//limit text area length
function limitChars(textid, limit, infodiv, language)
{
    var text = $('#' + textid).val();
    var textlength = text.length;
    if(textlength > limit)
    {
    switch(language)
    {
    case 'fr':
    $('#' + infodiv).html('Maximum ' + limit + ' caractères!');
    break;
    case 'nl':
    $('#' + infodiv).html('Maximaal tekens ' + limit + ' !');
    break;
    case 'en':
    $('#' + infodiv).html('Maximum ' + limit + ' characters!');
    break;
    case 'de':
    $('#' + infodiv).html('Maximum ' + limit + ' Zeichen!');
    break;
    case 'es':
    $('#' + infodiv).html('Maximum ' + limit + ' characters!');
    break;
    default:
    $('#' + infodiv).html('Maximum ' + limit + ' characters!');
    break;
    }        
    $('#'+textid).val(text.substr(0,limit));
    return false;
    }
    else
    {
    switch(language)
    {
    case 'fr':
    $('#' + infodiv).html('Il vous reste ' + (limit - textlength) + ' caractères.');
    break;
    case 'nl':
    $('#' + infodiv).html('U heeft ' + (limit - textlength) + ' tekens.');
    break;
    case 'en':
    $('#' + infodiv).html('You have ' + (limit - textlength) + ' characters left.');
    break;
    case 'de':
    $('#' + infodiv).html('Sie haben noch ' + (limit - textlength) + ' Zeichen.');
    break;
    case 'es':
    $('#' + infodiv).html('You have ' + (limit - textlength) + ' characters left.');
    break;
    default:
    $('#' + infodiv).html('You have '+ (limit - textlength) +' characters left.');
    break;
    }       
    return true;
    }
}

function GetXmlHttpObject() {
    var objXmlHttp = null;
	if (navigator.userAgent.indexOf("MSIE") >= 0) {
	    var strName = "Msxml2.XMLHTTP";
		if (navigator.appVersion.indexOf("MSIE 5.5") >= 0) {
		    strName = "Microsoft.XMLHTTP";
		}
		try {
		    return new ActiveXObject(strName);
		}
		catch (e) {
		    alert("Error. Scripting for ActiveX might be disabled");
		    return;
		}
	}
	if (navigator.userAgent.indexOf("Mozilla") >= 0) {
	    return new XMLHttpRequest();
	}
}

function GetJSSessionInfo() {
	var base_href = "";
	var theBase = document.getElementsByTagName("base");

	if (theBase[0] != undefined)
	{
	    base_href = theBase[0].href;
	    if (base_href.substring(base_href.length - 1, base_href.length) != '/') {
	        base_href += "/";
	    }
    }

    var d = new Date();
    var timeZone = -d.getTimezoneOffset() / 60;
    //document.write("The local time zone is: GMT " + timeZone);

    var url = base_href + "JSSessionHandler.ashx?ScreenWidth=" + window.screen.width + "&ScreenHeight=" + window.screen.height + "&TimeZone=" + timeZone;
	var xmlHttp = GetXmlHttpObject();
	xmlHttp.open("GET", url, true);
	xmlHttp.send(null);
}

String.prototype.toTitleCase = function () {
	var A = this.split(' '), B = [];
	for (var i = 0; A[i] !== undefined; i++) {
		B[B.length] = A[i].substr(0, 1).toUpperCase() + A[i].substr(1);
	}
	return B.join(' ');
}

