function open_win(what_link){ 
var the_url = "/images/sample_preview_large.gif"
var the_x = 710;
var the_y = 510;
the_x -= 0;
the_y -= 0;
var how_wide = screen.availWidth;
var how_high = screen.availHeight;
if(what_link != ""){the_url=what_link;}
var the_toolbar = "no";
var the_addressbar = "no";
var the_directories = "no";
var the_statusbar = "no";
var the_menubar = "no";
var the_scrollbars = "no";
var the_do_resize =  "no";
var the_copy_history = "no";
top_pos = (how_high/2) -  (the_y/2);
left_pos = (how_wide/2) -  (the_x/2);
if (window.outerWidth ){
var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",outerWidth="+the_x+",outerHeight="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
site=open(the_url, "DisplayWindow", option);
var Opera = (navigator.userAgent.indexOf('Opera') != -1);
if(Opera){
site.resizeTo(the_x,the_y);
site.moveTo(0,0);
}
}
else
{
var option = "toolbar="+the_toolbar+",location="+the_addressbar+",directories="+the_directories+",status="+the_statusbar+",menubar="+the_menubar+",scrollbars="+the_scrollbars+",resizable="+the_do_resize+",Width="+the_x+",Height="+the_y+",copyhistory="+the_copy_history+",left="+left_pos+",top="+top_pos;
site=open('', "DisplayWindow", option);
site.location=the_url;
if(site.open){site.focus();return false;}
site.resizeTo(the_x,the_y);
}
}

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

function openWindowFull(url) {
	w=835;
	h=550;
    var winl = (screen.width - w) / 2 +30 ;
    var wint = (screen.height - h) / 2 +30 ;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=1'
	newWindow = window.open(url, "popupwindow", winprops);
}

function openWindowSmall(url) {
	w=400;
	h=250;
    var winl = (screen.width - w) / 2 +30 ;
    var wint = (screen.height - h) / 2 +30 ;
	winprops = 'height='+h+',width='+w+',top='+wint+',left='+winl+',scrollbars=1'
	newWindow = window.open(url, "smallwindow", winprops);
}

function LinkFile( fileUrl )
{

	var dialog= window.parent ;
	dialog.Args().CustomValue.SetUrl( fileUrl );	
	dialog.Cancel();
	
}

function setSecureAction(secureLoginURL){
        if(secureLoginURL != null){
		var loginForm = document.getElementById('loginForm');
		//alert('loginURL='+secureLoginURL);
		loginForm.action=secureLoginURL;
	}
}


function loginOnEnter(event){
  var keyCode;
  if (window.event)
    keyCode = window.event.keyCode;
  else if (event)
    keyCode = event.which;
  
   if(keyCode == 13){
   	submitForm('loginForm',1,{source:'loginButton'});
   }
   
   
   return false;
}


function checkMultipleClick(event){
  _pprStartBlocking(window)
}

/* This is to set focus for all the pages */
function formFocus() {
	currentobj = eval(document.getElementById('mainfrm'));
  if (currentobj) {
    formRef = currentobj;
    for (k=0; k < formRef.elements.length ; k++) {
      if ((formRef.elements[k].type == "text" || formRef.elements[k].type == "textarea" || formRef.elements[k].type == "password") && (formRef.elements[k].disabled == false)) { 
        formRef.elements[k].focus();
        k = formRef.elements.length;
      }
    }
  }
	/* this is to set the focus for edit cell page, need to see if we can get the iframe name dynamically */
	fckobj = eval(document.getElementById('newHeader:feedbackContent___Frame'));
	if(fckobj) {
		setTimeout("fckobj.contentWindow.focus();", 100);
	}
	/* this is to set the focus for template instructions page, need to see if we can get the iframe name dynamically */
	fckobj1 = eval(document.getElementById('instructions:instrInput___Frame'));
	if(fckobj1) {
		setTimeout("fckobj1.contentWindow.focus();", 100);
	}
}
/* This is to set focus for the signup pages */
function formFocus1() {
	if (document.forms[0]) {
    formRef = document.forms[0];
		if(formRef.name.indexOf("paymentDetails") != -1) {
			if(document.forms[1]) {
				formRef = document.forms[1];
			}
		}
  }
	if(formRef) {
		for (k=0; k < formRef.elements.length ; k++) {
			if ((formRef.elements[k].type == "text" || formRef.elements[k].type == "textarea" || formRef.elements[k].type == "password") && (formRef.elements[k].disabled == false)) { 
				formRef.elements[k].focus();
				k = formRef.elements.length;
			}
		}
	}
}
