
function HideDateSelector() {
    document.getElementById('VisibleDeliveryDate').style.display = 'none';
    document.getElementById('VisibleDeliveryDate').style.visibility = 'visible';
}
     
function ShowDateSelector() {
    document.getElementById('VisibleDeliveryDate').style.display = 'block';
    document.getElementById('VisibleDeliveryDate').style.visibility = 'visible';
}


//HideDateSelector();


function SubmitDeliveryTimeEdit() { 
    document.pageForm.submit();
}

function SubmitItemDeletd(thisid) {
    
    if(confirm("Are you sure to delete this item?")){
        document.itemForm.myOperate.value="delete";
        document.itemForm.itemID.value=thisid;
        document.itemForm.submit();
    }
}

function SubmitItemEdit(thisid) {

    if(isNaN(eval("document.itemForm.Quantity"+thisid).value) || eval("document.itemForm.Quantity"+thisid).value*1<1){
        alert("Please enter the valid number ?");
        eval("document.itemForm.Quantity"+thisid).focus();
        return;     
    }
      
    document.itemForm.myOperate.value="edit";
    document.itemForm.itemID.value=thisid;
    document.itemForm.submit();
}

function SubmitItemEditShow(obj) {
    obj.style.display = 'block';
    obj.style.visibility="visible";
}

function SubmitItemEditHidden(obj) {
    obj.style.display = 'none';
    obj.style.visibility="hidden";
}


function SubmitSortForm(myname,myorder) {
    document.sortForm.sortorder.value=myorder;
    document.sortForm.sortname.value=myname;
    document.sortForm.submit();
}

function SubmitAddToCart() {
   return true;
   if(confirm("1.There are many items which are from other restaurant in your shopping cart ;\n2.So you can\'t add item from this restaurant now;\n3.if you continue,the old items will be removed."))
   {
        return true;
   }   
   return false;
}



function changeselect(obj,mytext){

    kk.style.visibility="visible";
    kk.style.top = obj.offsetTop+8 ; //obj.style.top;

    kk.style.left = obj.offsetLeft+180 ;
    
    
	var i;

    var number = new Array();
    
    
	number =mytext.split("|");
	
	
	
	
	 mytext = "<table width='200' height='150' border='0' cellpadding='0' cellspacing='0'>";
     mytext =mytext + "<tr>";
     mytext =mytext + " <td width='10' height='15' align='left' valign='bottom'><img src='images/zc_02.gif' width='9' height='15'></td>";
     mytext =mytext + " <td width='29' align='left' valign='bottom'><img src='images/zc_03.gif' width='29' height='15'></td>";
     mytext =mytext + " <td width='218' align='left' valign='bottom'><img src='images/zc_04.gif' width='272' height='15'></td>";
     mytext =mytext + " <td width='52' align='left' valign='bottom'><img src='images/zc_05.gif' width='9' height='15'></td>";
     mytext =mytext + "  </tr>";
     mytext =mytext + " <tr>";
     mytext =mytext + " <td height='113' align='left' valign='top' background='images/zc_07.gif'>&nbsp;</td>";
     mytext =mytext + "<td colspan='2' align='left' valign='top' bgcolor='#FFFFFF'>";
           
           mytext =mytext + "<table width='99%' height='99%'  border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='22' >&nbsp;DETAILS FOR: </td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='22' class='titccdfb'>&nbsp;<b>"+ number[0] +"</b><hr size=1></td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td >&nbsp;"+ number[9] +" <hr size=1></td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='22' >&nbsp;Estimated Delivery Time: <font color=#7B5212>"+ number[8] +"</font>  min.</td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='22' >&nbsp;Minimum Order:<font color=red> $"+ number[7] +" </font></td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='22' >&nbsp;Hours:<font color=#7B5212> "+ number[5] +"</font> - <font color=#7B5212>"+ number[6] +"</font></td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "</table>";
         
    mytext =mytext + " </td>";
    mytext =mytext + " <td align='left' valign='top' background='images/zc_09.gif'>&nbsp;</td>";
    mytext =mytext + "</tr>";
    mytext =mytext + "<tr>";
    mytext =mytext + "<td height='13' align='left' valign='top'><img src='images/zc_12.gif' width='9' height='13'></td>";
    mytext =mytext + " <td colspan='2' align='left' valign='top' background='images/zc_13.gif'>&nbsp;</td>";
    mytext =mytext + " <td align='left' valign='top' background='images/zc_15.gif'>&nbsp;</td>";
    mytext =mytext + " </tr>";
    mytext =mytext + " </table>";
     
         
    kk.innerHTML= mytext; 
	
}

