<%@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")

ff = "Sitemap\\Sitemap-category.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
	 Response.End()
}else{


	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">'
	
COMP_SQL = "SELECT id,[title_"+LNG+"] AS title FROM Category WHERE parent_id "	
Build_Menu = ""
RS_M_root = Conn.execute( COMP_SQL + " IS Null ORDER BY sort") 


while (!(RS_M_root.eof)){ 
Build_Menu += xml_url('http://glasman.fr/c'+RS_M_root("id").value+'/'+RS_M_root("title").value.replace(/ |\.|'/g,"-")+'.html',"0.9")
RS_M_sub = Conn.execute(COMP_SQL + " = "+RS_M_root("id").value + " ORDER BY sort") ; 
while (!(RS_M_sub.eof)){ 
Build_Menu += xml_url('http://glasman.fr/c'+ RS_M_sub("id").value +'/'+ RS_M_root("title").value.replace(/ |\.|'/g,"-") + '/' +RS_M_sub("title").value.replace(/ |\.|'/g,"-")+'.html',"0.8")
RS_M_subsub = Conn.execute(COMP_SQL + " = "+RS_M_sub("id").value + " ORDER BY sort" )
while (!(RS_M_subsub.eof)){  
Build_Menu += xml_url('http://glasman.fr/c'+ RS_M_subsub("id").value +'/'+RS_M_root("title").value.replace(/ |\.|'/g,"-")+'/'+RS_M_sub("title").value.replace(/ |\.|'/g,"-")+'/'+ RS_M_subsub("title").value.replace(/ |\.|'/g,"-") +'.html',"0.7")
RS_M_subsub.MoveNext} 
RS_M_sub.MoveNext} 
RS_M_root.MoveNext} 
	

	out += Build_Menu
	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)
	
}

function xml_url(u,prio){
	return '<url><loc>'+u+'</loc><priority>'+prio+'</priority><changefreq>monthly</changefreq></url>'
}
Conn.close()


%>

