﻿// JScript File

function MM_jumpMenu(targ,selObj,restore){ //v3.0
  eval(targ+".location='"+selObj.options[selObj.selectedIndex].value+"'");
  if (restore) selObj.selectedIndex=0;
}

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_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_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 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_openBrWindow(theURL,winName,features) { //v2.0
  window.open(theURL,winName,features);
}


//<![CDATA[
//Separator for ordered formats in description field of an item.

function EnableDisableShipValidators(doValidate)
{
    ValidatorEnable(document.getElementById("val_tb_shipInfo_fname"), doValidate);
    ValidatorEnable(document.getElementById("val_tb_shipInfo_address"), doValidate);
    ValidatorEnable(document.getElementById("val_tb_shipInfo_lname"), doValidate);
    ValidatorEnable(document.getElementById("val_tb_shipInfo_home"), doValidate);
    ValidatorEnable(document.getElementById("val_tb_shipInfo_phone1"), doValidate);
    ValidatorEnable(document.getElementById("val_tb_shipInfo_town"), doValidate);
    ValidatorEnable(document.getElementById("val_tb_shipInfo_phone2"), doValidate);
    ValidatorEnable(document.getElementById("val_tb_shipInfo_zip"), doValidate);
}

function ShowHideObj(objName)
{
	if (document.getElementById(objName).style.display=='none')
	{
		document.getElementById(objName).style.display='block';
	}
	else
	{
		document.getElementById(objName).style.display='none';
	}
}

function ShowObj(objName)
{
   document.getElementById(objName).style.display='block';
}

function HideObj(objName)
{
 document.getElementById(objName).style.display='none';
}

function setObject(objID)
{

    HideObj('divGeneral')
    HideObj('divFormat1')
    HideObj('divPaper1')
    HideObj('divAmount1')
    HideObj('divFrame1')
    HideObj('divFill1')
    HideObj('divFix1')
    
   ShowObj('div' + objID)
    
}

var separator = "...\n\r";

var maxFormatCount = 1;

var imageUploader1 = null;

//This class represents an information about ordered print format. 
function Format(name, paper, amount,frame,fill,fix){
	this.name = name; //Print format name
	this.paper = paper; //Paper type.
	this.amount = amount; //Number of copies of this format.
	this.frame = frame; //Frame type.
	this.fill = fill; //Either fit or fill the paper in developing.
	this.fix=fix;
}

//This function parses a string displayed as a description of Image Uploader item
//and returns an array of ordered formats.
function parseDescription(description){
	var formats=new Array();
	if (description!=""){
		var arrDescription = description.split(separator);

		for (var z = 0; z < arrDescription.length; z++){ 
			//arrFormat = arrDescription[z].split(" ");
			arrFormat = arrDescription[z].split("_");
			formats.push(new Format(arrFormat[0], arrFormat[3], arrFormat[2],arrFormat[4],arrFormat[5],arrFormat[6]));
		}
	}
	return formats;
}

function fullPageLoad(){
	imageUploader1=getImageUploader("ImageUploader1");
}

