// -----------------------------------------------------------------------------
// Globals
// Major version of Flash required
var requiredMajorVersion = 9;
// Minor version of Flash required
var requiredMinorVersion = 0;
// Revision of Flash required
var requiredRevision = 45;



function getObj(name)
{
	if (document.getElementById) // test if browser supports document.getElementById
	{
		this.obj = document.getElementById(name); 
	//	this.style = document.getElementById(name).style;
	//	this.value = document.getElementById(name).value;
	}
	else if (document.all) // test if browser supports document.all
	{
		this.obj = document.all[name];
	//	this.style = document.all[name].style;
	//	this.value = document.all[name].value;
	}
	else if (document.layers) // test if browser supports document.layers
	{
		this.obj = document.layers[name];
	//	this.style = document.layers[name].style;
	//	this.value = document.layers[name].value;
	}
}



function prepareurl(url,pcatid){
var comboObj = new getObj('catid');
var subcatid = comboObj.obj.options[[comboObj.obj.options.selectedIndex]].value;
	if(pcatid != 0){
		url = url + '?f=1&catid='+ subcatid+'&pcatid='+pcatid;
	}else{
		url = url + '?f=1&catid='+ subcatid;
	}
  window.location = url;
}

var state = 'hidden';

function MM_showhide(layer_ref) {

	if (state == 'visible') {
		state = 'hidden';
	}
	else {
		state = 'visible';
	}
	if (document.all) { //IS IE 4 or 5 (or 6 beta)
		eval( "document.all." + layer_ref + ".style.visibility = state");
	}
	if (document.layers) { //IS NETSCAPE 4 or below
		document.layers[layer_ref].visibility = state;
	}
	if (document.getElementById && !document.all) {
		maxwell_smart = document.getElementById(layer_ref);
		maxwell_smart.style.visibility = state;
	}
}

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_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_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 populateImage(imgId,imgTitle,imgCost,imgPts,imgUrl){ 
	var divObj = new getObj('expandImage');
	divObj.obj.style.display = "block";
	var titleObj = new getObj('imageName');
		titleObj.obj.innerHTML = imgTitle;
	var codeObj = new getObj('imageCode');
		codeObj.obj.innerHTML = '<br>Item Code : '+imgId;
	var costObj = new getObj('imageCost');
		costObj.obj.innerHTML = '<br> '+imgCost+ ' fils | '+imgPts+' Points' ;
	var imgSrcObj = new getObj('imageSrc');
	imgSrcObj.obj.src = imgUrl;
}


function populateSong(sId,sTitle,sCost,sPts,sUrl,sArtist,sAlbum){ 
	var divObj = new getObj('expandSong');
	divObj.obj.style.display = "block";
	var titleObj = new getObj('songAlbum');
		titleObj.obj.innerHTML = sArtist + '<br>' + sAlbum + '<br>' + sTitle;
	var codeObj = new getObj('songCode');
		codeObj.obj.innerHTML = 'Item Code : '+sId+ '<br> '+sCost+ ' fils | '+sPts+' Points';
	
   var so = new SWFObject(sUrl, "mymovie", "400", "250", "8", "#336699");
   so.write("flashcontent");
	/*var imgSrcObj = new getObj('songSrc');
	imgSrcObj.obj.embeds['songSrc'].src = sUrl;
	var imgSrc1Obj = new getObj('songSrc1');
	imgSrc1Obj.obj.src = sUrl;
	*/
}
var checkflag = "false";
function check(field)
{
	if (checkflag == "false")
	{
		for (i = 0; i < field.length; i++)
		{
			field[i].checked = true;
		}
		checkflag = "true";
		return "Uncheck all";
	}
	else
	{
		for (i = 0; i < field.length; i++)
		{
			field[i].checked = false;
		}
		checkflag = "false";
		return "Check all";
	}
}

function checkDelete_user(form1)
{
	if(check_select_checkbox(form1,'userli','','6') == false)
	{
		alert("Select Record To Delete.");
		return false;
	}
	Confirm = confirm("Do You Want To Delete the Selected Records?");
	if(Confirm)
	{
		document.form1.myflag.value	=	'DE';
		return true;
	}
	else
	return false;
}
/// /// THIS FUNCTION IS USED TO VALIDEATED ARRAY NAMED FIELD I.E NAME[]
function check_select_checkbox(frm, chk_name, msg, name_length)
{
	ch=0;
	chp=0;
	for(i=0;i<frm.elements.length;i++)
	{
		chname=frm.elements[i].name;

		if(chname.substring(0,name_length)==chk_name)
		{
			//alert(chname.substring(0,name_length)+" PR== "+frm.elements[i].value);
			if(frm.elements[i].checked ==true)
			{
				chp=1;
				break;
			}
		}
	}
	if(chp==0)
	{
		for(i=0;i<frm.elements.length;i++)
		{
			chname=frm.elements[i].name;
			if(chname.substring(0,name_length)==chk_name)
			{
				if(msg!= '')
				alert('"'+msg+'"' + " Cannot be blank");
				frm.elements[i].focus();
				break;
			}
		}
		return false;
	}
}

