// JavaScript Document

function superPopup(pOptions){            

            var url, type, directories, location, menubar, resizable, scrollbars, status, toolbar, top, left, width, height, winName, clickTrackValue;    

            // URL is the only required field.

            if (pOptions.url != null) {  url = pOptions.url;} else { alert('Error: Link URL Missing')};            

            if (pOptions.type != null) { type = pOptions.type;}; 

            // type will set some basic options to make the function cleaner -- otherwise all values can be set

            if(type == "_blank"){       //used to generate a window the same size as the previous

                        var windowWidth = pOptions.width;

                        var windowHeight = pOptions.height;                                            

                        //used to generate original "window names"

                        var randomNumber = Math.floor(Math.random()*1000);

                        winName="blank" + randomNumber; width=windowWidth; height=windowHeight; resizable="yes"; scrollbars="yes"; menubar="yes"; toolbar="yes"; directories="yes"; location="yes"; top="0"; left="0";

            }       
			
		windowOptions = "width=" + width + ", height=" + height + ", directories=" + directories + ", location=" + location + ", menubar=" + menubar + ", resizable=" + resizable + ", scrollbars=" + scrollbars + ", toolbar=" + toolbar + ", status=" + status + ", toolbar=" + toolbar + ", top=" + top + ", left=" + left;
         

            var newWindow = window.open(url,winName,windowOptions);

            //alert(windowOptions);

            if (newWindow == null){

                        //alert('A popup containing important information was blocked by your browser. Please enable popups for this site in order to view this information.');

                        var errorBox = document.getElementById("blockedPopup");

                        errorBox.style.display = "block";                        

            } else { 

                        if (window.focus && newWindow) { newWindow.focus() }

            }                                            


}