function ImageUploader_SelectionChange() {
	if (imageUploader1) {
		var selectedFileIndex = null;

		//This array stores all ordered formats for selected items.
		var formats = new Array();

		for (var i = 0; i < maxFormatCount; i++){
			formats.push(new Format("", "", "","","",""));
		}

		//Iterate all upload list items and get common format information for all of them (i.e.
		//format information which equals for all items).
		for (var i = 1; i <= imageUploader1.getUploadFileCount(); i++){
			if (imageUploader1.getUploadFileSelected(i)){
				var currentFormats = parseDescription(new String(imageUploader1.getUploadFileDescription(i)));

				//For the first selected item just copy the current format...
				if (selectedFileIndex == null){
					selectedFileIndex = i;
					for (var j = 0; j < currentFormats.length; j++){
						formats[j] = currentFormats[j];
					}
				}
				//...and for all further selected items verify whether the current format is the same as 
				//for previous items. If yes, use it, otherwise the empty string is used. 
				
				else{
					selectedFileIndex = "multiple"
					for (var j = 0; j < currentFormats.length; j++){
						if (currentFormats[j].name != formats[j].name){
							formats[j].name = "";
						}
						if (currentFormats[j].paper != formats[j].paper){
							formats[j].paper = "";
						}
						if (currentFormats[j].amount != formats[j].amount){
							formats[j].amount = "";
						}
						if (currentFormats[j].frame != formats[j].frame){
							formats[j].frame = "";
						}
						if (currentFormats[j].fill != formats[j].fill){
							formats[j].fill = "";
						}
						if (currentFormats[j].fix != formats[j].fix){
							formats[j].fix = "";
						}
						
					}

					for (var j = currentFormats.length; j < maxFormatCount; j++){
						formats[j].name = "";
						formats[j].paper = "";
						formats[j].amount = "";
						formats[j].frame = "";
						formats[j].fill = "";
						formats[j].fix = "";
					
					}
				}
			}
		}
			//frame
	//fill

		//If none files selected (i.e. selectedFileIndex is null), disable HTML form fields 
		//which edit print formats.  
		var disabled = selectedFileIndex == null;

		var aSelectFormat = new Array();
		var aSelectPaper = new Array();
		var aInputAmount = new Array();
		//var aSelectAmount = new Array();
		var aSelectframe = new Array();
		var aSelectfill = new Array();
		var aSelectfix = new Array();

		for (var i = 1; i <= maxFormatCount; i++){
			aSelectFormat[i] = document.getElementById("SelectFormat" + i);
			aSelectFormat[i].disabled = disabled;
			aSelectPaper[i] = document.getElementById("SelectPaper" + i);
			aSelectPaper[i].disabled = disabled;
			aInputAmount[i] = document.getElementById("InputAmount" + i);
			aInputAmount[i].disabled = disabled;
			//aSelectAmount[i] = document.getElementById("SelectAmount" + i);
			//aSelectAmount[i].disabled = disabled;
			aSelectframe[i] = document.getElementById("SelectFrame" + i);
			aSelectframe[i].disabled = disabled;
			aSelectfill[i] = document.getElementById("SelectFill" + i);
			aSelectfill[i].disabled = disabled;
			aSelectfix[i] = document.getElementById("SelectFix" + i);
			aSelectfix[i].disabled = disabled;
		}

		var thumbnail1 = getImageUploader("Thumbnail1");


		if (selectedFileIndex){

			//Display format data in those fields which edit the same format settings. 
			for (var i = 1; i <= maxFormatCount; i++){
				for (var j = 0; j < aSelectFormat[i].options.length; j++){
					if (aSelectFormat[i].options[j].value == formats[i- 1].name){
						aSelectFormat[i].selectedIndex = j;
					}
				}

				for (var j = 0; j < aSelectPaper[i].options.length; j++){
					if (aSelectPaper[i].options[j].value == formats[i - 1].paper){
						aSelectPaper[i].selectedIndex = j;
					}
				}

				aInputAmount[i].value = formats[i - 1].amount;
				if(aInputAmount[i].value=="")
				    aInputAmount[i].value="1";
//				for (var j = 0; j < aSelectAmount[i].options.length; j++){
//					if (aSelectAmount[i].options[j].value == formats[i - 1].amount){
//						aSelectAmount[i].selectedIndex = j;
//					}
//				}
				
				for (var j = 0; j < aSelectframe[i].options.length; j++){
					if (aSelectframe[i].options[j].value == formats[i- 1].frame){
						aSelectframe[i].selectedIndex = j;
					}
				}
				
				for (var j = 0; j < aSelectfill[i].options.length; j++){
					if (aSelectfill[i].options[j].value == formats[i- 1].fill){
						aSelectfill[i].selectedIndex = j;
					}
				}
				
				for (var j = 0; j < aSelectfix[i].options.length; j++){
					if (aSelectfix[i].options[j].value == formats[i- 1].fix){
						aSelectfix[i].selectedIndex = j;
					}
				}
			}
			
			//Display selected image preview using <img> tag when only one item is selected. For multiple items blank area is displayed.
			if (typeof(selectedFileIndex) == "number")
			{
				thumbnail1.setGuid(imageUploader1.getUploadFileGuid(selectedFileIndex));
			}
			else{
				thumbnail1.setGuid("");
			}
			
			itemChange();
		}
		else{
			thumbnail1.setGuid("");
		}
	}
}


