
function wopen(url, name, w, h)
{
// Fudge factors for window decoration space.
 // In my tests these work well on all platforms & browsers.
w += 14;
h += 16;
 var win = window.open(url,
  name,
  'width=' + w + ', height=' + h + ', ' +
  'location=no, menubar=no, ' +
  'status=no, toolbar=no, scrollbars=yes, resizable=no');
 win.resizeTo(w, h);
 win.focus();
}





function open_popuptheme(url,h,w,winname){
		open_window(url,'winname',0,0,0,1,1,h,w,0);		
		
		
		
}
function open_window(url,wname,dir,status,menu,scroll,resize,width,height,top) {
	var mywindow = window.open(url,wname,'directories='+dir+',status='+status+',menubar='+menu+',scrollbars='+scroll+',resizable='+resize+',width='+width+',height='+ height+',top='+top);
	if (!mywindow.opener)
			{mywindow.opener =self;mywindow.tempopener =self;}
}
	


function open_calendar_window(fieldname,formname) {
	var dateval
	dateval =  eval('document.'+formname+'.'+fieldname+'.value')
	mywin = window.open('/DovetailWRP/server/library/utils/Calendar.asp?FieldName=' + fieldname + '&FormName=' + formname+'&SelDate=' + dateval ,'Calendar',		'directories=0,status=0,menubar=0,scrollbars=0,resizable=0,width=157,height=175,top=100');
}


function updateParent(url,alturl) {		
var mywin;



	if(url.indexOf('/secure/')>-1 || url.indexOf('/shoppingcart.asp')>-1 ) {
		url='/shoppingcart.asp'
	}		


	if(window.opener!=null && !window.opener.closed){	
			window.opener.location=url;		
			window.opener.focus();		


	}
	else{	
			mywin = window.open(alturl);
			mywin.focus();									
	}

	window.close();	
}


function ini() {		

	if (document.layers)
		for(var layercount=0;layercount<document.layers.length;layercount++)
			for(var formcount=0;formcount<document.layers[layercount].document.forms.length;formcount++)
				if (document.layers[layercount].document.forms[formcount].name && document.layers[layercount].document.forms[formcount].name!='') 
				eval('document.' + document.layers[layercount].document.forms[formcount].name +' = document.layers[layercount].document.forms[formcount];');
	
}

function validateSC(f, SCelement,minelement){
	bValid=true;
	CheckSpecified (SCelement,"Please specify a quantity.")
	CheckNumeric (SCelement,"The quantity must be numeric.")
	CheckPositive (SCelement,"The quantity must be greater than 0.")
	if(minelement && bValid)//only if elwment exists and data has passesd the criteria
	{	
		var minelementvalue= getValue(minelement)
		if(minelement!=-1 &&(minelementvalue>getValue(SCelement))){
			bValid =false;
			alert("The minimum quantity for this item is "+ minelementvalue +".");
		}
	}
	return bValid;
}