function changeselect2(obj,mytext){

    kk.style.visibility="visible";
    kk.style.top = obj.offsetTop ; //obj.style.top;

    kk.style.left = obj.offsetLeft+100 ;
    
    
	var i;

    var number = new Array();
    
    
	number =mytext.split("|");
	
	
	
	
	 mytext = "<table width='150' height='50' border='0' cellpadding='0' cellspacing='0'>";
     mytext =mytext + "<tr>";
     mytext =mytext + " <td width='10' height='15' align='left' valign='bottom'><img src='images/zc_02.gif' width='9' height='15'></td>";
     mytext =mytext + " <td width='25' align='left' valign='bottom'><img src='images/zc_03.gif' width='25' height='15'></td>";
     mytext =mytext + " <td width='130' align='left' valign='bottom'><img src='images/zc_04.gif' width='130' height='15'></td>";
     mytext =mytext + " <td width='11' align='left' valign='bottom'><img src='images/zc_05.gif' width='9' height='15'></td>";
     mytext =mytext + "  </tr>";
     mytext =mytext + " <tr>";
     mytext =mytext + " <td height='113' align='left' valign='top' background='images/zc_07.gif'>&nbsp;</td>";
     mytext =mytext + "<td colspan='2' align='left' valign='top' bgcolor='#FFFFFF'>";
           
           mytext =mytext + "<table width='99%' height='99%'  border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='25' >"+  number[0] +"</td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='25' >Price:</b><font color=red> $"+ number[1] +"</font></td>";
           mytext =mytext + "</tr>";
           if(number[3]!="skins/skin_1/images/nopicture.gif"){
                mytext =mytext + "<tr>";
                mytext =mytext + "<td ><img src='"+ number[3] +"' width='60' height='55'><hr size=1></td>";
                mytext =mytext + "</tr>";
           }else{
                mytext =mytext + "<tr>";
                mytext =mytext + "<td ><hr size=1></td>";
                mytext =mytext + "</tr>";
           }
           mytext =mytext + "<tr>";
           mytext =mytext + "<td valign='top'>&nbsp;"+ number[2] +"</td>";
           mytext =mytext + "</tr>";

           mytext =mytext + "</table>";
         
    mytext =mytext + " </td>";
    mytext =mytext + " <td align='left' valign='top' background='images/zc_09.gif'>&nbsp;</td>";
    mytext =mytext + "</tr>";
    mytext =mytext + "<tr>";
    mytext =mytext + "<td height='13' align='left' valign='top'><img src='images/zc_12.gif' width='9' height='13'></td>";
    mytext =mytext + " <td colspan='2' align='left' valign='top' background='images/zc_13.gif'>&nbsp;</td>";
    mytext =mytext + " <td align='left' valign='top' background='images/zc_15.gif'>&nbsp;</td>";
    mytext =mytext + " </tr>";
    mytext =mytext + " </table>";
     
         
    kk.innerHTML= mytext; 
	
}