function MM_timelinePlay(tmLnName, myID) { //v1.2
  //Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,propNum,theObj,firstTime=false;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (myID == null) { myID = ++tmLn.ID; firstTime=true;}//if new call, incr ID
  if (myID == tmLn.ID) { //if Im newest
    setTimeout('MM_timelinePlay("'+tmLnName+'",'+myID+')',tmLn.delay);
    fNew = ++tmLn.curFrame;
    for (i=0; i<tmLn.length; i++) {
      sprite = tmLn[i];
      if (sprite.charAt(0) == 's') {
        if (sprite.obj) {
          numKeyFr = sprite.keyFrames.length; firstKeyFr = sprite.keyFrames[0];
          if (fNew >= firstKeyFr && fNew <= sprite.keyFrames[numKeyFr-1]) {//in range
            keyFrm=1;
            for (j=0; j<sprite.values.length; j++) {
              props = sprite.values[j]; 
              if (numKeyFr != props.length) {
                if (props.prop2 == null) sprite.obj[props.prop] = props[fNew-firstKeyFr];
                else        sprite.obj[props.prop2][props.prop] = props[fNew-firstKeyFr];
              } else {
                while (keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]) keyFrm++;
                if (firstTime || fNew==sprite.keyFrames[keyFrm-1]) {
                  if (props.prop2 == null) sprite.obj[props.prop] = props[keyFrm-1];
                  else        sprite.obj[props.prop2][props.prop] = props[keyFrm-1];
        } } } } }
      } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
      if (fNew > tmLn.lastFrame) tmLn.ID = 0;
  } }
}

function MM_timelineStop(tmLnName) { //v1.2
  //Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  if (tmLnName == null)  //stop all
    for (var i=0; i<document.MM_Time.length; i++) document.MM_Time[i].ID = null;
  else document.MM_Time[tmLnName].ID = null; //stop one
}

function MM_timelineGoto(tmLnName, fNew, numGotos) { //v2.0
  //Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2004 Macromedia, Inc. All rights reserved.
  var i,j,tmLn,props,keyFrm,sprite,numKeyFr,firstKeyFr,lastKeyFr,propNum,theObj;
  if (document.MM_Time == null) MM_initTimelines(); //if *very* 1st time
  tmLn = document.MM_Time[tmLnName];
  if (numGotos != null)
    if (tmLn.gotoCount == null) tmLn.gotoCount = 1;
    else if (tmLn.gotoCount++ >= numGotos) {tmLn.gotoCount=0; return}
  jmpFwd = (fNew > tmLn.curFrame);
  for (i = 0; i < tmLn.length; i++) {
    sprite = (jmpFwd)? tmLn[i] : tmLn[(tmLn.length-1)-i]; //count bkwds if jumping back
    if (sprite.charAt(0) == "s") {
      numKeyFr = sprite.keyFrames.length;
      firstKeyFr = sprite.keyFrames[0];
      lastKeyFr = sprite.keyFrames[numKeyFr - 1];
      if ((jmpFwd && fNew<firstKeyFr) || (!jmpFwd && lastKeyFr<fNew)) continue; //skip if untouchd
      for (keyFrm=1; keyFrm<numKeyFr && fNew>=sprite.keyFrames[keyFrm]; keyFrm++);
      for (j=0; j<sprite.values.length; j++) {
        props = sprite.values[j];
        if (numKeyFr == props.length) propNum = keyFrm-1 //keyframes only
        else propNum = Math.min(Math.max(0,fNew-firstKeyFr),props.length-1); //or keep in legal range
        if (sprite.obj != null) {
          if (props.prop2 == null) sprite.obj[props.prop] = props[propNum];
          else        sprite.obj[props.prop2][props.prop] = props[propNum];
      } }
    } else if (sprite.charAt(0)=='b' && fNew == sprite.frame) eval(sprite.value);
  }
  tmLn.curFrame = fNew;
  if (tmLn.ID == 0) eval('MM_timelinePlay(tmLnName)');
}

