/*
*  Funzioni per aggiungere il ref dell'affiliato ai link che puntano verso http://www.venere.com/qualcosa/altro/ancora/etc...
*  dipende dalla libreria: jquery
*  Giacomo Brunetti per gialexong.com / italian.it - 26 nov 2009
*  contact email: g.brunetti@gialexong.com
* you can use this code for shure, but please, try to leave this notice intact.
*/


jQuery(document).ready(function(){	
aggiungeRef('19589'); // aggiunge il ref=tuoref a tutti i link esterni che puntano verso venere.com
})


/*aggiunge ref=tuoref a tutti link che puntano verso venere.com*/
aggiungeRef = function(ref) {
var l = $('a');
try { /*wrappato*/
for (var a in l){
if(a == parseInt(a)){
		var b = l[a];
		var c = $(b);
		var temp = c.attr('href');
		var m=/http:\/\/www.venere.com/gi;
		var rm=/\?ref=0/gi;
		/*tolgo ref=0 quando c'e'...*/
		if(temp.match(rm)){
		/*console.log(temp.match(rm)); */
		temp=temp.replace(rm,"")
						}
		if(temp.match(m)) {
		/*console.log(temp.match(m)+" "+temp+" match trovato!")  */
		var nu = temp+"?ref="+ref
		c.attr('href',nu);
		}
			}
} 

} catch(errore){ 
/*console.log(errore);*/
}
	}
	
