
function changecase(obj) {
  obj.value=obj.value.toUpperCase();
  obj.focus();
  return false;
}

function func(theEp,val,width,height) {  
	document.getElementById(val).innerHTML="<img src='"+theEp+"' width='"+ width +"'     height='"+height +"' alt='' border='0'>";
	document.getElementById(val).href=theEp;
  document.getElementById('imagehidden'+val).value=theEp;
	document.getElementById(val).target='_blank';
  document.getElementById('ctl00_ContentPlaceHolder1_pnlMenu').innerHTML='';
  document.getElementById('ctl00_ContentPlaceHolder1_pnlMenu').style.display='none';
}

function rad() {
  if(document.myForm.txt_price.value=='') {
    alert("Please Select Frame Style");
    document.myForm.txt_price.focus();
    return false;
  }
}

function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}

function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
  var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
  if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function opennew() {
  var length=document.myForm.length.value;
  if(document.myForm.length.value==0) {
    alert("Enter name, word or saying. Letters, Numbers, *, -, &, or !. (Call for custom numbers.)");
    document.form2.username.focus();
    return false;
  }
  var cnt=0;
  for(var i=0;i<length;i++) {
    if(document.getElementById('imagehidden'+i)!=null) {
      if(document.getElementById('imagehidden'+i).value!='') {
        cnt++;
      }
    } else {
      cnt++;
    }
  }
  if(cnt!=length) {
    alert("please click on images to select");
    return false;
  }
  if(document.myForm.txt_price.value=='') {
    alert("Please Select Frame Style");
    document.myForm.txt_price.focus();
    return false;
  }
  var style=document.getElementById('txt_style').value;
  var length=document.getElementById('length').value;
  var  q='';
  for(var i=0;i<length;i++) {
    q+=document.getElementById('imagehidden'+i).value+',';
  }
  if(document.myForm.length.value>=0 &&document.myForm.length.value<5) {
    var imgwindow;
    imgwindow = window.open("artwork.php?id="+q+'&style='+style,'flashwindow','height=280,width=300,directories=no,location=no,menubar=no,scrollbars=yes,status=no,toolbar=no,resizable=yes');	
    if (window.focus) {imgwindow.focus()}
    return false;
  }
  if(document.myForm.length.value>=5 && document.myForm.length.value<9) {
    var imgwindow;
    imgwindow = window.open("artwork.php?id="+q+'&style='+style,'flashwindow','height=280,width=600,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
    if (window.focus) {imgwindow.focus()}
	  return false;	
  }
  if(document.myForm.length.value>=9 && document.myForm.length.value<15) {
    var imgwindow;
    imgwindow = window.open("artwork.php?id="+q+'&style='+style,'flashwindow','height=280,width=900,directories=no,location=no,menubar=no,scrollbars=no,status=no,toolbar=no,resizable=no');
    if (window.focus) {imgwindow.focus()}
	  return false;
  }
}

function fun() { 
  var s;
  var cnt=0;
  if(document.forms.form2.username.value) {
   alert("Enter name, word or saying. Letters, Numbers, *, -, &, or !. (Call for custom numbers.)");
   document.forms.form2.username.value="";
   document.forms.form2.username.focus();
   cnt++;
   return false;
  }  
  if(document.forms.form2.username.value=="") {
    alert("Enter FirstName ");
    document.forms.form2.username.focus();
    cnt++;
    return false;
   } else {
    var name=new String(document.forms.form2.username.value);
    for(i=0;i<name.length;i++) { 
      if(!((name.charAt(i)>='a' && name.charAt(i)<='z')||(name.charAt(i)>='A'&& name.charAt(i)<='Z')||(name.charAt(i)==" ")||(name.charAt(i)=="!")||(name.charAt(i)=="#")||(name.charAt(i)=="-")||(name.charAt(i)=="&") ||(name.charAt(i)>=1 && name.charAt(i)<=9 )||(name.charAt(i)=="*"))) { 
        alert("Enter name, word or saying. Letters, Numbers, *, -, &, or !. (Call for custom numbers.)");
        document.forms.form2.username.focus();
        cnt++;
        return false;
      } 
    }
  }
  if(cnt==0) {
    document.form2.submit();
  }
}

function popup_old (theEp,val,width,height) {
  document.getElementById(val).value=0;
	var url="inludes/images.php";
	var pars="id="+theEp+"&val="+val+"&width="+width+"&height="+height;
  var myAjax = new Ajax.Request(
	url,
	{
		method: 'get',
		parameters: pars,
		onComplete:images
	});
}

function popup (theEp,val,width,height,fname) {
  document.getElementById(val).value=0;
	var url="includes/images.php";
	var pars="id="+theEp+"&val="+val+"&width="+width+"&height="+height+"&fname="+fname;
  var myAjax = new Ajax.Request(
	url,
	{
		method: 'get',
		parameters: pars,
		onComplete:images
	});
}

function images(originalRequest) {
  result = originalRequest.responseText;
  document.getElementById('ctl00_ContentPlaceHolder1_pnlMenu').innerHTML=result;
  document.getElementById('ctl00_ContentPlaceHolder1_pnlMenu').style.display='block'
}

function popup2 (theEp,url,val) {
  document.getElementById(val).value=0;
	var pars="id="+theEp+"&val="+val+"&width=300&height=300";
  var myAjax = new Ajax.Request(
	url,
	{
		method: 'get',
		parameters: pars,
		onComplete:frames
	});
}

function frames(originalRequest) {
  result = originalRequest.responseText;
  document.getElementById('ctl01_ContentPlaceHolder1_pnlMenu').innerHTML=result;
  document.getElementById('ctl01_ContentPlaceHolder1_pnlMenu').style.display='block'
}

function close_frames(){
  document.getElementById('ctl01_ContentPlaceHolder1_pnlMenu').style.display = "none";
}

function use_frame(frame_id){
  ajaxFunction(frame_id);
  close_frames();
  document.getElementById('frame_radio_'+frame_id).checked = "checked";
}

function radio() {
  var length=document.myForm.length.value;
  if(document.myForm.length.value==0) {
    alert("Plese enter the name");
    document.form2.username.focus();
    return false;
  }
  var cnt=0;
  for(var i=0;i<length;i++) {
    if(document.getElementById('imagehidden'+i)!=null) {
      if(document.getElementById('imagehidden'+i).value!='') {
        cnt++;
      }
    } else {
      cnt++;
    }
  }
  if(cnt!=length) {
    alert("please click on images to select");
    return false;
  }
}