//This function is called when the user changes some order settings (like format name, paper type, or amount of items).
//Ordered format information is stored in the description field of Image Uploader items. 
function itemChange(){
	if (imageUploader1) {

		//Compile the string with ordered formats.
		var description = "";
		//alert(maxFormatCount);
		for (var i = 1; i <= maxFormatCount; i++){
			var SelectFormatN = document.getElementById("SelectFormat" + i);
			var SelectPaperN = document.getElementById("SelectPaper" + i);
			var InputAmountN = document.getElementById("InputAmount" + i);
			//var SelectAmountN = document.getElementById("SelectAmount" + i);
            var SelectFrameN = document.getElementById("SelectFrame" + i);
		    var SelectFillN = document.getElementById("SelectFill" + i);
		    var SelectFixN = document.getElementById("SelectFix" + i);
		
			var amount = parseInt(InputAmountN.value);

			//if (SelectFormatN.selectedIndex != 0 && SelectPaperN.selectedIndex != 0 && InputAmountN.value != ""  && SelectFrameN.selectedIndex != 0  && SelectFillN.selectedIndex != 0 && amount){
				//if (SelectFormatN.selectedIndex != 0 && SelectPaperN.selectedIndex != 0 && SelectFrameN.selectedIndex != 0  && SelectFillN.selectedIndex != 0 ){
				//if (SelectAmountN.selectedIndex != 0 ){
				if (InputAmountN.value != "" && amount ){
				var format = SelectFormatN.options[SelectFormatN.selectedIndex].value;
				var paper = SelectPaperN.options[SelectPaperN.selectedIndex].value;
				//var amount = SelectAmountN.options[SelectAmountN.selectedIndex].value;
				var frame = SelectFrameN.options[SelectFrameN.selectedIndex].value;
				var fill = SelectFillN.options[SelectFillN.selectedIndex].value;
				var fix = SelectFixN.options[SelectFixN.selectedIndex].value;

				if (description != ""){
					description = description + separator;
				}

				description = description + format + "_" + "x" + "_" + amount + "_" + paper + "_" +  + frame +  "_" + fill +  "_" + fix;
				//alert(description);
			}
		}
		
	   
		

		//Update desriptions of selected items and write ordered formats information into it.
		for (var i = 1; i <= imageUploader1.getUploadFileCount(); i++){
			if (imageUploader1.getUploadFileSelected(i)){
				imageUploader1.setUploadFileDescription(i, description);
				//alert(description);
				
			
                    
			}
		}
	 // PRICE VARIABLES
		var totalPrice=0
		var count=0
		var currentFormat=""
		var currentFix=""
		var totalCount=0
		
		var A9x13 = 0
		var A10x15 = 0
		var A13x18 = 0
		var A15x21 = 0
		var A18x24 = 0
		var A20x30 = 0
		var A25x38 = 0
		var A30x45 = 0
		var A30x40 = 0
		var APassport = 0
		
		var M9x13 = 0
		var M10x15 = 0
		var M13x18 = 0
		var M15x21 = 0
		var M18x24 = 0
		var M20x30 = 0
		var M25x38 = 0
		var M30x45 = 0


		
	 for (var i = 1; i <= imageUploader1.getUploadFileCount(); i++){
	        //if (imageUploader1.getUploadFileSelected(i)){
	        count=0
			var strDesc = imageUploader1.getUploadFileDescription(i)
			var temp = new Array();
            temp = strDesc.split('_');
                 
            //DESCRIPTION FORMAT: format + "_" + paper + "_" + "x" + "_" + amount + "_" + frame +  "_" + fill +  "_" + fix;
            
            //                          0             1            2              3             4             5             6
            //NEW DESCRIPTION FORMAT: format + "_" + "x" + "_" + amount + "_" + paper + "_" + frame +  "_" + fill +  "_" + fix;
         	//alert('kk');
         	
            try
                {
                currentFix=temp[6];
                //alert(currentFix)
                currentFormat=temp[0];
                count= eval(temp[2]);
                totalCount=totalCount + count;
                                
                // alert(currentFix + ';' + currentFormat + ';' + count );
                // Auto/Manual - 13X19 - 2
                
                
                if (currentFix == "Auto") 
                    {
                      switch (currentFormat) {
                         case "9x13": 
                            A9x13 = A9x13 + count;
                             break;
                         case "10x15": 
                            A10x15 = A10x15 + count;
                             break;
                            //alert(currentFormat);
                         case "13x18": 
                            A13x18 = A13x18 + count;
                             break;
                         case "15x21": 
                            A15x21 = A15x21 + count;
                             break;
                         case "18x24": 
                            A18x24 = A18x24 + count;
                             break;
                         case "20x30": 
                            A20x30 = A20x30 + count;
                             break;
                         case "25x38": 
                            A25x38 = A25x38 + count;
                             break;
                         case "30x45": 
                            A30x45 = A30x45 + count;
                             break;
                         case "30x40":
                            A30x40 = A30x40 + count;
                            break;
                         case "Passport":
                            APassport = APassport + count;
                            break;
                                           }
                     }
                     
                                            
                if (currentFix == "Manual") 
                    {
                      switch (currentFormat) {
                         case "9x13": 
                            M9x13 = M9x13 + count;
                            break;
                         case "10x15": 
                            M10x15 = M10x15 + count;
                            break;
                         case "13x18": 
                            M13x18 = M13x18 + count;
                            break;
                         case "15x21": 
                            M15x21 = M15x21 + count;
                            break;
                         case "18x24": 
                            M18x24 = M18x24 + count;
                            break;
                         case "20x30": 
                            M20x30 = M20x30 + count;
                            break;
                         case "25x38": 
                            M25x38 = M25x38 + count;
                            break;
                         case "30x45": 
                            M30x45 = M30x45 + count;
                            break;                                              }
                     }






                }
            catch(err)
                {
                    //alert(err)
                }
            
            



           if (currentFormat != "")
           {
               totalPrice=totalPrice + calcPriceWFormat(currentFormat,count,currentFix)
               //alert(count);
           }

// LAST LOOP           
if (imageUploader1.getUploadFileCount() == i )
{
var totalPriceNew = 0 
           if (A9x13 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("9x13",A9x13,"Auto");
           if (A10x15 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("10x15",A10x15,"Auto");
           if (A13x18 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("13x18",A13x18,"Auto");
           if (A15x21 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("15x21",A15x21,"Auto");
           if (A18x24 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("18x24",A18x24,"Auto");
           if (A20x30 > 0)
           {
                //alert(totalPriceNew);
                totalPriceNew = totalPriceNew + calcPriceWFormat("20x30",A20x30,"Auto");
                //alert("tot" + totalPriceNew);
            }
           if (A25x38 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("25x38",A25x38,"Auto");
           if (A30x45 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("30x45",A30x45,"Auto");
           if (A30x40 > 0)
           {
                //alert(totalPriceNew);
                totalPriceNew = totalPriceNew + calcPriceWFormat("30x40",A30x40,"Auto");
                //alert("tot" + totalPriceNew);
            }
            //alert(APassport);
           if (APassport > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("Passport",APassport,"Auto");
                
           if (M9x13 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("9x13",M9x13,"Maunal");
           if (M10x15 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("10x15",M10x15,"Maunal");
           if (M13x18 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("13x18",M13x18,"Maunal");
           if (M15x21 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("15x21",M15x21,"Maunal");
           if (M18x24 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("18x24",M18x24,"Maunal");
           if (M20x30 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("20x30",M20x30,"Maunal");
           if (M25x38 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("25x38",M25x38,"Maunal");
           if (M30x45 > 0)
                totalPriceNew = totalPriceNew + calcPriceWFormat("30x45",M30x45,"Maunal");

                
//                        alert('A9x13:' + A9x13);
//                        alert('A10x15:' + A10x15);
//                        alert('A13x18:' + A13x18);
//                        alert('A15x21:' + A15x21);
//                        alert('A18x24:' + A18x24);
//                        alert('A20x30:' + A20x30);
//                        alert('A25x38:' + A25x38);
//                        alert('A30x45:' + A30x45);
//                        alert('M9x13:' + M9x13);
//                        alert('M10x15:' + M10x15);
//                        alert('M13x18:' + M13x18);
//                        alert('M15x21:' + M15x21);
//                        alert('M18x24:' + M18x24);
//                        alert('M20x30:' + M20x30);
//                        alert('M25x38:' + M25x38);
//                        alert('M30x45:' + M30x45);

//alert(totalPriceNew)
totalPrice=totalPriceNew
//alert("totalPrice " + totalPrice);
}

           
           //totalPrice=totalPrice + (temp[3]* 1.2)
           
           
           //alert(currentFormat)
            //alert("1:" + totalPrice)
           //updatePrice(totalPrice,count) 
		
		 if (isNaN(totalPrice)==false)
          {
            //updatePrice(totalPrice,count)
           //alert("2:"+totalPrice) 
            
            //FROM THIS PAGE 
             document.getElementById("ImagePrice").value= Math.round(totalPrice*100)/100 // currentP
             document.getElementById("ImageCount").value= count//currentC
             //FROM photo.aspx
             document.getElementById("txtImages").value= Math.round(totalPrice*100)/100 //currentP
            //GET HOW TOTAL QUANTATIY EX: 1 IMAGE * 8 COPIES=8
            //UDCount(count)
             if (isNaN(totalCount)==false)
             {
                UDCount(totalCount)
                 UDCountImage(imageUploader1.getUploadFileCount())
               //alert(totalCount)
             }
            
            
             //var shipping=document.getElementById("txtShipping").value
             var shipping= document.getElementById("txtShipping").value
             shipping=shipping*1
             totalPrice=totalPrice*1
            //ROUND UP TO 2 NUM AFTER DECIMAL
             var result=Math.round((shipping + totalPrice)*100)/100 
             document.getElementById("OsumShow").value=result
             
             document.getElementById("spnSumShow").innerHTML=result
             document.getElementById("txtTotalSum").value =result

            
           }
       // }
       
       //INSIDE THE LOOP -----------------
       
      //alert(i);
    // CALC NEW PRICE ///////////////////////////////////////////////////////////////////
   	//var arrNewPrice = new Array();
    //temp = strDesc.split('_');
   //////////////////////////////////////////////////////////////////////////////////////

       }      
       
      //OUT SIDE THE LOOP  -----------------

    
    }
    
   
           
}

function calcSum(obj)
  {
    document.getElementById("txtShipping").value=obj;
    if (isNaN( document.getElementById("txtImages").value)== false)
    {
        document.getElementById("txtShipping").value=obj;
        
       var result=Math.round((document.getElementById("txtImages").value)*100)/100 
        
        document.getElementById("OsumShow").value=result + obj
          document.getElementById("spnSumShow").innerHTML= document.getElementById("OsumShow").value
        document.getElementById("txtTotalSum").value =result + obj
        
   }
  
  }
  
  function UDCount(count)
  {
  try
  {
    //var res= document.getElementById("txtCountImages").value;
    document.getElementById("txtTotalCount").value =count
    }
    catch(err){}
  
  }
  
   function UDCountImage(count)
  {
  try
  {
    //var res= document.getElementById("txtCountImages").value;
    document.getElementById("txtImageCount").value =count
    }
    catch(err){}
  
  } 
  
  function setDemo()
  {
    document.getElementById("SfnameTxt").value ="0"
    document.getElementById("SaddressTxt").value ="0"
    document.getElementById("SlnameTxt").value ="0"
    document.getElementById("ScityTxt").value ="0"
    document.getElementById("SphoneTxt").value ="0"
    document.getElementById("SzipTxt").value ="0"
     document.getElementById("ScellTxt").value ="0"
      document.getElementById("SemailTxt").value ="0@com.com"
      
  }
  
//CALCULATE PRICE BY FORMAT AND IMG-COUNT
function calcPriceWFormat(currentFormat,count,currentFix)
{
try{
count=count*1
var result = 0;
    //currentFix = EITHER AUTOMATIC FIXES OR MANUAL FIXES FOR THE PICTURES
        switch (currentFix) {
            case "Auto":
                  switch (currentFormat) {
                            
                         case "10x15": 
                             if (count >= 1 && count<= 99){
                               result = count * 0.79
                               return result
                             }

                             if (count >= 100 && count<= 249){
                               result = count * 0.69
                               return result
                             }

                             if (count >= 250){
                               result = count * 0.65
                               return result
                             }
                         break;
                            
                         case "13x18": 
                           if (count >= 1 && count<= 99){
                               result = count * 1.1
                               return result
                             }

                             if (count >= 100 && count<= 249){
                               result = count * 0.99
                               return result
                             }

                             if (count >= 250){
                               result = count * 0.89
                               return result
                             }
                        break;
                         
                         case "15x21": 
                          if (count >= 1 && count<= 99){
                               result = count * 2.5
                               return result
                             }

                             if (count >= 100 && count<= 249){
                               result = count * 2
                               return result
                             }

                             if (count >= 250){
                               result = count * 2
                               return result
                             }
                         break;
                         
                        case "20x30": 
                           if (count >= 1 && count<= 20){
                               result = count * 12
                               //alert(result);
                               return result
                             }

                             if (count >= 21){
                               result = count * 12
                               return result
                             }
                        break;
                            
                         case "30x40": 
                           
                           if (count >= 1 && count<= 20){
                               result = count * 25
                               //alert(result);
                               return result
                             }

                             if (count >= 21){
                               result = count * 25
                               return result
                             }
                         break;
                            
                         case "Passport": 
                           if (count >= 1 && count<= 20){
                               result = count * 10
                               return result
                             }

                             if (count >= 21){
                               result = count * 10
                               return result
                             }
                         break;
                            
                        default: result ;

                  }
                  
            break;
            
            case "Manual":
                switch (currentFormat) {
                     case "9x13": 
                          if (count >= 1 && count<= 100){
                           result = count * 1.1
                           return result
                         }

                         if (count >= 101 && count<= 500){
                           result = count * 1.1
                           return result
                         }

                         if (count >= 501){
                           result = count * 1.1
                           return result
                         }
                     break;
                        
                     case "10x15": 
                         if (count >= 1 && count<= 100){
                           result = count * 1.1
                           return result
                         }

                         if (count >= 101 && count<= 500){
                           result = count * 1.1
                           return result
                         }

                         if (count >= 501){
                           result = count * 1.1
                           return result
                         }
                      break;
                        
                     case "13x18": 
                       if (count >= 1 && count<= 100){
                           result = count * 1.95
                           return result
                         }

                         if (count >= 101 && count<= 500){
                           result = count * 1.5
                           return result
                         }

                         if (count >= 501){
                           result = count * 1.4
                           return result
                         }
                    break;
                     
                     case "15x21": 
                      if (count >= 1 && count<= 100){
                           result = count * 4
                           return result
                         }

                         if (count >= 101 && count<= 500){
                           result = count * 3.5
                           return result
                         }

                         if (count >= 501){
                           result = count * 3
                           return result
                         }
                     break;
                     
                     case "18x24": 
                       if (count >= 1 && count<= 20){
                           result = count * 13
                           return result
                         }

                         if (count >= 21){
                           result = count * 10.4
                           return result
                         }
                    break;
                     
                    case "20x30": 
                       if (count >= 1 && count<= 20){
                           result = count * 14
                           return result
                         }

                         if (count >= 21){
                           result = count * 11.2
                           return result
                         }
                     break;
                        
                     case "25x38": 
                       if (count >= 1 && count<= 20){
                           result = count * 22
                           return result
                         }

                         if (count >= 21){
                           result = count * 17.6
                           return result
                         }
                      break;
                        
                     case "30x45": 
                       if (count >= 1 && count<= 20){
                           result = count * 29
                           return result
                         }

                         if (count >= 21){
                           result = count * 23.2
                           return result
                         }
                    break;
                        
                    default: result ;
                  }
                  
            break;
            //default: result ;
        }

}
catch(err){}

}
//INSERT PRICE FOR ALL PICTURES OR FOR ONE PICTURE AT A TIME
function  updatePrice(totalPrice,count)
{
  //alert("2:"+totalPrice) 
   var currentP=0
   var currentC=0
   
      if (isNaN(totalPrice)== false)
         {
            // currentP=document.getElementById("ImagePrice").value
            // currentC=document.getElementById("ImageCount").value          
             
             //alert(currentP + "," + currentC)
             
            // if (isNaN(currentP)==false || currentP != 0 || currentP != "" && isNaN(currentC)==false || currentC != 0 || currentC != "")
            // { 
           
            //  currentP=(currentP*1) + Math.round(totalPrice*100)/100 
            //  currentC=(currentC*1)+(count*1)
              //alert(currentP)
              
             //FROM THIS PAGE 
             document.getElementById("ImagePrice").value= Math.round(totalPrice*100)/100 // currentP
             document.getElementById("ImageCount").value= count//currentC
                               
            
            
             //EX-HOW TO UPDATE FRAME
           //document.getElementById("frm").contentWindow.window.document.getElementById("fdown").value='tetete'
           
           
             //FROM photo.aspx
            // document.getElementById("txtImages").value=Math.round(totalPrice*100)/100 
             document.getElementById("txtImages").value= Math.round(totalPrice*100)/100 //currentP
            //GET HOW TOTAL QUANTATIY EX: 1 IMAGE * 8 COPIES=8
            UDCount(count)
            //UDCount(currentC)
            
             //var shipping=document.getElementById("txtShipping").value
             var shipping= document.getElementById("txtShipping").value
             shipping=shipping*1
             totalPrice=totalPrice*1
           //totalPrice=currentP
           
            //ROUND UP TO 2 NUM AFTER DECIMAL
             var result=Math.round((shipping + totalPrice)*100)/100 
             
             //document.getElementById("OsumShow").innerHTML=result
             document.getElementById("OsumShow").value=result
             
             //document.getElementById("ctl00_HolderBody_OrderDetails1_txtTotalSum").value =result
              document.getElementById("txtTotalSum").value =result
          }
            
         }
//]]>



