﻿function checkAllPage(idcheckall, idcheckitem1, idcheckitem2, idcheckitem3) {
    var chk = document.getElementById(idcheckall);
    var bState = chk.checked;

    var frm = document.forms[0];
     for (i = 0; i < frm.length; i++) {
        var e = frm.elements[i];
        
        if (e.id.indexOf(idcheckitem1) != -1) {
           
            e.checked = bState;
        }
    }
    if (idcheckitem2 != ''){
   var chk2 = document.getElementById(idcheckitem2) ;  
  chk2.checked = bState;
  }
   var chk3 = document.getElementById(idcheckitem3);
   
    chk3.checked = bState;
}

function myPostBack(status,argName,argVal) 
{
    if (arguments[3] == true) {
        var validationGroup = "";
        if(arguments[4]){
            validationGroup = arguments[4];
        }
        if (typeof(Page_ClientValidate) == 'function') {
            Page_ClientValidate(validationGroup);
        }
    }

    var theForm = document.forms[0];
    if (!theForm.onsubmit || (theForm.onsubmit() != false)) {
        var hdnStatus = document.getElementById("status");
        if(hdnStatus)hdnStatus.value = status;
        var hdnArgument = document.getElementById(argName);
        if(hdnArgument)hdnArgument.value = argVal;
        theForm.submit();
    }
}

function HaveChecked(idcheckitem)
{
    var frm = document.forms[0];
    for (i = 0; i < frm.length; i++) {
        var e = frm.elements[i];
        if (e.id.indexOf(idcheckitem) != -1) {
            if(e.checked){
                return true;
            }
        }
    }
    alert("You currently have no data selected.");
    return false;
}

function confirmDelete(idcheckitem)
{
    var frm = document.forms[0];
    for (i = 0; i < frm.length; i++) {
        var e = frm.elements[i];
        if (e.id.indexOf(idcheckitem) != -1) {
            if(e.checked){
                return confirm("Are you sure you want to delete this? This will be deleted immediately, and there is no undo facility. Please click OK to delete or Cancel.");
            }
        }
    }
    alert("You currently have no data selected.");
    return false;
}

function confirmDeleteForum()
{  //------ 'cause if want to edit text when delete forum alert -------
    return confirm("Are you sure you want to delete this? This will be deleted immediately, and there is no undo facility. Please click OK to delete or Cancel.");
}
function confirmSendMailAdsExp(idcheckitem)
{
    var frm = document.forms[0];
    for (i = 0; i < frm.length; i++) {
        var e = frm.elements[i];
        if (e.id.indexOf(idcheckitem) != -1) {
            if(e.checked){
                return confirm("Are you sure you would like to send the reminder to the selected members? ");
            }
        }
    }
    alert("You currently have no data selected.");
    return false;
}

function confirmDelete1()
{
    return confirm("Are you sure you want to delete this? This will be deleted immediately, and there is no undo facility. Please click OK to delete or Cancel.");
}

function isNumeric(obj)
{
    return /^\d+$/.test(obj);
}

//CtrlName.Attributes("onkeypress") = "return checknum(arguments[0] , 'd','" & CtrlName.ClientID & "')"
function checknum(e, n, values) {
    if (!e) {
        e = window.event;
    }
    
    if (typeof e.which == "number") {
        e = e.which;
    } else if (typeof e.keyCode == "number") {
        e = e.keyCode;
    } else if (typeof e.charCode == "number") {
        e = e.charCode;
    }
    
    if (e >= 48 && e <= 57 ||e == 13 || e == 8 || e == 0 || n == "d" && e == 46) {
        if ((e == 46 && values != "") && document.getElementById(values).value.indexOf(".") > -1){
            return false;
        } else {
            return true;
        }
    } else {
        return false;
    }
    
    var i = 1;
}

//CtrlName.Attributes("onblur") = "return changefloat(this)"
function changefloat(txt)
{ var p = txt.value ;
  if ( p == '') { p = 0 ; }
  txt.value = parseFloat(p).toFixed(2) ;   
}


function fixnumberkeypass(e,txt)
{checknum(e, "d", txt.id)

}
			
function inputEmpty(def,item) {
    if ( item.value == '' ){
        item.value = def;
    }
}

function inputnumempty(def,item) {
    if ( item.value == '' || item.value == 0){
        item.value = def;
    }
}

function htmlencode(str){
    str = str.replace("<","&lt;");
    str = str.replace(">","&gt;");
    return str;
}

function htmldecode(str){
    str = str.replace("&gt;",">");
    str = str.replace("&lt;","<");
    return str;
}

function openWindow(url, name, w, h, scl, p)
{
    w += 32;
    h += 20;
    wleft = (screen.width - w) / 2;
    wtop = ((screen.height - h) / 2) - 50;
    if (wleft < 0) {
        w = screen.width;
        wleft = 0;
    }
    if (wtop < 0) {
        h = screen.height;
        wtop = 0;
    }
    p += (",width=" + w + ",height=" + h + ",top=" + wtop + ",left=" + wleft + ",scrollbars=" + scl);
    var win = window.open(url, name, p);
    win.focus();
}
function checkAlllocation(idcheckall, idcheckitem) {
    var chk = document.getElementById(idcheckall);
    var bState = chk.checked;
    
    var frm = document.forms[0];
    for (i = 0; i < frm.length; i++) {
        var e = frm.elements[i];
        if (e.id.indexOf(idcheckitem) != -1) {
            e.checked = bState;
        }
    }
}

 function checkAll(idcheckall, idcheckitem) {
    var chk = document.getElementById(idcheckall);
    var bState = chk.checked;

    var frm = document.forms[0];
     for (i = 0; i < frm.length; i++) {
        var e = frm.elements[i];
        
        if (e.id.indexOf(idcheckitem) != -1) {
           
            e.checked = bState;
        }
    }
}

 function checkChanged(idcheckall, idcheckitem){
    var frm = document.forms[0];
    var bAllChecked = true;
        
    for (i = 0; i < frm.length; i++) {
        var e = frm.elements[i];
        if (e.id.indexOf(idcheckitem) != -1) {
            if (e.checked == false) bAllChecked = false; 
        }
    }
    
    if (document.getElementById(idcheckall)) {
        var checkAll =  document.getElementById(idcheckall);
    if(bAllChecked) checkAll.checked = true; else checkAll.checked = false;
    }
}

