﻿function openEditor(url)
{
    makeMaxWin(url)
}

function makeMaxWin(url)
{
	var vwidth = screen.width - 100;
	var vheight = screen.height - 200;
	makeWin(url, vheight, vwidth)
}

function makeWin(url, vheight, vwidth)
{
	agent = navigator.userAgent;
	windowName = "";
	
	var vtop = ((screen.height - vheight)/2);
	var vleft = ((screen.width - vwidth)/2); 

	params  = "";
	params += "toolbar=0,";
	params += "location=0,";
	params += "directories=0,";
	params += "status=0,";
	params += "menubar=0,";
	params += "scrollbars=1,";
	params += "resizable=1,";
	params += "width=" + vwidth + ",";
	params += "height=" + vheight + ",";
	params += "top=" + vtop + ",";
	params += "left=" + vleft;
	
	win = window.open(url, windowName, params);
	if (agent.indexOf("Mozilla/2") != -1 && agent.indexOf("Win") == -1)
	    win = window.open(url, windowName , params);
	if (!win.opener)
	    win.opener = window;
}

function confirm_action(actionType, objectType)
{
    return confirm("Are you sure you want to " + actionType + " this " + objectType + "?");
}

function showLayer(Layer)
{
	if (document.getElementById(Layer) != null)
		document.getElementById(Layer).style.display = "block";
}

function hideLayer(Layer)
{	
	if (document.getElementById(Layer) != null)
		document.getElementById(Layer).style.display = "none"
}

function showProductImage(textBoxID)
{
    var imageURL = '/Common/Images/custom/' + document.getElementById(textBoxID).value;
    makeWin(imageURL, 700, 500)
}
function showProductImageFileSelectorBox(textBoxValue)
{
    var imageURL = '/Common/Images/custom/' + textBoxValue;
    makeWin(imageURL, 700, 500)
}


function checkFormSubmit(form) {
    if (typeof (Page_ClientValidate) == 'function') {
        Page_ClientValidate();
    }
    return Page_IsValid;
}

function checkFormSubmit(form, group) {
    if (typeof (Page_ClientValidate) == 'function') {
        Page_ClientValidate(group);
    }
    return Page_IsValid;
}