function MM_initTimelines() { //v4.0
//alert(navigator.appName);
    //MM_initTimelines() Copyright 1997 Macromedia, Inc. All rights reserved.
	var ie1  = navigator.appName == "Microsoft Internet Explorer";
    var ns = navigator.appName == "Netscape";
    var ns4 = (ns && parseInt(navigator.appVersion) == 4);
    var ns5 = (ns && parseInt(navigator.appVersion) > 4);
    var macIE5 = (navigator.platform ? (navigator.platform == "MacPPC") : false) && (navigator.appName == "Microsoft Internet Explorer") && (parseInt(navigator.appVersion) >= 4);
    document.MM_Time = new Array(1);
    document.MM_Time[0] = new Array(5);
    document.MM_Time["Timeline1"] = document.MM_Time[0];
    document.MM_Time[0].MM_Name = "Timeline1";
    //document.MM_Time[0].fps = 15;
    document.MM_Time[0].fps = 24;
    document.MM_Time[0][0] = new String("sprite");
    document.MM_Time[0][0].slot = 1;
    if (ns4)
        document.MM_Time[0][0].obj = document["box_login"];
	    //document.MM_Time[0][0].obj = document["Layer1"];
    else if (ns5)
        document.MM_Time[0][0].obj = document.getElementById("box_login");
	   // document.MM_Time[0][0].obj = document["Layer1"];
    else
        document.MM_Time[0][0].obj = document.all ? document.all["box_login"] : null;
	    //document.MM_Time[0][0].obj = document.all ? document.all["Layer1"] : null;
       document.MM_Time[0][0].keyFrames = new Array(1, 15);
       document.MM_Time[0][0].values = new Array(3);

    if (ns5 || macIE5)
        document.MM_Time[0][0].values[0] = new Array("0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px");
    else
        document.MM_Time[0][0].values[0] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
       document.MM_Time[0][0].values[0].prop = "top";
    if (ns5 || macIE5)
        document.MM_Time[0][0].values[1] = new Array("-101px", "-88px", "-80px", "-72px", "-64px", "-56px", "-48px", "-40px", "-32px", "-24px", "-16px", "-8px", "0px", "8px", "16px");
    else
        document.MM_Time[0][0].values[1] = new Array(-101,-88,-80,-72,-64,-56,-48,-40,-32,-24,-16,-8,0,8,16);
    document.MM_Time[0][0].values[1].prop = "top";
    if (!ns4) {
        document.MM_Time[0][0].values[0].prop2 = "style";
        document.MM_Time[0][0].values[1].prop2 = "style";
    }
    document.MM_Time[0][0].values[2] = new Array("visible","visible");
    document.MM_Time[0][0].values[2].prop = "visibility";
    if (!ns4)
        document.MM_Time[0][0].values[2].prop2 = "style";
    document.MM_Time[0][1] = new String("sprite");
    document.MM_Time[0][1].slot = 1;
    if (ns4)
        document.MM_Time[0][1].obj = document["box_login"];
    else if (ns5)
        document.MM_Time[0][1].obj = document.getElementById("box_login");
    else
        document.MM_Time[0][1].obj = document.all ? document.all["box_login"] : null;
    document.MM_Time[0][1].keyFrames = new Array(16, 30);
    document.MM_Time[0][1].values = new Array(3);
    if (ns5 || macIE5)
        document.MM_Time[0][1].values[0] = new Array("0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px", "0px");
    else
        document.MM_Time[0][1].values[0] = new Array(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0);
    //document.MM_Time[0][1].values[0].prop = "right";
    if (ns5 || macIE5)
        document.MM_Time[0][1].values[1] = new Array("16px", "8px", "0px", "-8px", "-16px", "-24px", "-32px", "-40px", "-48px", "-56px", "-64px", "-72px", "-80px", "-88px", "-100px");
    else
        document.MM_Time[0][1].values[1] = new Array(16,8,0,-8,-16,-24,-32,-40,-48,-56,-64,-72,-80,-88,-100);
    document.MM_Time[0][1].values[1].prop = "top";
    if (!ns4) {
        document.MM_Time[0][1].values[0].prop2 = "style";
        document.MM_Time[0][1].values[1].prop2 = "style";
    }
    document.MM_Time[0][1].values[2] = new Array("visible","inherit");
    document.MM_Time[0][1].values[2].prop = "visibility";
    if (!ns4)
        document.MM_Time[0][1].values[2].prop2 = "style";
    document.MM_Time[0][2] = new String("behavior");
    document.MM_Time[0][2].frame = 15;
    document.MM_Time[0][2].value = "MM_timelineStop('Timeline1')";
    document.MM_Time[0][3] = new String("behavior");
    document.MM_Time[0][3].frame = 31;
    document.MM_Time[0][3].value = "MM_timelineGoto('Timeline1','1')";
    document.MM_Time[0][4] = new String("behavior");
    document.MM_Time[0][4].frame = 30;
    document.MM_Time[0][4].value = "MM_timelineStop()";
    document.MM_Time[0].lastFrame = 41;
    for (i=0; i<document.MM_Time.length; i++) {
        document.MM_Time[i].ID = null;
        document.MM_Time[i].curFrame = 0;
        //document.MM_Time[i].delay = 1000/document.MM_Time[i].fps;
		document.MM_Time[i].delay = 300/document.MM_Time[i].fps;
    }
}