function checkAll_match(idcheckall, idcheckitem) {

   var chk = document.getElementById(idcheckall);
   var bState = chk.checked;
   var frm = jQuery("input[@type=checkbox]") ;
    
    frm.each(function(){
        if(this.name == idcheckitem) 
        {
           this.checked = bState;
        }
   });
}


//get jQuery object from id of element
function jsget(ctrl){ return jQuery("[@id="+ ctrl +"]");}
//call ajax from checkbox
function ajaxCheckBox(furl, callId, id, imgId, chkImg, nochkImg, waitImg)
{
    var img = jsget(imgId);
    if(img.attr("src") == waitImg) return;
    
    var checked = (img.attr("src") == chkImg);
    img.attr("src", waitImg);
    
    var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&val='+escape(checked);
    jQuery.ajax({
        type: "GET",
        url: furl,
        data: qry,
        success: function(msg){
            if(msg == "1"){
                img.attr("src", chkImg);
                if(callId=='blockmemberlist'){
                    img.attr("alt", 'Unblock Member');
                    img.attr("title", 'Unblock Member');
                }
            }else{
                img.attr("src", nochkImg);
                if(callId=='blockmemberlist'){
                    img.attr("alt", 'Block Member');
                    img.attr("title", 'Block Member');
                }
            }
        },
        fail: function(msg){
            alert('ajaxCheckBox failed');
        }
        });
}

function ajaxTextBoxBegin(lblId, txtId)
{
    jsget(lblId).css("display", "none");
    var jqrtxt = jsget(txtId);
    jqrtxt.css("display", "inline");
    var txt = jqrtxt.get(0);
    txt.focus();
    txt.select();
}

function ajaxTextBox(e, furl, callId, id, lblId, txtId, imgWaitId)
{
    var evt = e?e:window.event;
	  evt.cancelBubble = true;
	  if (evt.stopPropagation) evt.stopPropagation();
	
	  if(evt.keyCode == "13"){
        var lbl = jsget(lblId);
        var txt = jsget(txtId);
        var waitImg = jsget(imgWaitId);
        var oldval = lbl.html();
        var newval = txt.val();
        
        lbl.css("display", "none");
        txt.css("display", "none");
        waitImg.css("display", "inline");
        
        var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&val='+escape(newval);
        jQuery.ajax({
            type: "GET",
            url: furl,
            data: qry,
            success: function(msg){
                if(msg == "1"){
                    lbl.html(htmlencode(newval));
                    txt.val(newval);
                    if(lbl.html() == "")
                    {
                        lbl.html("-");
                    }
                }else{
                    lbl.html(htmlencode(oldval));
                    txt.val(oldval);
                }
                lbl.css("display", "inline");
                txt.css("display", "none");
                waitImg.css("display", "none");
            },
            fail: function(msg){
                alert('ajaxTextBox failed');
            }
            });
	}else if(evt.keyCode == "27"){
        jsget(lblId).css("display", "inline");
        jsget(txtId).css("display", "none");
	}
}

function ajaxTextBoxNumber(e, furl, callId, id, lblId, txtId, imgWaitId)
{
    var evt = e?e:window.event;
	evt.cancelBubble = true;
	if (evt.stopPropagation) evt.stopPropagation();
    	
	if(evt.keyCode == "13"){
        var lbl = jsget(lblId);
        var txt = jsget(txtId);
        var waitImg = jsget(imgWaitId);
        var oldval = lbl.html();
        var newval = txt.val();
        
        lbl.css("display", "none");
        txt.css("display", "none");
        waitImg.css("display", "inline");
            
        var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&val='+escape(newval);
        jQuery.ajax({
            type: "GET",
            url: furl,
            data: qry,
            success: function(msg){
                if(msg == "1"){
                    lbl.html(FormatNumber(newval,2));
                    txt.val(newval);
                    if(lbl.html() == "")
                    {
                        lbl.html("-");
                    }
                }else{
                    lbl.html(htmlencode(oldval));
                    txt.val(oldval);
                }
                //lbl.html(msg);
                lbl.css("display", "inline");
                txt.css("display", "none");
                waitImg.css("display", "none");
            },
            fail: function(msg){
                alert('ajaxTextBox failed');
            }
            });
	}else if(evt.keyCode == "27"){
        jsget(lblId).css("display", "inline");
        jsget(txtId).css("display", "none");
	}else if((evt.charCode>="48" && evt.charCode<="57") || evt.charCode=="8" || evt.charCode=="0"){
	    return true;
	}else if(evt.charCode=="46"){
	    var val = jsget(txtId).val(); 
	    if (val.indexOf(".") > -1){
            return false;
        } else {
            return true;
        }
	}else{return false;}
}

function ajaxTinyTextBoxBegin(lblId, divTxtId, txtId, lnkEditId, lnkSaveId, lnkCancelId)
{
    jsget(lblId).css("display", "none");
    jsget(divTxtId).css("display", "inline");
    jsget(lnkEditId).css("display", "none");
    jsget(lnkSaveId).css("display", "inline");
    jsget(lnkCancelId).css("display", "inline");
    
    var jqrtxt = jsget(txtId);
    var txt = jqrtxt.get(0);
    
//    txt.focus();
//    txt.select();
}

function ajaxTinyTextBoxCancel(lblId, divTxtId, txtId, lnkEditId, lnkSaveId, lnkCancelId)
{
    jsget(lblId).css("display", "inline");
    jsget(divTxtId).css("display", "none");
    jsget(lnkEditId).css("display", "inline");
    jsget(lnkSaveId).css("display", "none");
    jsget(lnkCancelId).css("display", "none");
}

function ajaxTinyTextBox(furl, callId, id, lblId, divTxtId, txtId, lnkEditId, lnkSaveId, lnkCancelId, imgWaitId)
{
    var lbl = jsget(lblId);
    var divTxt = jsget(divTxtId);
    var txt = jsget(txtId);
    var lnkEdit = jsget(lnkEditId);
    var lnkSave = jsget(lnkSaveId);
    var lnkCancel = jsget(lnkCancelId);
    var waitImg = jsget(imgWaitId);
    var hdnVal = jsget("val");
    
    var oldval = lbl.html();
    var newval = tinyMCE.getContent(txtId);

	lbl.css("display", "none");
    divTxt.css("display", "none");
    lnkEdit.css("display", "none");
    lnkSave.css("display", "none");
    lnkCancel.css("display", "none");
    waitImg.css("display", "inline");
    
    var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&val='+escape(newval);
    jQuery.ajax({
        type: "POST",
        url: furl,
        data: qry,
        success: function(msg){
            if(msg == "1"){
                lbl.html(newval);
                txt.val(newval);
                if(lbl.html() == "")
                {
                    lbl.html("-");
                }
            }else{
                lbl.html(oldval);
                txt.val(oldval);
            }
            lbl.css("display", "inline");
            divTxt.css("display", "none");
            lnkEdit.css("display", "inline");
            lnkSave.css("display", "none");
            lnkCancel.css("display", "none");
            waitImg.css("display", "none");
        },
        fail: function(msg){
            alert('ajaxTinyTextBox failed');
        }
        });
}

