var here=window.location.host
var site_url = '';
if (here=='md') {site_url='http://'+here+'/icherisheher';} else {site_url='http://'+here;}
var IE=!!(window.attachEvent && !window.opera);


var setHeight = function(element_id,target_id){
	var col_height = document.getElementById(element_id).clientHeight;
    var prop_height=(Math.ceil(col_height/13))*13;
    padBottom=prop_height-col_height;
    document.getElementById(target_id).style.paddingBottom=padBottom + 'px';
}
   

var getStyle = function (el,styleProp) {
	var x = document.getElementById(el);
	if (x.currentStyle) {
		var y = x.currentStyle[styleProp];
	} else if (window.getComputedStyle) {
		var y = document.defaultView.getComputedStyle(x,null).getPropertyValue(styleProp);
	}
	return y;
   }

search = function () { $('#srch').submit(); }

var searchButtonToLink = function () {
	$('#search_button').replaceWith ( '<a accesskey="'+$('#search_button').attr('accesskey')+'" href="javascript: search();" tabindex="'+$('#search_button').attr('tabindex')+'" title="' + $('#search_button').attr('value') +'">' + $('#search_button').attr('value') +'</a>');
}

var loaded = new Array();

var include = function (script) {
/*	document.write('<script type="text/javascript" src="'+site_url+'/template/js/'+script+'.js"></script>');*/
	$('body').prepend('<script type="text/javascript" src="'+site_url+'/template/js/'+script+'.js"></script>');
}

var isLightBoxScriptsLoaded = function () {
	var lightboxLinks = $("a[rel='lightbox']");
	var biglightboxLinks = $("a[rel='big_lightbox']");
	
	var includes ='';
	if (lightboxLinks.length >= 1 || biglightboxLinks.length >= 1) {
/*		var includes = '<script type="text/javascript" src="'+site_url+'/template/js/prototype.js"></script>';*/

		if (lightboxLinks.length >= 1) {
			includes = includes + '<script type="text/javascript" src="'+site_url+'/template/js/lightbox.js"></script>';
			includes = includes + '<script type="text/javascript" src="'+site_url+'/template/js/lightboxloader.js"></script>';
		}
		
		if (biglightboxLinks.length >= 1) {
			includes = includes + '<script type="text/javascript" src="'+site_url+'/template/js/big_lightbox.js"></script>';
			includes = includes + '<script type="text/javascript" src="'+site_url+'/template/js/big_lightboxloader.js"></script>';
		}
		
		$(document.body).append(includes);
		
		lightboxLinks.each(
			function () {
				var elm = this;
				$(this).click( 
					function () {
						showBox(this);
						return false;
					}
				);
			}
		);
		
		biglightboxLinks.each(
			function () {
				var elm = this;
				$(this).bind('click', 
					function () {
						big_showBox(this);
						return false;
					}
				);
			}
		);
	}
}

$(document).ready(
	function() {
		searchButtonToLink();
		setHeight('menu3','bottom');
//		setHeight('rightbox3_rule');
		setHeight('left_blocks','leftBottomBox');
		setHeight('rightbox3_rule','rightBottomBox');
		
		isLightBoxScriptsLoaded();		
		
		
		if(typeof big_showOnload!='undefined'){
			big_showOnload();
		}
		
		
		if(typeof showOnload!='undefined' && (typeof big_Lightbox_show == 'undefined' || big_Lightbox_show == false)) {
			showOnload();
		}
		
		
		if(typeof $('#search_val2').attr('class') == 'undefined') {
			document.getElementById('search_val').focus();
		} else {
			document.getElementById('search_val2').focus();
		}
	}
);

