var xmlhttp;
var xmlhttp1;

function replaceAll( str, replacements ) {
    for ( i = 0; i < replacements.length; i++ ) {
        var idx = str.indexOf( replacements[i][0] );

        while ( idx > -1 ) {
            str = str.replace( replacements[i][0], replacements[i][1] );
            idx = str.indexOf( replacements[i][0] );
        }

    }

    return str;
}
var req;
var koko="BEGIN";
function loadXMLDocToPost(url) {
        req = false;
    // branch for native XMLHttpRequest object
    if(window.XMLHttpRequest) {
        try {
                       req = new XMLHttpRequest();
        } catch(e) {
                       req = false;
        }
    // branch for IE/Windows ActiveX version
    } else if(window.ActiveXObject) {
        try {
               req = new ActiveXObject("Msxml2.XMLHTTP");
        } catch(e) {
               try {
                       req = new ActiveXObject("Microsoft.XMLHTTP");
               } catch(e) {
                       req = false;
               }
               }
    }
        if(req) {
               req.onfiltered= processReqChange;
               req.open("GET", url, true);
               req.send("");
        }
}

function processReqChange()
{
  if (req.readyState==4) // ready state getting some value
  {
    if (req.status==200) // html page desire recieve then true
    {
     str=req.responseText;
     window.location.replace("cart.php?inc=securitypage");
    }
    else
    {
     alert("Problem retrieving XML data");
    }
  }
}

function loadXMLDoc(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp=new XMLHttpRequest();
  xmlhttp.onreadystatechange=xmlhttpChange;
  xmlhttp.open("GET",url,true);
  xmlhttp.send(null);
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp)
    {
    xmlhttp.onreadystatechange=xmlhttpChange;
    xmlhttp.open("GET",url,true);
    xmlhttp.send();
    }
  }
}

function xmlhttpChange()
{
if (xmlhttp.readyState==4) // ready state getting some value
  {
  if (xmlhttp.status==200) // html page desire recieve then true
    {
			str=xmlhttp.responseText;
             //alert(str);
			//if(str=="logged off") window.location.replace("process.php?process=logout&st=logoff");
			if(str!="")
			{   str=str.split(":::");
				for(i=0;i<str.length;i++)
				{
                	str1=str[i].substring(0,str[i].indexOf(";:"));
                    //alert(str1);
	                str2=str[i].substring(str[i].indexOf(";:")+2);
                    //alert(str2);
	                ele=eval('document.getElementById("'+str1+'")');
                  // alert(ele);
                    ele.innerHTML=str2;
					 
				}
			}
		 }
  else
    {
    alert("Problem retrieving XML data");
    }
  }
}


function loadXMLDoc1(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp1=new XMLHttpRequest();
  xmlhttp1.onreadystatechange=xmlhttpChange1;
  xmlhttp1.open("GET",url,true);
  xmlhttp1.send(null);
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp1=new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp1)
    {
    xmlhttp1.onreadystatechange=xmlhttpChange1;
    xmlhttp1.open("GET",url,true);
    xmlhttp1.send();
    }
  }
}

function xmlhttpChange1()
{
if (xmlhttp1.readyState==4) // ready state getting some value
  {
  if (xmlhttp1.status==200) // html page desire recieve then true
    {
			str=xmlhttp1.responseText;
          
			//if(str=="logged off") window.location.replace("process.php?process=logout&st=logoff");
			if(str!="")
			{   str=str.split(":::");
				for(i=0;i<str.length;i++)
				{
                	str1=str[i].substring(0,str[i].indexOf(";:"));
                    //alert(str1);
	                str2=str[i].substring(str[i].indexOf(";:")+2);
                    //alert(str1+" "+str2);
	                ele=eval("document.getElementById('"+str1+"')");
					 
                  // alert(ele);
                    ele.innerHTML=str2;
					
				}
			}
		 }
  else
    {
    alert("Problem retrieving XML data");
    }
  }
}


function signupvalidate()
{
  if(document.signupboxfrm.Mb_Email.value=="")
  {
    alert("Please enter your Email!!");
    document.signupboxfrm.Mb_Email.focus();
    return false;
  }
  if(document.signupboxfrm.pass.value=="")
  {
    alert("Please enter password!!");
    document.signupboxfrm.pass.focus();
    return false;
  }
  return true;
}
function forget_pass(url)
{
 window.open(url,"forget_pass","height=200,width=350");
}

function addToCart(CatId,CnId)
{
 window.location.replace("process_cart.php?process=add_cart&catid="+CatId+"cnid="+CnId);
}

function getsound(catid,cnid,obj)
{
  if(reseticon(obj))
  {
   url="/process.php?process=getsound&Cat_Id="+catid+"&Cn_Id="+cnid;
   loadXMLDoc3(url);
  }
}