function ajaxMultiLineTextBoxBegin(lblId, divTxtId, txtId){
    jsget(lblId).css("display", "none");
    jsget(divTxtId).css("display", "inline");
    jsget(txtId).css("display", "inline");
    
    var jqrtxt = jsget(txtId);
    var txt = jqrtxt.get(0);
    txt.focus();
    //txt.select();
}

function ajaxMultiLineTextBoxCancel(lblId, divTxtId)
{
    jsget(lblId).css("display", "inline");
    jsget(divTxtId).css("display", "none");
}

function ajaxMultiLineTextBox(e, furl, callId, id, lblId, txtId, divTxtId, imgWaitId)
{
    var lbl = jsget(lblId);
    var txt = jsget(txtId);
    var divTxt = jsget(divTxtId);
    var waitImg = jsget(imgWaitId);
    var oldval = lbl.html();
    var newval = txt.val().replace(/\n/gi,'<br />');
    
    lbl.css("display", "none");
    txt.css("display", "none");
    waitImg.css("display", "inline");
    
    var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&val='+escape(newval);
    jQuery.ajax({
        type: "POST",
        url: furl,
        data: qry,
        success: function(msg){
            if(msg == "1"){
                lbl.html(newval);
                //txt.val(newval);
                if(lbl.html() == "")
                {
                    lbl.html("-");
                    if (escape(callId) == "ajx_ads_googlezoom") 
                    {var tr = jsget("Gtr_"+escape(id));
                    tr.css("display", "none");
                    }
                }else if (escape(callId) == "ajx_ads_googlezoom") {lbl.html('Zoom Level: '+newval);}
            }else{
                lbl.html(htmlencode(oldval));
                
                txt.val(oldval);
            }
            lbl.css("display", "inline");
            divTxt.css("display", "none");
            waitImg.css("display", "none");
        },
        fail: function(msg){
            alert('ajaxTextBox failed');
        }
        });
}

function ajaxImageDel(furl, callId, imgid, id, key ,table, hplinkid,imgname, waitImg)
{
	if ( confirmDelete1()==false) {
	return false;
	}  
  
    var img = jsget(imgid);

	if (key!='filename'){
	    if(img.attr("src")){
		  if(img.attr("src") == waitImg) return;
          img.attr("src", waitImg);
         }
	}	
    var hplink = jsget(hplinkid);
    var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&table='+escape(table)+'&key='+escape(key)+'&Imgname='+escape(imgname);
	
    jQuery.ajax({
        type: "GET",
        url: furl,
        data: qry,
        success: function(msg){
      
           //img.attr("src","");
          
		   img.css("display", "none");
		   hplink.css("display", "none");
		   
        },
        fail: function(msg){
            alert('Delete Image failed');
        }
        });	 
}
$id = function(ids) { return document.getElementById(ids);}

function Replace(str){
if (str==null){return null;}
for(var i=0;str.charAt(i)==" ";i++);
return str.substring(i,str.length);
}


ajaxChkDup = function(furl, callId, iddiv, table ,key,txtbox ,id,gid)
{   
 var str = $id(txtbox).value ;

 str=str.replace("&","amp;")
  str=str.replace("+","amt;")
  
var qry = '../../Ajax/ajaxChkDupplicate.aspx?'+'cid='+escape(callId)+'&id='+escape(id)+'&table='+escape(table)+'&datakey='+escape(key)+'&txtcompare='+str+'&gid='+gid;
   
 jQuery.ajax({
        type: "GET",
        url: furl,
        data: qry,
        async: false,
        success: function(msg){
        
        
        if (msg == 'True') {
			   $id(iddiv).innerHTML='There is exist in system';
               $id(iddiv).style.display = '' ; return false ;    }
        else
            {  $id(iddiv).style.display = 'none' ;   return true ;  }

        },
        fail: function(msg){
            alert('Delete Image failed');
        }
        });	
        
 if ($id(iddiv).style.display == '')
     { return false ; } 

//var url = '../../Ajax/ajaxChkDupplicate.aspx?'+'cid='+escape(callId)+'&id='+escape(id)+'&table='+escape(table)+'&datakey='+escape(key)+'&txtcompare='+str+'&gid='+gid;
//   
//   
//    var xmlHttpObj; 
//     


//    xmlHttpObj = getXMLHTTP(xmlHttpObj);     
//   
//             
//         xmlHttpObj.open("GET",url,false);    
//         xmlHttpObj.onreadystatechange = function(){ 
//        
//        if(xmlHttpObj.readyState == 4)
//          {
//			     
//            if (xmlHttpObj.responseText == 'True') {
//			    $id(iddiv).innerHTML='There is exist in system';
//               $id(iddiv).style.display = '' ;  }
//            else
//            {   $id(iddiv).style.display = 'none' ;    }
//            
//          }
//         }
//         
//         xmlHttpObj.send(null);        
//        if ($id(iddiv).style.display == '')
//             { return false ; }

   
}
 
  
function ajaxSetDefault(furl, callId,iddel, idimg,table,key, id)
{

    var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&table='+escape(table)+'&key='+escape(key);
    jQuery.ajax({
        type: "GET",
        url: furl,
        data: qry,
        success: function(msg){
          
           all=document.getElementsByTagName("input");
            for(i=0;i<all.length;i++)
            {
            if(all[i].type=="radio")/*Checking if it is a radio button*/
             {all[i].checked=false; 
             }else{
             if(all[i].type=="checkbox")
             all[i].style.display='';
             }
            }
           $id(idimg).checked=true;
           $id(iddel).style.display='none';
        },
        fail: function(msg){
            alert('ajaxset default failed');
        }
        });
}

function ajaxChkDefault(furl, callId,gid, id, val,table)
{
	
	
	var waitImg='../../Images/nocheck.gif'   

    var qry = 'cid='+escape(callId)+'&gid='+escape(gid)+'&id='+escape(id)+'&table='+escape(table)+'&val='+escape($id(val).checked);
    jQuery.ajax({
        type: "GET",
        url: furl,
        data: qry,
        success: function(msg){
        //alert(msg==false)
        if(msg=='false'){
        alert("You can only select 1 items per category!")
         $id(val).checked=false;
        }
     
        },
        fail: function(msg){
            alert('ajaxCheckBox failed');
        }
        });
}

