/********************************* MY SCRIPT ******************************************/
$(document).ready(function(){
$("img").error(function(){ 
  $(this).hide(); 
});

//$(".add-to-cart").click(function()
//{
//alert($(this).attr('id'));
//runAppJ ("/api/cart.aspx?fun=1&PCode="+$(this).attr('id'),'')
//});
$().cart(); 

});




function runAppJ(urlx,id)
{
  if (id!='')
  $("#"+id).html("<img src='http://dikshaonline.co.in/images/lightbox-ico-loading.gif' alt='' />");
  htmlobj= new $.ajax({url:urlx,async:false});
  if (htmlobj.responseText=="SessionExpired")
  {
alert("your Session Expired");
window.location.href='/default.aspx';  
  return;
  }
  else{
  if (id!='')
  {
  $("#"+id).html(htmlobj.responseText);
//  AddID();
}
  else
  return htmlobj.responseText;
  }
  };
  
 

function runAppX(xmlhttp,url,fnc)
{
//var xmlhttp= new GetXmlHttpObject();
if (xmlhttp==null)
  {
  alert ("Your browser does not support XMLHTTP!");
  return;
  }
xmlhttp.onreadystatechange= fnc;
xmlhttp.open("GET",url,true);
xmlhttp.send(null);
}




function runApp(url,idx)
{
if (idx=='')
{
return runAppJ(url,idx);

}
else
{
var xmlhttpx= new GetXmlHttpObject();

runAppX(xmlhttpx,url,function stateChanged()
{
if (xmlhttpx.readyState<=3)
  {
	document.getElementById(idx).innerHTML='<center><img src=http://dikshaonline.co.in/images/busy.gif></center>';
	return;
  }

if (xmlhttpx.readyState==4)
  {
 if (xmlhttpx.status == 200)
    {    
 if (xmlhttpx.responseText=="SessionExpired")
  {alert("your Session Expired"); window.location.href='/default.aspx';  }
  else
  document.getElementById(idx).innerHTML=xmlhttpx.responseText;
//AddID();

   return;
    }
    else
   {
	document.getElementById(idx).innerHTML="";
        alert("There was a problem in the returned data. Error No." + xmlhttpx.status);
    }

  }
});

}
}



// *********************************************************************************************************************
// GET XML HTTP OBJ
// *********************************************************************************************************************


function GetXmlHttpObject()
{
if (window.XMLHttpRequest)
  {
  // code for IE7+, Firefox, Chrome, Opera, Safari
  return new XMLHttpRequest();
  }
if (window.ActiveXObject)
  {
  // code for IE6, IE5
  return new ActiveXObject("Microsoft.XMLHTTP");
  }
return null;
}


function isMoney(theVal)
{
var flg=1;
var dot=0;
if(theVal!="")
{
for(var i=0;i<theVal.length;i++)
{
var theChar =theVal.substring(i,i+1); 
if((theChar<"0" || theChar>"9" ) && (theChar !="."))
flg =0;
if (theChar ==".")
dot++;
if (dot>1)
flg=0;

}
}
else 
flg=0;
return flg ;

}


function isEmpty(valuex)
{
var Flg = false ;
if(valuex=='')
Flg =true ;
return Flg ;
}


function dologin(){
spnlogin.innerHTML="<center><img src='http://dikshaonline.co.in/images/busy.gif'></center>";

var x=runAppJ('/login.aspx?fun=1&usrid='+txt_username.value+'&pass='+txt_password.value,'');

var chk=x.split('#');

if(chk[0]=='Y')
{
window.location.href=chk[1];
return 
}
else
alert(x);
spnlogin.innerHTML="<input type='button' class='button' id='btn_login' value='Login' onclick='dologin();'  />";

}




 function enter_key_press(e)
{
var keynum
// var keychar

if(window.event) // IE
	{
	keynum = e.keyCode;
	}
else if(e.which) // Netscape/Firefox/Opera
	{
	keynum = e.which;
	}
//keychar = String.fromCharCode(keynum);

if(keynum==13)
return true ;
else 
return false ;
}


/*************************************************************************************/