//changeselect3(c262,'Leo\'s Delightin Sandwich||10.00||1||6@Bread Selection%White Bread@2.00/8@French Fried Potatoes or Baked Beans%Baked Beans@0||7@Omelette Additions%Bacon@1.05|Sausage@2.00|Tongue@1.00');
//changeselect3(c263,'Leo\'s Delightin Sandwich||10.00||1||6@Bread Selection%White Bread@2.00/8@French Fried Potatoes or Baked Beans%Substitute Cottage Cheese@1.00||');
//changeselect3(c264,'Leo\'s Delightin Sandwich||10.00||1||6@Bread Selection%White Bread@2.00/8@French Fried Potatoes or Baked Beans%Baked Beans@0||7@Omelette Additions%Bacon@1.05');
//changeselect3(c265,'Leo\'s Delightin Sandwich||10.00||1||6@Bread Selection%White Bread@2.00/8@French Fried Potatoes or Baked Beans%Baked Beans@0||7@Omelette Additions%Bacon@1.05|Sausage@2.00|Tongue@1.00/5@Scrambled&Pancake Style%Pancake Style@2.05');
function changeselect3(obj,mytext){

   // return;
    
    kk.style.visibility="visible";
    kk.style.top = obj.offsetTop-15 ; //obj.style.top;

    kk.style.left = obj.offsetLeft+5 ;
    
    
	var k=0;

    var number = new Array();
    
    
	number =mytext.split("||");
	

	 mytext = "<table width='200' height='80' border='0' cellpadding='0' cellspacing='0'>";
     mytext =mytext + "<tr>";
     mytext =mytext + " <td width='10' height='15' align='left' valign='bottom'><img src='images/zc_02.gif' width='9' height='15'></td>";
     mytext =mytext + " <td width='25' align='left' valign='bottom'><img src='images/zc_03.gif' width='25' height='15'></td>";
     mytext =mytext + " <td width='180' align='left' valign='bottom'><img src='images/zc_04.gif' width='180' height='15'></td>";
     mytext =mytext + " <td width='11' align='left' valign='bottom'><img src='images/zc_05.gif' width='9' height='15'></td>";
     mytext =mytext + "  </tr>";
     mytext =mytext + " <tr>";
     mytext =mytext + " <td  align='left' valign='top' background='images/zc_07.gif'>&nbsp;</td>";
     mytext =mytext + "<td colspan='2' align='left' valign='top' bgcolor='#FFFFFF'>";
           
           mytext =mytext + "<table width='99%' height='99%'  border='0' cellpadding='0' cellspacing='0' bgcolor='#FFFFFF'>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='20' >&nbsp;"+  number[0] +"</td>";
           mytext =mytext + "</tr>";
           mytext =mytext + "<tr>";
           mytext =mytext + "<td height='15' >&nbsp;Price: <font color=red>$"+ number[1] +"</font></td>";
           mytext =mytext + "</tr>";
            mytext =mytext + "<tr>";
           mytext =mytext + "<td height='15' >&nbsp;Quantity:<font color=red> "+ number[2] +"</font></td>";
           mytext =mytext + "</tr>";
           
           ytext =mytext + "<tr>";
           mytext =mytext + "<td height='15' ><hr size=1></td>";
           mytext =mytext + "</tr>";
           
           
           //1@Sour Cream&Applesauce%Applesauce@0/6@Testing%bbb@2.00
           
           if(number[3]!=""){
           
               var tempRadioList=number[3].split("/");
               var i;
               
               for(i=0;i<tempRadioList.length;i++){ 
                   mytext =mytext + "<tr>";
                   mytext =mytext + "<td >&nbsp;"+ (k*1+1) +"."+ tempRadioList[i].split("%")[0].split("@")[1] +"<br>&nbsp;&nbsp;&nbsp;&nbsp;"+ tempRadioList[i].split("%")[1].replace("@",":<font color=red>$") +"</font></td>";
                   mytext =mytext + "</tr>"; 
                   
                   k+=1;
               }
           
           }
           
           //7@Check%111@1|222@2/5@Scrambled&Pancake Style%Scrambled@1.50|Pancake Style@2.05
           
           if(number[4]!=""){
           
               var tempCheckboxList=number[4].split("/");
               var i;
               
               for(i=0;i<tempCheckboxList.length;i++){ 
                   mytext =mytext + "<tr>";
                   mytext =mytext + "<td >&nbsp;"+ (k*1+1) +"."+ tempCheckboxList[i].split("%")[0].split("@")[1] +"<br>&nbsp;&nbsp;&nbsp;&nbsp;"+ tempCheckboxList[i].split("%")[1].replace(/\@/g,":<font color=red>$").replace(/\|/g,"</font><br>&nbsp;&nbsp;&nbsp;&nbsp;") +"</td>"; //tempCheckboxList[i].split("%")[1].replace(/\@/g,":$").replace(/\|/g,"<br>&nbsp;&nbsp;&nbsp;")
                   mytext =mytext + "</tr>"; 
                   
                   k+=1;
               }
           
           }
           

           mytext =mytext + "</table>";
         
    mytext =mytext + " </td>";
    mytext =mytext + " <td align='left' valign='top' background='images/zc_09.gif'>&nbsp;</td>";
    mytext =mytext + "</tr>";
    mytext =mytext + "<tr>";
    mytext =mytext + "<td height='13' align='left' valign='top'><img src='images/zc_12.gif' width='9' height='13'></td>";
    mytext =mytext + " <td colspan='2' align='left' valign='top' background='images/zc_13.gif'>&nbsp;</td>";
    mytext =mytext + " <td align='left' valign='top' background='images/zc_15.gif'>&nbsp;</td>";
    mytext =mytext + " </tr>";
    mytext =mytext + " </table>";
     
         
    kk.innerHTML= mytext; 
	
}

