var id_cont = 0;

function isIE() {
  var strBrowser = navigator.userAgent.toLowerCase();
  return (strBrowser.indexOf("msie") > -1 && strBrowser.indexOf("mac") < 0);
}

function startFix() {
    if (isIE()) {
        document.write('<div style="display: none;" id="flash_div_'+id_cont+'">');
   }
}

function endFix() {
    if (isIE()) {
        document.write('</div>');
        document.getElementById('flash_div_'+id_cont).outerHTML = document.getElementById('flash_div_'+id_cont).innerHTML;
		id_cont++;
    }
}

function getFlashMovieObject(movieName)
{
  if (window.document[movieName]) 
  {
    return window.document[movieName];
  }
  if (navigator.appName.indexOf("Microsoft Internet")==-1)
  {
    if (document.embeds && document.embeds[movieName])
      return document.embeds[movieName]; 
  }
  else // if (navigator.appName.indexOf("Microsoft Internet")!=-1)
  {
    return document.getElementById(movieName);
  }
}





function suma(idpr,cant) {
input = document.getElementById('cantidad'+idpr).value;
if (isNaN(input)) {
		if (input != 1) {
		document.getElementById('cantidad'+idpr).value='1';
		}
	}else{
		if (document.getElementById('cantidad'+idpr).value < 1) {
			document.getElementById('cantidad'+idpr).value='1';
		}else{
			if (input >= 9999) {
				document.getElementById('cantidad'+idpr).value='9999';			
			}else{
				document.getElementById('cantidad'+idpr).value++;
			}
		}
	}
}



function resta(idpr,cant) {
input = document.getElementById('cantidad'+idpr).value;

	if (isNaN(input)) {
		document.getElementById('cantidad'+idpr).value='1';
	}else{
	
		if (input <= 1) {
			document.getElementById('cantidad'+idpr).value='1';
		}else{
			document.getElementById('cantidad'+idpr).value--;
		}
	}
}


function nuevoAjax()
{ 
	var xmlhttp=false; 
	try 
	{ 
		xmlhttp=new ActiveXObject("Msxml2.XMLHTTP"); 
	}
	catch(e)
	{ 
		try
		{ 
			xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); 
		} 
		catch(E) { xmlhttp=false; }
	}
	if (!xmlhttp && typeof XMLHttpRequest!='undefined') { xmlhttp=new XMLHttpRequest(); } 
	return xmlhttp; 
}

/*
function ocultar() {
if (document.getElementById("abajo").style.bottom=='0px') {
	document.getElementById("abajo").style.bottom='-100px';
	}else{
	document.getElementById("abajo").style.bottom='0px';
	}
}

function ocultarr(idelem) {
try {
	if (document.getElementById(idelem) != 'undefined') {
		document.getElementById(idelem).style.visibility = 'hidden';
	}
	} catch(e) {
	}
}	



function mostrarlogin() {
	ocultarr('errorl');
if (document.getElementById("logini").style.visibility == "hidden") {
		document.getElementById("logini").style.visibility = "visible";
		document.getElementById("user").focus();
		}else{
		document.getElementById("logini").style.visibility = "hidden";
	}
	}
function chck(formo) {
	if (formo.user.value == '') {
		formo.user.style.bgcolor="#FFDFE0";
		formo.user.focus();
		return false;
	}
	if (formo.clave.value == '') {
		formo.clave.style.bgcolor="#FFDFE0";
		formo.clave.focus();
		return false;
	}
	if (formo.user.disabled== true){
		formo.user.style.visibility='hidden';
		formo.user.disabled=false;
	}
}
*/
function contn(envio) {
	var ajax=nuevoAjax();
	ajax.open("POST", "js/carritodbk.php", true);
	ajax.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");
	ajax.send(envio);
	ajax.onreadystatechange=function()
	{
		if (ajax.readyState==4)
		{
			document.getElementById("carritodbk").innerHTML=ajax.responseText;
		}
	}
	
}

