function MM_test123() {
        alert('LOADED');
}       
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_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

function MM_findObj(n, d) { //v4.0
  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 && document.getElementById) x=document.getElementById(n); return x;
}
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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}

function MM_showHideLayers() { //v3.0
  var i,p,v,obj,args=MM_showHideLayers.arguments;
  for (i=0; i<(args.length-2); i+=3) if ((obj=MM_findObj(args[i]))!=null) { v=args[i+2];
    if (obj.style) { obj=obj.style; v=(v=='show')?'visible':(v='hide')?'hidden':v; }
    obj.visibility=v; }
}

function MM_setTextOfLayer(objName,x,newText) { //v3.0
  if ((obj=MM_findObj(objName))!=null) with (obj)
    if (navigator.appName=='Netscape') {document.write(unescape(newText)); document.close();}
    else innerHTML = unescape(newText);
}


/******************************************
        function for make new lightbox
******************************************/
function MakeNewLightBox(strUrl){
        //function pop up dialog box 
        // user enter new lightbox title and Click enter
        // add it to light box table
        strTitle = prompt("Enter new light box title","new");
        if (strTitle!="" && strTitle!=null){
                i=document.lightbox.selectlightbox.length;
                document.lightbox.selectlightbox.options[i] = new Option(strTitle, "new");
                document.lightbox.selectlightbox.selectedIndex = i;
                document.lightbox.NameOfLightBox.value = strTitle;
                                document.lightbox.ReturnUrl.value= strUrl;
                                document.lightbox.submit();
        }
                //clear all previouse search light box
}

function AddPictureToLightBox(idPicture, strUrl){
        lbform = document.lightbox;
        if (lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "" || lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "0"){
                alert("Please make new or select lightbox.");
        }else{
		 window.open(lbform);
                lbform.NewPicture.value="" + idPicture;
                lbform.submit();
				close();
        }
        return;
}

function RemovePictureFromLightBox(idPicture, strUrl){
        lbform = document.lightbox;
		window.open(strUrl);
        lbform.RemovePicture.value="" + idPicture;
        lbform.ReturnUrl.value= strUrl;
        lbform.submit();
        return;
}

function SelectForLightBox(strUrl){
        lbform = document.lightbox;
    lbform.ReturnUrl.value= strUrl;
    lbform.submit(); 
}

function Selectusage1(){
	uform = document.usage1;
    uform.submit();
}

function Selectusage2(){
    usage2.submit();
}

function DeleteLightBox(strURL){
        lbform = document.lightbox;
        if (lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "" || lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "0"){
                alert("Please select lightbox.");
        }else{
                //delete lightbox
                lbform.DeleteBox.value = lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value;
                lbform.ReturnUrl.value = strURL;
                lbform.submit();
        }
        return false;
}

function RenameLightBox(strURL){
        lbform = document.lightbox;
        if (lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "" || lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "0"){
                alert("Please select lightbox.");
        }else{
                //rename lightbox
                dd = prompt("enter new name for lightbox");
                if (dd == null) return false;
                lbform.RenameBoxID.value = lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value;
                lbform.RenameBoxValue.value = dd;
                lbform.ReturnUrl.value = strURL;
                lbform.submit();
        }
        return false;
}

function EmailLightBox(strURL){
        lbform = document.lightbox;
        if (lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "" || lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value == "0"){
                alert("Please select lightbox.");
        }else{
                window.open("email-popup.php4?lightboxid=" + lbform.selectlightbox.options[lbform.selectlightbox.selectedIndex].value, "emaillightbox", "width=450,height=300,status=0,toolbar=0,menubar=0,resizable=1");
        }
        return false;
}


/********************************************
        Function for fill keywords
*********************************************/
function setKey(name)
{
    var frm = document.instructions;
    if(!frm) frm = document.keyword_form;
    if(frm.keyword1.value=="")
    {
        frm.keyword1.value=name;
        return;
    }
    if(frm.keyword2.value=="")
    {
        frm.keyword2.value=name;
        return;
    }
    if(frm.keyword3.value=="")
    {
        frm.keyword3.value=name;
        return;
    }
    if(frm.keyword4)
    {
    if(frm.keyword4.value=="")
    {
        frm.keyword4.value=name;
        return;
    }
    if(frm.keyword5.value=="")
    {
        frm.keyword5.value=name;
        return;
    }
    if(frm.keyword6.value=="")
    {
        frm.keyword6.value=name;
        return;
    }
    if(frm.keyword7.value=="")
    {
        frm.keyword7.value=name;
        return;
    }
    if(frm.keyword8.value=="")
    {
        frm.keyword8.value=name;
        return;
    }
    if(frm.keyword9.value=="")
    {
        frm.keyword9.value=name;
        return;
    }
    }
    alert("All places are full. Clear some of them.");
}

function checksearchvalue()
{		uform = document.basic.basic.value;
		if(uform == ""){
		alert("Please enter a search word.");
		}else{
		uform1 = document.basic;
		uform1.submit();
		}
		return false;
}

function checksearchvalue2()
{
		frm = document.keyword_form;
		if(frm.keyword1.value=="")
    	{
		alert("Please enter a search word.");
		return false;
		}
		return;
}

function checklettervalue()
{
		uform = document.letter.letter.value;
		if(uform == ""){
		alert("Please enter a search word.");
		}else{
		document.keyword_form.letter.value=uform;
		document.keyword_form.submit();
		return false;
		}
		return false;
}

function MM_popupMsg(msg) { //v1.0
  alert(msg);
}

function Selectdeladdbill(){
	uform = document.billaddress;
    uform.submit();
}
function Selectdeladdship(){
	uform = document.shipaddress;
    uform.submit();
}