function displaytable()
{
	$id('TBList').style.display='none';
	
}
function chkprice(x,y,z)
{
	
	x=($id(x).value).replace(",","")
	y=($id(y).value).replace(",","")

if ((x=='')||(y=='')){
$id(z).innerHTML='* Required !'
return false;}

if (parseInt(x) >=parseInt(y)){
$id(z).innerHTML='* no match !'
return false;}



}
function getXMLHTTP(){
    var A=null;
    try{
	    A=new ActiveXObject('Msxml2.XMLHTTP');
    }catch(e){
	    try{
		    A=new ActiveXObject('Microsoft.XMLHTTP');
	    }catch(oc){
		    A=null;
	    }
    }
	
    if(!A&&typeof XMLHttpRequest!='undefined'){
	    A=new XMLHttpRequest();
    }
    return A;
}

function AjaxDropDown(ddl,callId,id,funcPage){ //   what about ID mean..
    var selVal = ddl.options[ddl.selectedIndex].value;    
   
//    if(ddl.selectedIndex == -1 || selVal == -1 || selVal == 0){
//     
//        var child = document.getElementById(childId); //  How to Get ChildID -- It make script error !!
//        for(var i=child.length-1;i>0;i--){
//            child.options[i]=null;
//        }
//        if(child.fireEvent){
//          child.fireEvent('onchange');
//        }else if(child.dispatchEvent){
//          var oEvent=document.createEvent('HTMLEvents');
//          oEvent.initEvent('change',true,true);
//          child.dispatchEvent(oEvent);
//        }
//        return;
//    }
        
    var qry='cid='+escape(callId)+'&id='+id+'&val='+selVal;
    ddl.disabled = true;
    jQuery.ajax({
        type: "GET",
        url: funcPage,
        data: qry,
        success: function(msg){
            ddl.disabled = false; 
        },
        fail: function(msg){
            alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
        }
        });	   
    
}

//////////////////////////////////////////////////////
function AjaxDropDownAdv(ddl,callId,id,funcPage,dataPage){ 
    var selVal = ddl.options[ddl.selectedIndex].value;
    var vals = selVal.split(",");
    
    var qry='cid='+escape(callId)+'&id='+id+'&val='+vals[0];
    ddl.disabled = true;
    jQuery.ajax({
        type: "GET",
        url: funcPage,
        data: qry,
        success: function(msg){
            ddl.disabled = false; 
        },
        fail: function(msg){
            alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
        }
        });	   
     
    if (callId == "ads_cateory")    
        {
      document.getElementById("Tr_position_"+id ).style.display = "none" ;
      document.getElementById("Tr_seek_"+id ).style.display = "none" ;
      document.getElementById("Tr_relation_"+id ).style.display = "none" ;
         if (vals[1] == "11")
            {                  
                document.getElementById("Tr_position_"+id ).style.display = "" ;
                AjaxDropDownChange(ddl,"position_"+id ,"jobpost",dataPage)
               
             }
         else if(vals[1] == "12")
             {
                document.getElementById("Tr_seek_"+id ).style.display = "" ;
                document.getElementById("Tr_relation_"+id ).style.display = "" ;
             }    
        }   
   
    
   
}

//////////////////////////////////////////////////////

function AjaxDropDownChange(ddl,childId,callId,funcPage){
    var selVal = ddl.options[ddl.selectedIndex].value;
    
    var vals = selVal.split(",");
    selVal = vals[0] ;
    if(ddl.selectedIndex == -1 || selVal == -1 || selVal == 0){
        var child = document.getElementById(childId);
        for(var i=child.length-1;i>0;i--){
            child.options[i]=null;
        }
        if(child.fireEvent){
          child.fireEvent('onchange');
        }else if(child.dispatchEvent){
          var oEvent=document.createEvent('HTMLEvents');
          oEvent.initEvent('change',true,true);
          child.dispatchEvent(oEvent);
        }
        return;
    }
    
    var qry='cid='+escape(callId)+'&parent_id='+escape(selVal);
    
    jQuery.ajax({
        type: "GET",
        url: funcPage,
        data: qry,
        success: function(msg){
        if(msg==''){return true;}
            eval('var namevalue='+msg);
            
	        if(namevalue!=null){
                var oSelect = document.getElementById(childId);
                if(oSelect){
	                for(var i=oSelect.length-1;i>=0;i--){
		                oSelect.options[i]=null;
	                }
                
	                for(var i=0;i<namevalue.length;i++){
	                    var opt = new Option(namevalue[i].name,namevalue[i].value);
		                oSelect.options[oSelect.length] = opt;
	                }
                }
	          }		   
        },
        fail: function(msg){
            alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
        }
        });	 
}




function AjaxDropDownChangeyui(ddl,childId,priceid,callId,funcPage){
	
    var selVal = ddl.options[ddl.selectedIndex].value;  
	//alert(selVal == '')
    if( selVal == ''){
        var child = document.getElementById(childId);
        for(var i=child.length;i>=1;i--){
            child.options[i-1]=null;
        }
		var price = document.getElementById(priceid);
		 for(var i=price.length;i>=1;i--){
            price.options[i-1]=null;
        }
        if(child.fireEvent){
          child.fireEvent('onchange');
        }else if(child.dispatchEvent){
          var oEvent=document.createEvent('HTMLEvents');
          oEvent.initEvent('change',true,true);
          //child.dispatchEvent(oEvent);
        }
        return;
    }
    
	
    var qry='cid='+escape(callId)+'&parent_id='+escape(selVal);
   
    jQuery.ajax({
        type: "GET",
        url: funcPage,
        data: qry,
        success: function(msg){
			var array=new Array()
			array=msg.split('@')
			
		   
             var oSelect = document.getElementById(childId);
                if(oSelect){
	                for(var i=oSelect.length;i>=1;i--){
		                oSelect.options[i-1]=null;
	                }
	                
			var namevalue=null
			if (array[0]!='') { 
            eval('namevalue='+array[0]);	
	        if(namevalue!=null){
               

	                for(var i=0;i<namevalue.length;i++){
	                    var opt = new Option(namevalue[i].name,namevalue[i].value);
		                oSelect.options[oSelect.length] = opt;
	                }
                }
	          }	
	          }
	          
	         var oSelect = document.getElementById(priceid);
			 oSelect.disabled="";
			   
                if(oSelect){
	                for(var i=oSelect.length;i>=1;i--){
		                oSelect.options[i-1]=null;
	                }
	             oSelect.disabled='';  
	            if  (array[1]=='Nothing'){
	            oSelect.disabled='disabled';
	            }
	            if (array[1]!=''&& array[1]!='Nothing') {     
	            var namevalue=null
	           
			   eval('namevalue='+array[1]);
			   
	        if(namevalue!=null){
	                for(var i=0;i<namevalue.length;i++){
	                    var opt = new Option(namevalue[i].name,namevalue[i].value);
		                oSelect.options[oSelect.length] = opt;
	                }
                }
	          }	
	          }
        },
        fail: function(msg){
            alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
        }
        });	 
}