//http://www.featureblend.com/license.txt
var FlashDetect=new function(){var self=this;self.installed=false;self.raw="";self.major=-1;self.minor=-1;self.revision=-1;self.revisionStr="";var activeXDetectRules=[{"name":"ShockwaveFlash.ShockwaveFlash.7","version":function(obj){return getActiveXVersion(obj);}},{"name":"ShockwaveFlash.ShockwaveFlash.6","version":function(obj){var version="6,0,21";try{obj.AllowScriptAccess="always";version=getActiveXVersion(obj);}catch(err){}
return version;}},{"name":"ShockwaveFlash.ShockwaveFlash","version":function(obj){return getActiveXVersion(obj);}}];var getActiveXVersion=function(activeXObj){var version=-1;try{version=activeXObj.GetVariable("$version");}catch(err){}
return version;};var getActiveXObject=function(name){var obj=-1;try{obj=new ActiveXObject(name);}catch(err){obj={activeXError:true};}
return obj;};var parseActiveXVersion=function(str){var versionArray=str.split(",");return{"raw":str,"major":parseInt(versionArray[0].split(" ")[1],10),"minor":parseInt(versionArray[1],10),"revision":parseInt(versionArray[2],10),"revisionStr":versionArray[2]};};var parseStandardVersion=function(str){var descParts=str.split(/ +/);var majorMinor=descParts[2].split(/\./);var revisionStr=descParts[3];return{"raw":str,"major":parseInt(majorMinor[0],10),"minor":parseInt(majorMinor[1],10),"revisionStr":revisionStr,"revision":parseRevisionStrToInt(revisionStr)};};var parseRevisionStrToInt=function(str){return parseInt(str.replace(/[a-zA-Z]/g,""),10)||self.revision;};self.majorAtLeast=function(version){return self.major>=version;};self.minorAtLeast=function(version){return self.minor>=version;};self.revisionAtLeast=function(version){return self.revision>=version;};self.versionAtLeast=function(major){var properties=[self.major,self.minor,self.revision];var len=Math.min(properties.length,arguments.length);for(i=0;i<len;i++){if(properties[i]>=arguments[i]){if(i+1<len&&properties[i]==arguments[i]){continue;}else{return true;}}else{return false;}}};self.FlashDetect=function(){if(navigator.plugins&&navigator.plugins.length>0){var type='application/x-shockwave-flash';var mimeTypes=navigator.mimeTypes;if(mimeTypes&&mimeTypes[type]&&mimeTypes[type].enabledPlugin&&mimeTypes[type].enabledPlugin.description){var version=mimeTypes[type].enabledPlugin.description;var versionObj=parseStandardVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revisionStr=versionObj.revisionStr;self.revision=versionObj.revision;self.installed=true;}}else if(navigator.appVersion.indexOf("Mac")==-1&&window.execScript){var version=-1;for(var i=0;i<activeXDetectRules.length&&version==-1;i++){var obj=getActiveXObject(activeXDetectRules[i].name);if(!obj.activeXError){self.installed=true;version=activeXDetectRules[i].version(obj);if(version!=-1){var versionObj=parseActiveXVersion(version);self.raw=versionObj.raw;self.major=versionObj.major;self.minor=versionObj.minor;self.revision=versionObj.revision;self.revisionStr=versionObj.revisionStr;}}}}}();};FlashDetect.JS_RELEASE="1.0.4";


function mostrarcar(dbik){	
	document.getElementById("carritodbk").innerHTML='<img width="175" src="images/carg.gif" border="0" /><br /><small>Cargando..</small>';
	setTimeout("contn("+null+")",1500);
}

function agrega(idp,can,sidd){
	document.getElementById("carritodbk").innerHTML='<img width="175" src="images/carg.gif" border="0" /><br /><small>Cargando..</small>';
	setTimeout("contn('&idp="+idp+"&cnt="+can+"&sid="+sidd+"&ack=add')",500);
}


function quita(idp,sidd){
	document.getElementById("carritodbk").innerHTML='<img width="175" src="images/carg.gif" border="0" /><br /><small>Cargando..</small>';
	setTimeout("contn('&idp="+idp+"&sid="+sidd+"&ack=del')",500);
}