function myhidden(){
    kk.style.visibility="hidden";
    kk.innerHTML= "";

}


//show message box

function showMessageBox(num,rel1,rel2,rel3){

    var message;
    var bool=false;
    
    switch(num){
        case 1:
            message="Sorry, this restaurant stop place order now.";
            break;
        case 2:
            message="Sorry,your order total price must be over $" + rel1;
            break;
        case 3:
            break;
        case 4:
            bool=false;
            break;
    }
    
    
    alert(message);
    
    return bool;
    

}


function strlen(str) 
{ 
    var len; 
    var i; 
    len = 0; 
    for (i=0;i<str.length;i++) 
    { 
    if (str.charCodeAt(i)>255) len+=2; else len++; 
    } 
    return len; 
} 

function getstr(str,maxlength) 
{ 
    var len=0 
    var i,j; 
    len = 0; 
    j=0;
    for (i=0;i<str.length;i++) 
    { 
       if (str.charCodeAt(i)>255) len+=2; else len++; 
       if(len>maxlength){return str.substring(0,j)};
       j++;
    } 
    return str; 
} 


function is_null(object_name,tishi,word,kongge)  // object_name ?????,tishi=1 ????????,word ?????,kongge=1 ?????,
{
    var string;
    string=new String(object_name);
    if (kongge==1){string=javaTrim(string);}
   
   
   //alert("??????="+string+"???="+string.length)

     if (string.length==0){
      if (tishi==1)
      {
      alert(word);
      }
      return false;  
        }
  }
   
  //????????????

 function javaTrim(str){
		var i=0;
		var j;
		var len=str.length;
		
		trimstr="";
		if(j<0) return trimstr;
		flagbegin= true;
		flagend= true;
		
        while (flagbegin== true){
			if (str.charAt(i)==" "){
				i++;
				flagbegin=true;
			}
			else
            {
			    
                flagbegin=false;
			}
		} 
           //???i???
        
       
        
        j=len-1;
		var k=0;
        while (flagend==true)
       {
			if (str.charAt(j)==" ")
            {
				j--;
                flagend=true;
                k++;
			}
			else{
				flagend=false;
			}
		}
        
        //???k???
        //alert('???'+i+'???!');
        //alert('???'+k+'???!');
        
        if (str.length==i)
        {
         //alert("????????!")
         trimstr="";
         return trimstr;
         
        }

		trimstr=str.substring(i,j+1);
	    //alert("bf"+trimstr+"fb");
        return trimstr;
	}
	
	

function getCityCategory(CityID,CategoryID)
{
	if(CityID!='0'){
		document.location="classifiedbuyad.aspx?CategoryID=" + CategoryID +"&CityID="+ CityID;
	}
}



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];}
}