//AjaxRadioButton(this,'../../Ajax/AjxRadioButton.aspx','ads_sel_main','129','99')
function AjaxDropDownChange_searchginger2(ddl,childId,tbsubid,callId,funcPage){
	
	
    var selVal = ddl.options[ddl.selectedIndex].value;  

    if(ddl.selectedIndex == -1 || selVal == -1 || selVal == 0){
        var child = document.getElementById(childId);
        for(var i=child.length-1;i>0;i--){
            child.options[i]=null;
        }
        if(child.fireEvent){
          child.fireEvent('onchange');
        }else if(child.dispatchEvent){
          var oEvent=document.createEvent('HTMLEvents');
          oEvent.initEvent('change',true,true);
          child.dispatchEvent(oEvent);
        }
        return;
    }
    
    var qry='cid='+escape(callId)+'&parent_id='+escape(selVal);
    
    jQuery.ajax({
        type: "GET",
        url: funcPage,
        data: qry,
        success: function(msg){
        if(msg==''){return true;}
            eval('var namevalue='+msg);
	        if(namevalue!=null){
                var oSelect = document.getElementById(childId);
				 
				//   oSelect.onchange = function(){ AjaxDropDownChange_searchginger3(this,tbsubid,'AdsJobType','Ajax/AjxDropdown.aspx');};
                if(oSelect){
	                for(var i=oSelect.length-1;i>=1;i--){
		                oSelect.options[i]=null;
	                }

	                for(var i=0;i<namevalue.length;i++){
	                    var opt = new Option(namevalue[i].name,namevalue[i].value);
		                oSelect.options[oSelect.length] = opt;
	                }
                }
	          }		   
        },
        fail: function(msg){
            alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
        }
        });	 
}

