<%@LANGUAGE="Javascript" CODEPAGE="65001"%><% 
Session.CodePage = 65001
Response.CharSet = "UTF-8"
Session.LCID = 1036 
LNG = "fr"
date = new Date()
%><!--#include file="../inc/function.js"--><!--#include file="../inc/Conn.js"--><%
Response.ContentType="text/xml"

Server.ScriptTimeout=400



var fs = Server.CreateObject("Scripting.FileSystemObject")

RESULTS = 100
START = 500
ff = "Sitemap-article-0-"+START+".xml.cache0.txt"








fd = Server.MapPath(".") + "\\"
function coded(itm){
		return (String(itm) != "" && String(itm) != "undefined" && String(itm) != "null") ?  Server.URLEncode(itm) : ""
	}

if (fs.FileExists(fd + ff)){
	 f = fs.OpenTextFile(fd + ff, 1)
	 try{
	 out = f.ReadAll()
	 }catch(e){out = "Error 1"}
   	 Response.Write(out)
	 f.Close()
	 fs = null
}else{

	RS_Article = Conn.execute("SELECT id,marque,model,name_fr AS [name] FROM Product WHERE product_type IS null AND price >= 50")
	
	out = '<?xml version="1.0" encoding="UTF-8"?>'
	out += '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" '
	out += 'xsi:schemaLocation="http://www.sitemaps.org/schemas/sitemap/0.9 http://www.sitemaps.org/schemas/sitemap/0.9/sitemap.xsd">'
	
	RS_Article.Move = START
	
	counter = 0
	while (!(RS_Article.eof)){
		counter ++
		_URL = "http://glasman.fr/a"+RS_Article("id").value+"/"
		_DATA = RS_Article("Name").value +"-"+ RS_Article("Marque").value +"-"+ RS_Article("Model").value
		_URL += str2url(_DATA ) 
		_URL += ".html"
		out += xml_url(_URL )
	RS_Article.MoveNext
	if (RESULTS == counter){ break ; }
	}
	
	out += "</urlset>"
	
	
	var f = fs.CreateTextFile(fd + ff,false) 
	f.Close()
	f = fs.OpenTextFile(fd + ff, 2,true)
	f.Write(out)
	f.Close()
	fs = null
	
	Response.Write(out)
	
}

Conn.Close()
function xml_url(u){
	return '<url><loc>'+u+'</loc><priority>0.5</priority><changefreq>monthly</changefreq></url>'
}


%>

