function getXMLHTTP() { 
		var xmlhttp=false;	
		try{
			xmlhttp=new XMLHttpRequest();
		}
		catch(e)	{		
			try{			
				xmlhttp= new ActiveXObject("Microsoft.XMLHTTP");
			}
			catch(e){
				try{
				xmlhttp = new ActiveXObject("Msxml2.XMLHTTP");
				}
				catch(e1){
					xmlhttp=false;
				}
			}
		}
		 	
		return xmlhttp;
    }
function getVisina(sirinaId) {

	var strURL = "findVisina.php?sirina=" + sirinaId;
	var req = getXMLHTTP();

	if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
					document.getElementById('visinadiv').innerHTML = req.responseText;
				} else {
					alert("There was a problem while using XMLHTTP:\n"
							+ req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}
}
function getFelna(sirinaId, visinaId) {
	var strURL = "findFelna.php?sirina=" + sirinaId + "&visina=" + visinaId;
	var req = getXMLHTTP();

	if (req) {

		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {
					document.getElementById('felnadiv').innerHTML = req.responseText;
				} else {
					alert("There was a problem while using XMLHTTP:\n"
							+ req.statusText);
				}
			}
		}
		req.open("GET", strURL, true);
		req.send(null);
	}

}
	function getState(countryId) {		
		
		var strURL="tip.php?country="+countryId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('statediv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	function getCity(countryId,stateId) {		
		var strURL="ime.php?country="+countryId+"&state="+stateId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('citydiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}
				
	}

	function getModel(modelId) {		
		
		var strURL="findModel.php?model="+modelId;
		var req = getXMLHTTP();
		
		if (req) {
			
			req.onreadystatechange = function() {
				if (req.readyState == 4) {
					// only if "OK"
					if (req.status == 200) {						
						document.getElementById('modeldiv').innerHTML=req.responseText;						
					} else {
						alert("There was a problem while using XMLHTTP:\n" + req.statusText);
					}
				}				
			}			
			req.open("GET", strURL, true);
			req.send(null);
		}		
	}
	
function zemicategory(x){
var variable = x;
location.href="delovi.php?variable=" + variable;
}

function carZemiModel(x)
{
	var strURL="kola.php?proizvoditeli="+x;
	var req = getXMLHTTP();
	
	if (req) {
		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('mod').innerHTML=req.responseText;
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function carZemiKola(y, x, z)
{
	var strURL="kola.php?proizvoditeli="+x+"&model="+y+"&bandas="+z;
	var req = getXMLHTTP();
	
	if (req) {
		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('kola').innerHTML=req.responseText;						
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", strURL, true);
		req.send(null);
	}
}

function smeniBandas(y, x, z, a)
{
	var strURL="kola.php?proizvoditeli="+x+"&model="+y+"&bandas="+z+"&samo="+a;
	var req = getXMLHTTP();
	
	if (req) {
		
		req.onreadystatechange = function() {
			if (req.readyState == 4) {
				// only if "OK"
				if (req.status == 200) {						
					document.getElementById('lev_bandas').innerHTML=req.responseText;	
					document.getElementById('desen_bandas').innerHTML=req.responseText;
				} else {
					alert("There was a problem while using XMLHTTP:\n" + req.statusText);
				}
			}				
		}			
		req.open("GET", strURL, true);
		req.send(null);
	}
}
/***********************
*swaping css for diferent browser type
***********************/
 if (navigator.appName == "Microsoft Internet Explorer"){
   document.write('<link rel="stylesheet" type="text/css" href="iestyle.css">')
 } else {
	document.write('<link rel="stylesheet" type="text/css" href="style.css">')
 }
 


//Script Source: CodeLifter.com
//Copyright 2003

//SETUPS:
//===============================

//Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

//Set these value approximately 20 pixels greater than the
//size of the largest image to be used (needed for Netscape)

defaultWidth  = 600;
defaultHeight = 300;

//Set autoclose true to have the window close automatically
//Set autoclose false to allow multiple popup windows

var AutoClose = false;

//================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=yes,width=600,height=300,left='+PositionX+',top='+PositionY;
function popImageParts(imageURL,imageTitle,imageOpis,imageKorpiche,id,cena,proizvoditel){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Shoping card UniRoyal</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
writeln('width=300-(document.body.clientWidth-document.images[0].width);');
writeln('height=300-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
writeln('window.innerWidth=document.images["uniroyal"].width;');writeln('window.innerHeight=document.images["uniroyal"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body style="background-color:#333333;" scroll="yes" doTitle();self.focus()">')
else writeln('</head><body style="background-color:#333333;" scroll="yes" doTitle();self.focus()">');
writeln('<table align="center"><tr><td style = "margin-left: 130px; color:#FFFFFF;" align="center"><strong>'+proizvoditel+'</a></strong></tr></td><tr><td style = "margin-left: 130px; color:#FFFFFF;" align="center"><strong>'+imageTitle+'</a></strong></tr></td>');
write( '<tr><td><div align="center" style="border: 1px;border-style: solid;background-color: black;"><img align="middle" name="uniroyal" src='+imageURL+' style="display:block" hight="300px" width="300px" ></div></td></tr>');
writeln('<tr><td style="color:#FFFFFF;" align="center"><strong>Опис :</strong><br/> <a align="center" style=" color:#FFFFFF; text-align: justify;" >'+imageOpis+'</a></td></tr>');
writeln('<tr><td style="color:#FFFFFF;" align="center"><br/><strong>ЦЕНА :<a align="left">'+cena+'</a></strong><br /><br /><a href="cart_parts/cart.php?action=add&id='+id+'"><img align="middle" style="border: 0px" name="uniroyal" src='+imageKorpiche+' hight="30px" width="30px" ></a></td></tr></table></body></html>');
close();		
}}
//Script Source: CodeLifter.com
//Copyright 2003

//SETUPS:
//===============================

//Set the horizontal and vertical position for the popup

PositionX = 100;
PositionY = 100;

//Set these value approximately 20 pixels greater than the
//size of the largest image to be used (needed for Netscape)

defaultWidth  = 600;
defaultHeight = 630;

//Set autoclose true to have the window close automatically
//Set autoclose false to allow multiple popup windows

var AutoClose = false;

//================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=yes,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=yes,width=600,height=300,left='+PositionX+',top='+PositionY;
function popImageTires(imageURL,imageTitle,imageOpis,imageKorpiche,id,cena,model){
	if (isNN){imgWin=window.open('about:blank','',optNN);}
	if (isIE){imgWin=window.open('about:blank','',optIE);}
	with (imgWin.document){
	writeln('<html><head><title>Shoping card UniRoyal</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
	writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
	writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
	writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(300,300);');
	writeln('width=300-(document.body.clientWidth-document.images[0].width);');
	writeln('height=300-(document.body.clientHeight-document.images[0].height);');
	writeln('window.resizeTo(width,height);}');writeln('if (isNN){');       
	writeln('window.innerWidth=document.images["uniroyal"].width;');writeln('window.innerHeight=document.images["uniroyal"].height;}}');
	writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
	if (!AutoClose) writeln('</head><body style="background-color:#333333;" scroll="yes" doTitle();self.focus()">')
else writeln('</head><body style="background-color:#333333;" scroll="yes" doTitle();self.focus()">');
writeln('<table align="center"><tr><td style = "margin-left: 130px; color:#FFFFFF;" align="center"><strong>'+imageTitle+'</a></strong></tr></td><tr><td style = "margin-left: 130px; color:#FFFFFF;" align="center"><strong>'+model+'</a></strong></tr></td>');
write( '<tr><td><div align="center" style="border: 1px;border-style: solid;background-color: black;"><img align="middle" name="uniroyal" src='+imageURL+' style="display:block" hight="300px" width="300px" ></div></td></tr>');
writeln('<tr><td style="color:#FFFFFF;" align="center"><strong>Опис :</strong><br/> <a align="center" style=" color:#FFFFFF; text-align: justify;" >'+imageOpis+'</a></td></tr>');
writeln('<tr><td style="color:#FFFFFF;" align="center"><br/><strong>ЦЕНА :<a align="left">'+cena+'</a></strong><br/><a href="cart_tires/cart.php?action=add&id='+id+'"><img align="middle" style="border: 0px" name="uniroyal" src='+imageKorpiche+' hight="30px" width="30px" ></a></td></tr></table></body></html>');
close();		
	}}


