﻿
function OpenChildWindow()
{
	window.open("Glossary.aspx","Glossary","scrollbars,resizable,height=420,width=420");
}

function SetFocus(strId)
{
	strId += "_FOCUS";
	document.getElementById(strId).focus();
}


var newWindow;

function makeNewWindow()
{
	if (!newWindow||newWindow.closed)
	{
		newWindow = window.open("\Glossary.aspx","glossary","scrollbars,resizable,height=350,width=350");
		newWindow.focus();
	}
	else if (newWindow.focus)
	{
		newWindow.focus();
	}
}

function hidestatus()
{
	window.status=''
	return true
}

if (document.layers)
	document.captureEvents(Event.MOUSEOVER | Event.MOUSEOUT)

document.onmouseover=hidestatus
document.onmouseout=hidestatus

function addToFavorites()
{
    if (window.external){
        window.external.Addfavorite('http://www.evaluationcentre.com/','Evaluation Centre');
    }
    else{
        alert('You are using a browser that does not support adding Favorites by script, please add it manually');
    }
}

//Switches the help icon for the help text and viceverca
function ShowHelp(helpCell)
{	
	var cell = document.getElementById(helpCell);
	if(cell)
		cell.style.display = "block";	
}

//Switches the help icon for the help text and viceverca
function HideHelp(helpCell)
{
	var cell = document.getElementById(helpCell);
	if(cell)
		cell.style.display = "none";	
	else
		alert('No help is available for this page.');
}

//Set focus on an element
function SetFocus(strId)
{
	strId += "_FOCUS";
	var obj = document.getElementById(strId);
	if(obj)
		obj.focus();
}

function CheckUrl(obj)
{
	var rtn = true;
	var url = obj.value;
	
	if(url.indexOf(".go") == -1)
		rtn = false;
	
	if(url.indexOf("www") != -1)
		rtn = false;
		
	if(url.indexOf("/") != -1)
		rtn = false;
	
	alert(rtn.tostring());
	
	
	return rtn;					
}

function HideThisShowThat(_this, _that)
{
	var v_this = document.getElementById(_this);
	var v_that = document.getElementById(_that);
	
	v_this.style.display = "none";	
	v_that.style.display = "block";	
}

function HideShowSwitch(id, imageID)
{

    var obj = document.getElementById(id);
    var objImage = document.getElementById(imageID);

    if (obj.style.display == "none") {
        obj.style.display = "block";
        objImage.className = 'WhyRegister_imageOff';      
    }
    else {
        obj.style.display = "none";
        objImage.className = 'WhyRegister_imageOn';
    }
    //alert(objImage.className);
}
function HideSwitch(id, imageID) {

    var obj = document.getElementById(id);
    var objImage = document.getElementById(imageID);
    obj.style.display = "none";
    objImage.className = 'WhyRegister_imageOn';
    //obj.style.display != obj.style.display
}


//From http://www.quirksmode.org/js/popup.html
function popitup(url, width, height) 
{
	alert(url);
	newwindow=window.open(url,'name','height=' + height + ',width=' + width);
	if (window.focus) 
		newwindow.focus();
	return false;
}

function popitup_center(url, width, height) 
{
	var winl = (screen.width-width)/2;
	var wint = (screen.height-height)/2;
	
	newwindow=window.open(url,'name','height=' + height + ',width=' + width + ',top=' + wint + ',left=' + winl);
	if (window.focus) 
		newwindow.focus();
	return false;
}

function popitup_center_notools(url, width, height) 
{
	var winl = (screen.width-width)/2;
	var wint = (screen.height-height)/2;
	
	newwindow=window.open(url,'name','height=' + height + ',width=' + width + ',toolbar=no,directories=no,status=no,menubar=no, scrollbars=no,resizable=no,top=' + wint + ',left=' + winl);
	if (window.focus) 
		newwindow.focus();
	return false;
}

//From http://www.quirksmode.org/js/popup.html
function popitup_writer(html, width, height) 
{
	//html variable should include full html markup - eg: <html><head></head><body></body></html>
	newwindow2=window.open(url,'name','height=' + height + ',width=' + width + '150');
	var tmp = newwindow2.document;
	tmp.write(html);
	tmp.close();
}


//Previously on \DesktopModules\productlist.ascx
function OpenVendorWindow(url, admin)
{
	//window.open('<%=((Alphasoft.PMP.PageBase)this.Page).Site_Path%>/VendorReport.aspx?<%=Alphasoft.PMP.PageBase.PARAM_KEY_EVAL_CENTRE%>=' + EvalID + '&<%=Alphasoft.PMP.PageBase.PARAM_KEY_VENDOR_ID%>=' + VendorID, 'VendorReport', 'toolbar=yes,resizable=yes,scrollbars=yes,height=500,width=650', false);
	//window.open('<%=((Alphasoft.PMP.PageBase)this.Page).Site_Path%>VendorReport.aspx?<%=Alphasoft.PMP.PageBase.PARAM_KEY_EVAL_CENTRE%>=' + EvalID + '&<%=Alphasoft.PMP.PageBase.PARAM_KEY_VENDOR_ID%>=' + VendorID, 'VendorReport', 'toolbar=yes,resizable=yes,scrollbars=yes,height=500,width=650', false);
	var newwindow;
	if(admin >0)
	{
		newwindow = window.open(url, 'VendorReport', 'toolbar=yes,menubar=yes,location=yes,resizable=yes,scrollbars=yes,height=700,width=650', false); //location=yes => adddress bar is on
		newwindow.focus();
		return true;
	}
	else
	{
		newwindow = window.open(url, 'VendorReport', 'toolbar=yes,resizable=yes,scrollbars=yes,height=700,width=650', false);	
		newwindow.focus();
		return true;
	}
}

function printpage() 
{
	window.print();  
	return true;
}


