function ShowRatingWindow() 
{
	window.open("EditModule.aspx?def=Rating&BaseObjectID=" + ShowRatingWindow.arguments[0] + "&RenderTemplate=0");
	return void(0);
}
function ShowPrintWindow() 
{
	window.open("RenderModule.aspx?ModuleID=" + ShowPrintWindow.arguments[0] + "&RenderType=print");
	return void(0);
}
function ShowExcelWindow() 
{
	window.open("RenderModule.aspx?ModuleID=" + ShowExcelWindow.arguments[0] + "&RenderType=excel");
	return void(0);
}
function ShowWordWindow() 
{
	window.open("RenderModule.aspx?ModuleID=" + ShowWordWindow.arguments[0] + "&RenderType=word");
	return void(0);
}
function ShowPdfWindow() 
{
	window.open("RenderModule.aspx?ModuleID=" + ShowPdfWindow.arguments[0] + "&RenderType=pdf");
	return void(0);
}
function ShowTellAFriendWindow() 
{
	window.open("controls/Module/TellAFriend.aspx?ModuleId=" + ShowTellAFriendWindow.arguments[0] + "&Url=" + ShowTellAFriendWindow.arguments[1] + "&Host=" + ShowTellAFriendWindow.arguments[2] , "" , 'width=360,height=360,scrollbars=no, resizable=yes,center=yes,toolbar=no,directories=no,location=no, menubar=no,status=yes,left=200,top=150');
	return void(0);
}
function ShowXMLWindow() 
{
	window.open("RenderModule.aspx?ModuleID=" + ShowXMLWindow.arguments[0] + "&RenderType=xml");
	return void(0);
}
function ShowRssWindow() 
{
	window.open("RenderModule.aspx?ModuleID=" + ShowRssWindow.arguments[0] + "&RenderType=rss");
	return void(0);
}
function ShowNarrowSearchInNewWindow() 
{
	if (ShowNarrowSearchInNewWindow.arguments[1].value.trim().length > 0)
		window.open("RenderModule.aspx?ModuleID=" + ShowNarrowSearchInNewWindow.arguments[0] + "&NarrowSearchKeyword=" + ShowNarrowSearchInNewWindow.arguments[1].value.trim() + "&RenderType=print");
	return void(0);
}
function MinimizeMaximize(Content,cmdMinMax)
{
	if(Content.style.display=="none")
	{
		cmdMinMax.innerHTML = cmdMinMax.innerHTML.replace("Plus","Minus");
		Content.style.display="block";
	}
	else
	{
		cmdMinMax.innerHTML = cmdMinMax.innerHTML.replace("Minus","Plus");
		Content.style.display="none";
	}
}

function ShowExternalImagePreview(ImageAddressTextboxID)
{
	if (ImageAddressTextboxID.value != "")
	{
		window.open(ImageAddressTextboxID.value);	
	}
}
function ShowInternalImagePreview(StartPath,FolderComboboxID,FileComboboxID)
{
	if (FileComboboxID.options(FileComboboxID.selectedIndex).value == "")
	{
		return ;
	}
	var path;
	path = StartPath;
	path += FolderComboboxID.options(FolderComboboxID.selectedIndex).value;
	path += "\\" + FileComboboxID.options(FileComboboxID.selectedIndex).value;
	window.open(path);

}
function ShowColorPickerDialog(s){
	document.all[s].value = window.showModalDialog('../../controls/ColorPicker/ColorPicker.htm',document.all[s].value,'dialogHeight:485px;dialogWidth:370px;center:Yes;help:No;scroll:No;resizable:No;status:No;');
}
function ShowModuleNotification() 
{
	var windowFeatures = "toolbar=no, location=no, status=no, menubar=no, scrollbars=yes, resizable=no, height=150, width=400, top=" + ((screen.height - 100)/2).toString()+",left="+((screen.width - 400)/2).toString();
	window.open("controls/Module/ModuleNotification.aspx?ModuleID=" + ShowModuleNotification.arguments[0], "Module",windowFeatures);
	return void(0);
}
function MoveToolbox(obj)
{
	var x,y;
	x = event.clientX -30;
	y = event.clientY-30;
	document.getElementById(obj).style.top = y + "px";
}

var openId;
openId = -1;
function ShowMenu(id)
{
	if (openId > -1 && id!=openId)
	{
		document.getElementById('i' + openId).style.display = "none";
		openId = -1;
	}
	var vis = document.getElementById('i' + id).style.display;
	if (vis == "none")
	{
	document.getElementById('i' + id).style.display = "inline";
	}
	else
	{
	document.getElementById('i' + id).style.display = "none";
	openId = -1;
	}
	openId = id;
	return true;
}