function alertSize() {
  var myWidth = 0, myHeight = 0;
  if( typeof( window.innerWidth ) == 'number' ) {
    //Non-IE
    myWidth = window.innerWidth;
    myHeight = window.innerHeight;
  } else if( document.documentElement && ( document.documentElement.clientWidth || document.documentElement.clientHeight ) ) {
    //IE 6+ in 'standards compliant mode'
    myWidth = document.documentElement.clientWidth;
    myHeight = document.documentElement.clientHeight;
  } else if( document.body && ( document.body.clientWidth || document.body.clientHeight ) ) {
    //IE 4 compatible
    myWidth = document.body.clientWidth;
    myHeight = document.body.clientHeight;
  }

  window.alert( 'Width = ' + myWidth );
  window.alert( 'Height = ' + myHeight );
  return
}

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_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 XHConn()
{
  var xmlhttp, bComplete = false;
  try { xmlhttp = new ActiveXObject("Msxml2.XMLHTTP"); }
  catch (e) { try { xmlhttp = new ActiveXObject("Microsoft.XMLHTTP"); }
  catch (e) { try { xmlhttp = new XMLHttpRequest(); }
  catch (e) { xmlhttp = false; }}}
  if (!xmlhttp) return null;
  this.connect = function(sURL, sMethod, sVars, fnDone)
  {
    if (!xmlhttp) return false;
    bComplete = false;
    sMethod = sMethod.toUpperCase();

    try {
      if (sMethod == "GET")
      {
        xmlhttp.open(sMethod, sURL+"?"+sVars, true);
        sVars = "";
      }
      else
      {
        xmlhttp.open(sMethod, sURL, true);
        xmlhttp.setRequestHeader("Method", "POST "+sURL+" HTTP/1.1");
        xmlhttp.setRequestHeader("Content-Type",
          "application/x-www-form-urlencoded");
      }
      xmlhttp.onreadystatechange = function(){
        if (xmlhttp.readyState == 4 && !bComplete)
        {
          bComplete = true;
          fnDone(xmlhttp);
        }};
      xmlhttp.send(sVars);
    }
    catch(z) { return false; }
    return true;
  };
  return this;
}

function trimAll(sString)
{
   while (sString.substring(0,1) == ' ')
    {
            sString = sString.substring(1, sString.length);
    }
   while (sString.substring(sString.length-1, sString.length) == ' ')
   {
       sString = sString.substring(0,sString.length-1);
    }
  return sString;
}


function chklogin(){
	usrname = document.getElementById("mo").value;
	pwd = document.getElementById("passwd").value;

var myConn = new XHConn();

if (!myConn) alert("XMLHTTP not available. Try a newer/better browser.");

var fnWhenDone = function (oXML) { 
	alert(oXML.responseText);
	var ret = oXML.responseText;
	alert("here"+ret);
	   if(ret=="1"){
		    document.Userlogin.submit();
	   }
	   if(ret=="0"){
		  //alert("Sorry Wrong User/Password provided !!!");
	   }

	
	
};

myConn.connect("inc/chklogin.php", "POST", "mob="+usrname+"&pass="+pwd, fnWhenDone);

}

function checkdivlogin(){
	mob = document.getElementById("mo").value;
	pwd = document.getElementById("passwd").value;
	
	if(mob==""){
		 alert("Please enter mobile number !.");
		 document.getElementById("mo").focus();
		 return false;
	}
	if(pwd==""){
		 alert("Please enter password !.");
		 document.getElementById("passwd").focus();
		 return false;
	}
	return true;
}

//-->