var objprev="";
function reseticon(obj)
{
 if(objprev!="")
 {
  if(objprev.src.indexOf("small")>-1)
  {
   objprev.src="/layout/en/small_icon.jpg";
  }
  else
  {
   objprev.src="/layout/en/sound_icon.jpg";
  }
 }
 if(objprev==obj)
 {
  objprev="";
  document.getElementById("ringtonerating").innerHTML="";
  return false;
 }

 if(obj.src.indexOf("small")>-1)
 {
  obj.src="/layout/en/small_icon_stop.jpg";
 }
 else
 {
  obj.src="/layout/en/sound_icon_stop.jpg";
 }
 objprev=obj;
 return true;
}

function getdynamic(catid,cnid,obj,subcatid)
{
   if(reseticon(obj))
   {
    url="process.php?process=getsound&subcatid="+subcatid+"&Cat_Id="+catid+"&Cn_Id="+cnid;
    loadXMLDoc(url);
    url="process.php?process=getdynacont&subcatid="+subcatid+"&Cat_Id="+catid+"&Cn_Id="+cnid;
    loadXMLDoc1(url);
   }
}
 
function getdynamic2(catid,cnid,subcatid)
{
    
   url="process.php?process=getdynacont&subcatid="+subcatid+"&Cat_Id="+catid+"&Cn_Id="+cnid;
   loadXMLDoc(url);
   
}
function locator(catid,cnid,mbid)
{
  //alert(catid+" "+cnid+" "+mbid);
window.opener.location.replace("../process_cart.php?process=add_cart&catid="+catid+"&cnid="+cnid+"&mbid="+mbid);
self.close();
}
function preview(url)
{
  window.open(url,"ringtone","height=500,width=300,location=no");
}
function postdynamic(catid,cnid,rate,general,subcatid)
{ 
  url="/process.php?process=rating&Cat_Id="+catid+"&Cn_Id="+cnid+"&rate="+rate+"&general="+general+"&subcatid="+subcatid+"&dynamic=yes";
  loadXMLDoc(url);
 //  while (xmlhttp.status==200) {}
  if (catid==2 || catid==5 || catid==1)
  refreshR("/inc/randomwallp.php?process=rating&catid="+catid+"&subcatid="+subcatid+"&dynamic=yes&rating=yes&Cn_Id="+cnid);
 
}
function kk(){
alert('saLAM');
}
function refreshR (url){
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp2=new XMLHttpRequest();
  xmlhttp2.onreadystatechange=xmlhttpChange2;
  xmlhttp2.open("GET",url,true);
  xmlhttp2.send(null);
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp2=new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp2)
    {
    xmlhttp2.onreadystatechange=xmlhttpChange2;
    xmlhttp2.open("GET",url,true);
    xmlhttp2.send();
    }
  }
}
function xmlhttpChange2()
{
if (xmlhttp2.readyState==4) // ready state getting some value
  {
  if (xmlhttp2.status==200) // html page desire recieve then true
    {
			str=xmlhttp2.responseText;
          
			//if(str=="logged off") window.location.replace("process.php?process=logout&st=logoff");
			if(str!="")
			{   str=str.split(":::");
				for(i=0;i<str.length;i++)
				{
                	str1=str[i].substring(0,str[i].indexOf(";:"));
                    //alert(str1);
	                str2=str[i].substring(str[i].indexOf(";:")+2);
                    //alert(str1+" "+str2);
	                ele=eval("document.getElementById('"+str1+"')");
					 
                  // alert(ele);
                    ele.innerHTML=str2;
				}
			}
		 }
  else
    {
    alert("Problem retrieving XML data");
    }
  }
}
function loadXMLDoc3(url)
{
// code for Mozilla, etc.
if (window.XMLHttpRequest)
  {
  xmlhttp3=new XMLHttpRequest();
  xmlhttp3.onreadystatechange=xmlhttpChange3;
  xmlhttp3.open("GET",url,true);
  xmlhttp3.send(null);
  }
// code for IE
else if (window.ActiveXObject)
  {
  xmlhttp3=new ActiveXObject("Microsoft.XMLHTTP");
    if (xmlhttp3)
    {
    xmlhttp3.onreadystatechange=xmlhttpChange3;
    xmlhttp3.open("GET",url,true);
    xmlhttp3.send();
    }
  }
}

function xmlhttpChange3()
{
if (xmlhttp3.readyState==4) // ready state getting some value
  {
  if (xmlhttp3.status==200) // html page desire recieve then true
    {
			str=xmlhttp3.responseText;
          
			//if(str=="logged off") window.location.replace("process.php?process=logout&st=logoff");
			if(str!="")
			{   str=str.split(":::");
				for(i=0;i<str.length;i++)
				{
                	str1=str[i].substring(0,str[i].indexOf(";:"));
                    //alert(str1);
	                str2=str[i].substring(str[i].indexOf(";:")+2);
                    //alert(str1+" "+str2);
	                ele=eval("document.getElementById('"+str1+"')");
					 
                  // alert(ele);
                    ele.innerHTML=str2;
					
				}
			}
		 }
  else
    {
    alert("Problem retrieving XML data");
    }
  }
}