var _site_url = "http://www.magic-imv.ro/";
var _functAct = ".php";

function Mihai_Iorga(){
}

function _port_this_resize(_this_name, _this_img_folder, _this_subdir){
	var _this_div = _this_name;
	var _this_bg_div = _this_name+'_bg';
	$(_this_div).className = "new_resize";
	$(_this_div).innerHTML = '<a href="javascript:Mihai_Iorga();" onclick="javascript:_port_this_back(\''+_this_div+'\', \''+_this_img_folder+'\', \''+_this_subdir+'\')" style="cursor:move"><img src="http://www.magic-imv.ro/blog-img/'+_this_img_folder+'/'+_this_subdir+'/'+_this_div+'.jpg"  alt="Click pentru redimensionare" title="Click pentru redimensionare" /></a>';
	$(_this_bg_div).style.display = "block";
}

function _port_this_back(_this_name, _this_img_folder, _this_subdir){
	var _this_div = _this_name;
	var _this_bg_div = _this_name+'_bg';
	$(_this_bg_div).style.display = "none";
	$(_this_div).innerHTML = '<a href="javascript:Mihai_Iorga();" onclick="javascript:_port_this_resize(\''+_this_div+'\', \''+_this_img_folder+'\', \''+_this_subdir+'\')" style="cursor:move"><img src="http://www.magic-imv.ro/blog-img/'+_this_img_folder+'/'+_this_subdir+'/'+_this_div+'_tn.jpg"  alt="Click pentru redimensionare" title="Click pentru redimensionare" /></a>';
	$(_this_div).className = "normal_size";
}

var errFunc = function(t) {
	alert('Error ' + t.status + ' -- ' + t.statusText);
}

function youtube_down(url){
	$('youtube_alt').style.display = 'block';
	the_div = 'error';
	var c = url+'&verify=da';
	new Ajax.Request(
		_site_url+"youtube"+_functAct, {
			method:'post',
			parameters: c,
			onSuccess: function(t){
					if(t.responseText == 'bad'){
							$('youtube_alt').style.display = 'none';
							alert('Acel link nu este bun! Va rog reincercati!');
					}else{
							window.location = _site_url+'youtube'+_functAct+'?url='+url+'&v=da';
					}
			},
			onFailure: errFunc
		}
	);
}

function installExtension(aEvent, extensionName, iconURL) {
   var params = new Object();
   params[extensionName] =
	    { 
		URL: aEvent.target.href,
		IconURL: iconURL,
	        toString: function () { return this.URL; }
            };

   var res = InstallTrigger.install(params);
   if (!res) { 
	alert("If you see an error bar at the top of your browser, follow these instructions:\n" +
		"1. Click the \"Edit Options...\" button on the error bar.\n" + 
		"2. Click the \"Allow\" button in the dialog box that appears.\n" + 
		"3. Click \"OK\" to confirm and close the dialog box.\n" + 
		"Now you can install extensions from this site.\n" +
		"Click the install link again to install the extension.\n\n" +
		"If you don't see the error bar, please make sure you have enabled \n" + 
		"extension installation from Web sites in the \"Options\" dialog."
 		);
   }

   return false;
}

function getPageSize(){
	
	var xScroll, yScroll;
	
	if (window.innerHeight && window.scrollMaxY) {	
		xScroll = document.body.scrollWidth;
		yScroll = window.innerHeight + window.scrollMaxY;
	} else if (document.body.scrollHeight > document.body.offsetHeight){
		xScroll = document.body.scrollWidth;
		yScroll = document.body.scrollHeight;
	} else {
		xScroll = document.body.offsetWidth;
		yScroll = document.body.offsetHeight;
	}
	
	var windowWidth, windowHeight;
	if (self.innerHeight) {	
		windowWidth = self.innerWidth;
		windowHeight = self.innerHeight;
	} else if (document.documentElement && document.documentElement.clientHeight) { 
		windowWidth = document.documentElement.clientWidth;
		windowHeight = document.documentElement.clientHeight;
	} else if (document.body) { 
		windowWidth = document.body.clientWidth;
		windowHeight = document.body.clientHeight;
	}	
	
	if(yScroll < windowHeight){
		pageHeight = windowHeight;
	} else { 
		pageHeight = yScroll;
	}

	if(xScroll < windowWidth){	
		pageWidth = windowWidth;
	} else {
		pageWidth = xScroll;
	}


	arrayPageSize = new Array(pageWidth,pageHeight,windowWidth,windowHeight) 
	return arrayPageSize;
}




function show_overlay(){
	var arrayPageSize = getPageSize();
	overlay_bg = document.getElementById('overlay_background');
	overlay_bg.style.height = arrayPageSize[1]+"px" ;
	overlay_bg.style.display = "block";
}

function show_overlay2(){
	var arrayPageSize = getPageSize();
	overlay_bg2 = document.getElementById('overlay_background2');
	overlay_bg2.style.left = (arrayPageSize[0]/4)+"px" ;
	overlay_bg2.style.display = "block";	
}
function hide_overlay(){
	overlay_bg.style.display = "none";
}