function printpreview(){
var PROMPT = 1; // 2 DONTPROMPTUSER 
var WebBrowser = '<OBJECT ID="WebBrowser1" WIDTH=0 HEIGHT=0 CLASSID="CLSID:8856F961-340A-11D0-A96B-00C04FD705A2"></OBJECT>';
document.body.insertAdjacentHTML('beforeEnd', WebBrowser); 
WebBrowser1.ExecWB(7, PROMPT);
WebBrowser1.outerHTML = "";
}

function capturevideo(Msg){
	var m=prompt(Msg,"5");
	if (m!=null)
	{
		document.myform.action="admin.asp?a=capturevideo&m="+escape(m);
		document.myform.submit();
	}
}
function RotateOriginal(){
	location.href = location.href;
	//this.document.images['image'].style.filter='progid:DXImageTransform.Microsoft.BasicImage("")';
}

function RotateLeft(){
	this.document.images['image'].style.filter='progid:DXImageTransform.Microsoft.BasicImage(rotation=3)';
	zoomImages(1.1);
	zoomImages(0.91);
}

function RotateRight(){
	this.document.images['image'].style.filter='progid:DXImageTransform.Microsoft.BasicImage(rotation=1)';
	zoomImages(1.1);
	zoomImages(0.91);
}

function zoomImages(factor){
	for (var n=0, Img=document.images, i=0; i<Img.length; i++) {
		if ((Img[i].name.indexOf('image')> -1)) {
			if (((Img[i].width>=32) | (factor>1)) && ((Img[i].width<10000) | (factor<1))) {Img[i].width=Img[i].width*factor;}
		}
	}
}

function ConfirmAction(msg,action){
	if (confirm(msg)) {
	document.myform.action=action;
	document.myform.submit();}
}

function find(Msg){
	var findstr=prompt(Msg,"");
	if (findstr!=null)
	{
		document.myform.action="listpics.asp?q="+escape(findstr);
		document.myform.submit();
	}
}


function getTarget(url){
	if (self.name == "Popup") {
		window.close();
	}
	else	{
		window.location = url;
		//history.go(-1);
	}
}

function closePopup() {
opener.focus();
	opener.location.href = opener.location;
	self.close();
}

function openinfoPopup(url) {
	myPopup = window.open('','InfoPopup','width=500,height=450,top=10,left=10,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
	myPopup.focus();
	document.myform.target='InfoPopup';
	document.myform.action=url;
	document.myform.submit();
	document.myform.target='';
}

function opensmallPopup(url) {
	myPopup = window.open('','SmallPopup','width=275,height=250,top=10,left=10,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
	myPopup.focus();
	document.myform.target='SmallPopup';
	document.myform.action=url;
	document.myform.submit();
	document.myform.target='';
}

function openPopup(url) {
	myPopup = window.open(url,'Popup1','width=425,height=300,top=10,left=10,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
	myPopup.focus();
}

function openoverviewwindow(url) {
	myPopup = window.open(url,'Popup2','width=860,height=725,top=10,left=10,resizable=yes,scrollbars=yes,toolbars=no,statusbar=yes,titlebar=no');
	myPopup.focus();
}


function rename(msg,pattern){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	var newname=prompt(msg,pattern);
	if ((newname!="") && (newname!=null)){
		document.myform.action="admin.asp?a=rename&newname="+escape(newname);
		document.myform.submit();
		}
	}
else {
	alert(NoItemsMsg)
}}

function ButtonOver(item) {
	item.className = "Button_sel";
	if (item.alt !=null) {
		window.status=item.alt;
	}
}

function ButtonOff(item) {
	item.className = "Button_unsel";
	window.status='http://www.iisworks.com';
}

function CheckAll(){
	for (var i=0;i<document.myform.elements.length;i++) {
	var e=document.myform.elements[i];
	if ((e.name !='allbox') && (e.name !='loopshow')) {
	e.checked=document.myform.allbox.checked;}}
}

function Submit(action){
	document.myform.action=action;
	document.myform.submit();
	}

function SubmitForm(action){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	document.myform.action=action;
	document.myform.submit();
	}
else {
	alert(NoItemsMsg)
}}
	
function ConfirmDel(Msg){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	if (confirm(Msg)) {
	document.myform.action="admin.asp?a=del";
	document.myform.submit();}
	}
else {
	alert(NoItemsMsg)
}}

	
function ConfirmMirror(msg){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	if (confirm(msg)) {
	document.myform.action="admin.asp?a=mirror";
	document.myform.submit();}
	}
else {
	alert(NoItemsMsg)
}}

function resize(msg){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	var imgsize=prompt(msg,"60%");
	if ((imgsize!="") && (imgsize!=null)){
		document.myform.action="admin.asp?a=resize&imgsize=" + escape(imgsize);
		document.myform.submit();
	}}
else {
	alert(NoItemsMsg)
}}

function convert(msg){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	var newtype=prompt(msg,"");
	if ((newtype!="") && (newtype!=null)){
		document.myform.action="admin.asp?a=convert&newtype=" + escape(newtype);
		document.myform.submit();
	}}
else {
	alert(NoItemsMsg)
}}


function rotate(msg){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	var deg=prompt(msg,"90");
	if ((deg!="") && (deg!=null)){
		document.myform.action="admin.asp?a=rotate&degrees=" + escape(deg);
		document.myform.submit();
	}}
else {
	alert(NoItemsMsg)
}}

function crop(msg){
for (var ID, n=0, DL=document.myform, i=0; i<DL.elements.length; i++) {if ((DL.elements[i].name.indexOf('ID')> -1)) {if (DL.elements[i].checked){ID=DL.elements[i].value;n=n+1; }}}
if (n>0) {
	var dimensions=prompt(msg,"1,1,100,100");
	if ((dimensions!="") && (dimensions!=null)){
		document.myform.action="admin.asp?a=crop&dimensions=" + escape(dimensions);
		document.myform.submit();
	}}
else {
	alert(NoItemsMsg)
}}

function newfolder(msg){
	var fldr=prompt(msg,"");
	if ((fldr!="") && (fldr!=null)){
		document.myform.action="admin.asp?a=createfolder&folder=" + escape(fldr);
		document.myform.submit();
	}
}