function AjaxDropDownChange_searchginger(ddl,childId,priceid,typeid,txtsearchid,tbsubid,callId,funcPage){

   document.getElementById(priceid).style.display='';
    var selVal = ddl.options[ddl.selectedIndex].value;  

    if( selVal == ''){
        var child = document.getElementById(childId);
        for(var i=child.length;i>=1;i--){
            child.options[i-1]=null;
        }
		var price = document.getElementById(priceid);
		 for(var i=price.length;i>=1;i--){
            price.options[i-1]=null;
        }
       // if(child.fireEvent){
        //  child.fireEvent('onchange');
       // }else if(child.dispatchEvent){
        //  var oEvent=document.createEvent('HTMLEvents');
         // oEvent.initEvent('change',true,true);
        //  child.dispatchEvent(oEvent);
        //}
      // return;
     selVal=-1 
   }
    
	
    var qry='cid='+escape(callId)+'&parent_id='+escape(selVal);
  
    jQuery.ajax({
        type: "GET",
        url: funcPage,
        data: qry,
        success: function(msg){ 
		
			var array=new Array()
			array=msg.split('@')
			    
				
		   
             var oSelect = document.getElementById(childId);
                if(oSelect){
	                for(var i=oSelect.length;i>=1;i--){
		                oSelect.options[i-1]=null;
	                }
	                
			var namevalue=null
			if (array[0]!='') { 
            eval('namevalue='+array[0]);	
	        if(namevalue!=null){
               

	                for(var i=0;i<namevalue.length;i++){
	                    var opt = new Option(namevalue[i].name,namevalue[i].value);
		                oSelect.options[oSelect.length] = opt;
	                }
                }
	          }	
	          }
	       	    //####################################################################################
				     if (document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLCatagory")){
				  document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLCatagory").style.width="113px"; }
				  	   if (document.getElementById("ctl00_UCSearch1_DDLCatagory")){
					 document.getElementById("ctl00_UCSearch1_DDLCatagory").style.width="113px"; }
				   //#################################################################################### 
				    if (document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLPrice")){
				  document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLPrice").style.width="113px"; }
				   if (document.getElementById("ctl00_UCSearch1_DDLPrice")){
				  document.getElementById("ctl00_UCSearch1_DDLPrice").style.width="113px"; }
				    //#################################################################################### 
				  
			 var ddlId= document.getElementById(ddl.id);
			 //ddlId.style.width="113px"
	         var oSelect = document.getElementById(priceid);
			 oSelect.disabled="";
			   
                if(oSelect){
					 for(var i=oSelect.length-1;i>0;i--){
                      oSelect.options[i]=null;
                     }
	               
	            oSelect.disabled='';  
	            
	            var type = document.getElementById(typeid);
			   
                if(type){
					 for(var i=type.length-1;i>=0;i--){
                      type.options[i]=null;
                     }
	               }
	            type.disabled=''; 
	            
	            
				var searchid = document.getElementById(txtsearchid);
				var subid = document.getElementById(tbsubid);
				
	            if  ((array[1]=='job') ){
					
				  //oSelect.setAttribute( 'name', 'tbitype' );
				 var opt1 = new Option("All Jobs","");
				  oSelect.options[0] = opt1;
				   var child = document.getElementById(childId);
				  
				   child.onchange = function(){ AjaxDropDownChange_searchginger2(this,priceid,tbsubid,'AdsJob','Ajax/AjxDropdown.aspx');};
				   //searchid.style.display='none';
				   //type.disabled='disabled';
				   type.style.display='none';
				  // ddlId.style.width="113px";
				  if (document.getElementById("TrDDLType")){
				  document.getElementById("TrDDLType").style.display='none'; }
				    //####################################################################################
				     if (document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLCatagory")){
				  document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLCatagory").style.width="150px"; }
				  	   if (document.getElementById("ctl00_UCSearch1_DDLCatagory")){
					 document.getElementById("ctl00_UCSearch1_DDLCatagory").style.width="150px"; }
				   //#################################################################################### 
				    if (document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLPrice")){
				  document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLPrice").style.width="150px"; }
				   if (document.getElementById("ctl00_UCSearch1_DDLPrice")){
				  document.getElementById("ctl00_UCSearch1_DDLPrice").style.width="150px"; }
				    //#################################################################################### 
				   subid.style.display='';
				    if (document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub")){
				    document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub").style.display='';
				    }
				   
				
				    
				    
				    var oSalary = document.getElementById(tbsubid);
					
					 if(oSalary){
					 for(var i=oSalary.length-1;i>0;i--){
                      oSalary.options[i]=null;}
                     }
					 
					  var opt1 = new Option("All Salaries","");
				     oSalary.options[0] = opt1;
					  if(array[2]!=''){
				       eval('namevalue='+array[2]);
	                   if(namevalue!=null){
	                   for(var i=0;i<namevalue.length;i++){
	                    var opt = new Option(namevalue[i].name,namevalue[i].value);
		                oSalary.options[oSalary.length] = opt;}
	                    }
					 }
				   
				}
				
				else if (array[1]=='dating') {
					
					 var opt1 = new Option("Seeking","");
				    // oSelect.options[0] = opt1;
					 //searchid.style.display='none';
					 type.style.display='';
					  if (document.getElementById("TrDDLType")){
				     document.getElementById("TrDDLType").style.display=''; }
					 //####################################################################################
					     if (document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLCatagory")){
					 document.getElementById("ctl00_ContentPlaceHolder1_UCSearch1_DDLCatagory").style.width="150px"; }
					 
					   if (document.getElementById("ctl00_UCSearch1_DDLCatagory")){
					 document.getElementById("ctl00_UCSearch1_DDLCatagory").style.width="150px"; }
					 //#################################################################################### 
					 
				     subid.style.display='';
				     if (document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub")){
				    document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub").style.display='';
				    }
				     //ddlId.style.width="113px"
					 //var seeking = document.getElementById(priceid);
					 var seeking = type;
					 seeking.options[0] = opt1;
					 if(array[2]!=''){
					 eval('seekvalue='+array[2]);
	                 if(seekvalue!=null){
	                 for(var i=0;i<seekvalue.length;i++){
	                    var opt = new Option(seekvalue[i].name,seekvalue[i].value);
		                seeking.options[i+1] = opt;
	                 }
                    }
					}
					if (document.getElementById("TrDDLPrice")){
				    document.getElementById("TrDDLPrice").style.display='none'; }
					document.getElementById(priceid).style.display='none';
					  if(subid){
					 for(var i=subid.length-1;i>0;i--){
                      subid.options[i]=null;
                     }
					 }
					 var optrel = new Option("All Relations","");
				     subid.options[0] = optrel;
					 if(array[3]!=''){ 
				     eval('relationvalue='+array[3]);
	                 if(relationvalue!=null){
	                   for(var i=0;i<relationvalue.length;i++){
	                    var opt = new Option(relationvalue[i].name,relationvalue[i].value);
		                subid.options[subid.length] = opt;}
	                    }
					}
					 
					 
				}
				
				 else if (array[1]=='Nothing'){
				  var opt1 = new Option("-","");
				  oSelect.options[0] = opt1;
				  oSelect.disabled='disabled';
				  
				   //searchid.style.display='';
				  if (document.getElementById("TrDDLType")){
				  document.getElementById("TrDDLType").style.display=''; }
				   type.style.display='';
				   type.disabled='disabled';
				    
				   subid.style.display='none';
				 if (document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub")){
				    document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub").style.display='none';
				    }
				   
				 }
				 else{
				
		
				  var opt1 = new Option("All Prices","");
				   oSelect.options[0] = opt1;
				   
				   //searchid.style.display='';
				   if (document.getElementById("TrDDLType")){
				  document.getElementById("TrDDLType").style.display=''; }
				   type.style.display='';
				   subid.style.display='none';
				   if (document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub")){
				    document.getElementById("ctl00_ContentPlaceHolder1_UcSearchAdvance1_trtblsub").style.display='none';
				    }
				   
				    if(array[2]!=''){ 
				    var namevalue=null
			        eval('namevalue='+array[2]);
			   
	               if(namevalue!=null){
	                for(var i=0;i<namevalue.length;i++){
	                    var opt = new Option(namevalue[i].name,namevalue[i].value);
		                oSelect.options[oSelect.length] = opt;
	                }
                }
                }
                
                
                if(array[3]!=''){ 
				    var typevalue=null
			        eval('typevalue='+array[3]);
			   
	               if(namevalue!=null){
	                for(var i=0;i<typevalue.length;i++){
	                    var opt = new Option(typevalue[i].name,typevalue[i].value);
		                type.options[type.length] = opt;
	                }
                }
                }
                
	          }	
				}
        },
        fail: function(msg){
            alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
        }
        });	 
}
function AjaxRadioButton(t,furl, callId, id, selid)
{
    jQuery("input[@name='"+t.name+"']").attr("disabled",true)
    var qry = 'cid='+escape(callId)+'&id='+escape(id)+'&selid='+escape(selid);
    jQuery.ajax({
        type: "GET",
        url: furl,
        data: qry,
        success: function(msg){
            jQuery("input[@name='"+t.name+"']").attr("disabled",false)
        },
        fail: function(msg){
            alert('ajaxCheckBox failed');
        }
        });
}

if (window.jQuery)
{
    var divx = jQuery("<div id='Datas' class='DivOverLayer'></div>");
}
// ajaxPopup ---------------------------------------
function ajaxPopup(e, url, width, ctl)
{
    var evt = e?e:window.event;
    initPopup(evt,width,url,ctl.id);
    showPopup(url,ctl.id);
}

function initPopup(evt,width,url,ctlID)
{
    InsertPopup(width,url,ctlID) ;
    divx.css("display","block");
    
    var posx = 0;
    var posy = 0;
    posx = evt.clientX; //+ document.body.scrollLeft
    posy = evt.clientY; //+ document.body.scrollTop
    posx -= (width +12);
    posy += 8; 

    divx.css("left",((posx < 15) ? 15 : posx) +'px');
    divx.css("top",(posy)+'px');   

    divx.css("left",((posx < 15) ? 15 : posx) +'px');
    divx.css("top",(posy) + 'px');  
}

function InsertPopup(width,url,ctlID)
{ 
    divx.css("width",width+"px");
    var hsp = (width-40)/2 ;
    
    divx.html("loading...");
    jQuery(document.body).append(divx); 
    divx.unbind("click");
    divx.bind("click",function(){jQuery(this).css("display","none");});
}

//HidePopup = function(){ div.css("display","none"); }

function showPopup(url,ctlID)
{   
    jQuery.ajax({
                    type: "GET",
                    url: url,
                    data: 'ctlId=' + ctlID,
                    success: function(msg){
                        divx.html(msg);
                    },
                    fail: function(msg){}
               });	 
}

// END ajaxPopup ---------------------------------------

function ajaxChangeControl(url,ctlID)
{   
    jQuery.ajax({
                    type: "GET",
                    url: url,
                    data: 'ctlId=' + ctlID,
                    success: function(msg){
                        jQuery('#'+ctlID).after(jQuery(msg)).remove();
                    },
                    fail: function(msg){}
               });	 
}
function Togglefront(item) {
   obj=document.getElementById(item);
   visible=(obj.style.display!="none")
   key=document.getElementById("x" + item);
   if (visible) {
     obj.style.display="none";
   } else {
      obj.style.display="block";
   }
}


//------------ Flash Menu Go to Page ------------

function CategoryURL(idx)
{
    if (idx != null) 
    {   
       SearchURL(idx,"0")
    }
}

function SearchURL(idx , subidx)
{  //alert(idx + "++" + subidx);
    if (idx != null) 
    {   
       jQuery.ajax({
                        type: "GET",
                        url: "GoMenu.ashx",
                        data: 'ids=' + idx + '&subids=' + subidx,
                        success: function(msg){
                        
                          if (msg != "")
                          {
                            window.location = msg ;
                          }
                        },
                        fail: function(msg){}
                   });	  
        
    }
}
//------------ Flash Map Go to Location Page ------------

function GoToLocation(CityName)
{
    if (CityName != null) 
    {   
       jQuery.ajax({
                        type: "GET",
                        url: "CityMenu.ashx",
                        data: 'CityName=' + CityName ,
                        success: function(msg){
                        
                          if (msg != "")
                          {
                            window.location = msg ;
                          }
                        },
                        fail: function(msg){}
                   });	  
        
    }
}




//------------ Flash Map Go to Region Page ------------

function GetRegion(RegionName)
{
    if (RegionName != null) 
    {   
       jQuery.ajax({
                        type: "GET",
                        url: "RegionClick.ashx",
                        data: 'rname=' + RegionName ,
                        success: function(msg){
                        
                          if (msg != "")
                          {
                            window.location = msg ;
                          }
                        },
                        fail: function(msg){}
                   });	  
        
    }
}
//-------------------- Save wishlist -----------
function savewishlist(xx,aid,callID,lastUrl){
       if(callID=="chatmemberlist"){ 
     xx= document.getElementById(xx);
       }
         xx.innerHTML = "<img src='Images/spinner.gif' alt='' />"
        jQuery.ajax({
            type: "GET",
            url: "Ajax/AjaxFavorite.aspx?",
            data: "id="+aid+"&callid="+callID+"&wishlist="+lastUrl,
     
            success: function(msg){
                if (msg == "success"){
                    xx.onclick=""; 
                    if(callID=="ads"){
                        xx.innerHTML="<h1>Your Ginger<span class='asia'>Ad</span> has been saved</h1>"; 
                    }else if(callID=="product"){
                        xx.innerHTML="<h1>Your Ginger<span class='asia'>Gear</span> has been saved</h1>"; 
                    }else if(callID=="chatmemberlist"){   
                     //  xx.innerHTML='<img onclick="savewishlist(\'ChatMemberWishlist\','+aid+',\'chatmemberlist\',\'\');" alt="Remove GingerFriend from my MemberArea" title="Remove GingerFriend from my MemberArea" src="MemberChat/icons/ChatAddmember_40.gif"  style="cursor:pointer" />';     // Remove member to chat                       
                         xx.innerHTML='<div onclick="savewishlist(\'ChatMemberWishlist\','+aid+',\'chatmemberlist\',\'\');" ><h1 style="margin: 0pt; padding: 5px 0px 0px;">Remove Ginger<span class="asia">Friend</span></h1><h5 style="margin: -4px 0px; padding: 0px;">From My Member<span class="asia">Area</span></h5></div>' // Remove member to chat
                    }else{ xx.innerHTML="<h1>Your Ginger<span class='asia'>Guide</span> has been saved</h1>";}                    
                   // alert("successed");  
                }else if (msg == "redundancy") {
                     if(callID=="ads"){
                        xx.innerHTML="<h1>Your Ginger<span class='asia'>Ad</span> has been saved</h1>";
                    }else if(callID=="product"){
                        xx.innerHTML="<h1>Your Ginger<span class='asia'>Gear</span> has been saved</h1>"; 
                    }else if(callID=="chatmemberlist"){           
                        // xx.innerHTML='<img onclick="savewishlist(\'ChatMemberWishlist\','+aid+',\'chatmemberlist\',\'\');" alt="GingerFriend saved in your MemberArea" title="GingerFriend saved in your MemberArea" src="MemberChat/icons/ChatRemovemember_40.gif"  style="cursor:pointer" />'; // add member to chat
                         xx.innerHTML='<div onclick="savewishlist(\'ChatMemberWishlist\','+aid+',\'chatmemberlist\',\'\');" ><h1 style="margin: 0pt; padding: 5px 0px 0px;">Save Ginger<span class="asia">Friend</span></h1><h5 style="margin: -4px 0px; padding: 0px;">To My Member<span class="asia">Area</span></h5></div>' // add member to chat
                    }else{ xx.innerHTML="<h1>Your Ginger<span class='asia'>Guide</span> has been saved</h1>";}
//                    alert('Duplicate item - This has not been added again.');
//                }else if (msg == "fail") {
//                    alert("Fail");
                }else if (msg == "notlogin") {
                    alert("Please Sign Up or Log In first.");
                    //var lasturl = escape(pname);
                    window.location='gingerasia_member_area_login.aspx?lasturl='+lastUrl;
//                }else if (msg =="DeleteWishlistComplete") {
//                    
//                    //alert("Delete "+callID+" Success");
//                    var inputw="";
//                    if(types=="ads"){inputw="Litads";}
//                    if(types == "product"){inputw="litproduct";}
//                    if(types == "news"){inputw="ctl00_LitEventmember";}
//                    if(types == "event"){inputw="ctl00_LitEventmember";}
                }  
            },
            fail: function(msg){
                alert('failed');
            }
        });
}
//----------------------------------------------
function getchbox(ch_name){
    var data="";
    var comma="";
    var frm = jQuery("input[@type=checkbox]") ;
    frm.each(function(){
        if(this.id.indexOf(ch_name) != -1) 
        { 
            if(this.checked){  
                data = data+comma+this.value ;
                comma=","; 
            }
        }
        }
   );
return data;
}

function Delwishlist(){
    var ch_ads= getchbox("chkItmads");
    var ch_product= getchbox("chkItmproduct");
    var ch_event= getchbox("chkItmevent");  
    var ch_member= getchbox("chkItmDelmemberwishlist");
//    if(ch_ads!=""){
//        deldata("Litads","ads",ch_ads);
//    }
//    if(ch_product!=""){
//        deldata("litproduct","product",ch_product);
//    }
//    if(ch_event!=""){
//        deldata("ctl00_LitEventmember","event",ch_event);
//    }
    if(ch_ads!="" || ch_product!="" || ch_event!=""){
       window.location="gingerasia_member_area_saved_gingerads.aspx?status=1&dataads="+ch_ads+"&dataproduct="+ch_product+"&dataevent="+ch_event;
     
    }
      else{  
     if  (ch_member!=""){
     //alert(ch_member);
      window.location="memberwishlist.aspx?status=1&data="+ch_member;
     }
    }
    
}
function deldata(lit,wishlist,datax){
//    var obj = document.getElementById(lit);
//    if(obj){
//        obj.innerHTML = "<img src='Images/spinner.gif' alt='' />"
//    }
   jQuery.ajax({
                    type: "GET",
                    url: "FrontUC/Advertise/ajaxwishList.aspx",
                    data: "lit="+lit+"&wishlist="+wishlist+"&status=1&data="+datax+"&pageno=1",
                    success: function(msg){
                      if (msg != "complete")
                          {//obj.innerHTML=msg;
                          }
                    },
                    fail: function(msg){
                        alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
                    }
                 });	 
}
//----------------------------------------------
function GenwishList(lit,wishlist,view,data,pageno) 
{

    var obj = document.getElementById(lit);
     if(obj){
        obj.innerHTML = "<img src='Images/spinner.gif' alt='' />"
    }
    if(pageno==undefined){pageno=1;}
    
       jQuery.ajax({ // url: "FrontUC/Advertise/ajaxwishList.aspx",
                        type: "GET",
                       
                        url: "FrontUC/Advertise/ajaxwishList.aspx",
                        data: "lit="+lit+"&wishlist="+wishlist+"&status="+view+"&data="+data+"&pageno="+pageno,
                        success: function(msg){
                        
                          if (msg != "")
                          {
                                obj.innerHTML =msg  ;
//                                jQuery(".block").draggable({helper:'clone', opacity:0.5});
//                                jQuery("ul.myList"+wishlist).Sortable({}); 
                                
                                // ====== Order Wish List ========
                          /*
		                        jQuery('#myList'+wishlist).Sortable(
			                        {
				                        accept: 'Groupitem'+wishlist,
				                        revert: true,
				                        floats:	true,
				                        activeclass: 'sortactive',
                                        hoverclass: 'sorthover',
                                        helperclass: 'sorthelper',
				                        tolerance: 'pointer',
				                        onChange : function(ser)
				                        {
				                           serial = jQuery.SortSerialize('myList'+wishlist);
				                           //alert(serial.hash) ;
				                           var valuedata=serial.hash+'';
                        				  
                        				   valuedata = escape(valuedata) ;        
                        				   if(wishlist=="ads"){              				   
				                                valuedata=valuedata.replace(/myListads%5B%5D/gi, "");
				                           }else if(wishlist=="product"){
				                                valuedata=valuedata.replace(/myListproduct%5B%5D/gi, "");
				                           }else if(wishlist=="event"){
				                                valuedata=valuedata.replace(/myListevent%5B%5D/gi, "");
				                           }
				                           valuedata=valuedata.replace(/%3D/gi, ",");
                                           valuedata=valuedata.replace(/%26/gi, "");
                        				   
				                           jQuery.ajax({
                                                            type: "GET",
                                                            url: "FrontUC/Advertise/ajaxwishList.aspx",
                                                            data: "lit="+lit+"&wishlist="+wishlist+"&status=2&data="+valuedata+"&pageno="+pageno,
                                                            success: function(msg){
                                                            
                                                                          if (msg == "complete")
                                                                              {
                                                                                //alert(msg) ;
                                                                              }   
                                                                              
                                                            },
                                                            fail: function(msg){
                                                                alert('There was a problem retrieving the data:\n'+xmlHttp.statusText);
                                                            }
                                                            });	 
				                        },
				                        onStart : function()
				                        {
				                        },
				                        onStop : function()
				                        {
				                        }
			                        }
		                        );
                            */
                             // ====== End Order Wish List ========
                             
                          }else{obj.innerHTML="";}
                        },
                        fail: function(msg){}
                   });	  
}

function serialize(s)
{
	serial = $.SortSerialize(s);
	alert(serial.hash);
};  

function ch_delete(idcheckitem){
     var frm = document.forms[0];
     var bAllChecked = true;
     var strch="";
     
     for (i = 0; i < frm.length; i++) {
         var e = frm.elements[i];
         if (e.id.indexOf(idcheckitem) != -1) {
             if (e.checked == true) {
                  if(strch==""){strch =e.value;}else{
                  strch =strch+","+e.value;}
             }
         }
     }
     return strch;

}


function FormatNumber(pnumber){
    if (isNaN(pnumber)) { return 0};
	if (pnumber=='') { return 0};

	var fnum = new String(pnumber);
	var psplit = fnum.split('.');
	var cnum = psplit[0],
			parr = [],
			j = cnum.length,
			m = Math.floor(j / 3),
			n = cnum.length % 3 || 3; 
	for (var i = 0; i < j; i += n) {
		if (i != 0){n = 3;}
		parr[parr.length] = cnum.substr(i, n);
		m -= 1;
	}
		
	fnum = parr.join(',');

	if (psplit[1]){
	    var dec = new String(psplit[1]);
	    dec = String(parseFloat(psplit[1])/Math.pow(10,(dec.length - 2)));
//		    dec = String(Math.round(parseFloat(dec))/Math.pow(10,2));
//		    var dot = dec.indexOf('.');
//		    if(dot == -1){
//			    dec += '.'; 
//			    dot = dec.indexOf('.');
//		    }
	    while(dec.length < 2) { dec += '0'; }
	    fnum += '.' + dec;
	}else{fnum += '.00'}
		
	return fnum;
}

 