var openModuleId;
openModuleId = -1;
function ShowModuleMenu(id)
{
	if (openModuleId > -1 && id!=openModuleId)
	{
		document.getElementById('m' + openModuleId).style.display = "none";
		openId = -1;
	}
	var vis = document.getElementById('m' + id).style.display;
	if (vis == "none")
	{
	document.getElementById('m' + id).style.display = "inline";
	}
	else
	{
	document.getElementById('m' + id).style.display = "none";
	openModuleId = -1;
	}
	openModuleId = id;
	return true;
}

var xmlhttp = false;
if (!xmlhttp){
	try	{
	xmlhttp = new XMLHttpRequest(); /* e.g. Firefox */ }
    catch(e) {
		try {
			xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); /* some versions IE */ }
		catch (e) {
			try {
				xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); /* some versions IE */ } 
			catch (E){
				xmlhttp = false; }
		}
	}
}

if (!xmlhttp && window.createRequest) {
	try {
		xmlhttp = window.createRequest();
	} catch (e) {
		xmlhttp=false;
	}
}

if (document.layers) { 
    document.captureEvents(Event.MOUSEMOVE);
    document.onmousemove = captureMousePosition;
} else if (document.all) { 
    document.onmousemove = captureMousePosition;
} else if (document.getElementById) {
    document.onmousemove = captureMousePosition;
}

xMousePos = 0; 
yMousePos = 0; 
xMousePosMax = 0; 
yMousePosMax = 0; 

function captureMousePosition(e) {
    if (document.layers) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    } else if (document.all) {
        xMousePos = window.event.x+document.body.scrollLeft;
        yMousePos = window.event.y+document.body.scrollTop;
        xMousePosMax = document.body.clientWidth+document.body.scrollLeft;
        yMousePosMax = document.body.clientHeight+document.body.scrollTop;
    } else if (document.getElementById) {
        xMousePos = e.pageX;
        yMousePos = e.pageY;
        xMousePosMax = window.innerWidth+window.pageXOffset;
        yMousePosMax = window.innerHeight+window.pageYOffset;
    }
}

var please_wait = "Please wait...";
function open_url(url, targetId) {
  if(!xmlhttp)return false;
    var e=document.getElementById(targetId);if(!e)return false;
    if(please_wait)e.innerHTML = please_wait;
    xmlhttp.open("GET", url, true);
    xmlhttp.onreadystatechange = function() { response(url, e); }
    try{
      xmlhttp.send(null);
    }catch(l){
    while(e.firstChild)e.removeChild(e.firstChild);
    e.appendChild(document.createTextNode("request failed"));
  }
}
function response(url, e) {
  if(xmlhttp.readyState != 4)return;
    var tmp= (xmlhttp.status == 200 || xmlhttp.status == 0) ? xmlhttp.responseText : "Ooops!! A broken link! Please contact the webmaster of this website ASAP and give him the following error code: " + xmlhttp.status+" "+xmlhttp.statusText;
    var d=document.createElement("div");
    d.innerHTML=tmp;
    setTimeout(function(){
      while(e.firstChild)e.removeChild(e.firstChild);
      e.appendChild(d);
    },10)
}
var openSRId;
openSRId = -1;
function ShowRating(item)
{
	var el; 
	el = document.getElementById('RatingDIV');
	if (openSRId > -1 && item!=openSRId)
	{
		el.style.display = 'none';
		el.innerHTML = "";
		openSRId = -1;
	}
	if (el.style.display == 'block')
	{
		el.style.display  = 'none';
		el.innerHTML = "";
		openSRId = -1;
	}
	else
	{
		openSRId = item;
		el.style.display = 'block';
		el.style.top = yMousePos - 10;
		el.style.left = xMousePos - 50;
		var currentTime;
		currentTime = new Date();
		open_url('/rating.aspx?item=' + item + '&time='+ currentTime, 'RatingDIV');
	}
}
function Rate(item,rate) 
{
	var currentTime;
	currentTime = new Date();
	open_url('/rating.aspx?item=' + item + '&rate='+ rate + '&time='+ currentTime, 'RatingDIV');
	CloseRatingDIV();
}
function CloseRatingDIV()
{
	document.getElementById('RatingDIV').style.display = 'none';
}
function ShowHelpWindow(action, moduleId, tabId, friendlyName, language) 
{
	window.navigate("do.aspx?act=" + action + "&m=" + moduleId + "&TabId=" + tabId + "&FriendlyName=" + friendlyName + "&Lang=" + language, "EditModule");
}
function ShowEditModule(moduleId, action, tabId)
{
	window.navigate("do.aspx?act=" + action + "&m=" + moduleId + "&TabId=" + tabId, "EditModule");
}