$(document).ready(function() {

	// set language
	setLang();

	// show the dropdown
	getLangDropdown();

	// load the menu
	buildMenu();

	// load the footer menu
	getFooterMenu();

});



// set language function
function setLang() {

	// get language if is setup if not set it to 'en'
	var lang = getLang();
	if(lang==null) {
		var id = $.url.attr('anchor');
		if(id==null) {
			lang = "en";
		} else {
			str = id.split(",");
			lang = str[1];
		}
	}

	// set cookie language
	var cookieName = 'langcookie';
	var cookieOptions = {expires:30, path: '/'};
	$.cookie(cookieName, lang, cookieOptions);

}


// change language function
function changeLang(ln) {

	// if somehow the ln variable is not defined set it to 'en'
	if(typeof(ln)=='undefined') {
		ln = 'en';
	}

	// set the language cookie
	var cookieName = 'langcookie';
	var cookieOptions = {expires:30, path: '/'};
	$.cookie(cookieName, ln, cookieOptions);

	// redirect to lang page
	getRedirectPage(ln);

}


// set page cookie
function setPageCookie(page) {

	var cookieName = 'pagecookie';
	var cookieOptions = {expires:30, path: '/'};
	$.cookie(cookieName, page, cookieOptions);

}


// get the lanauge
function getPageFromCookie() {

	return $.cookie('pagecookie');

}


// redirect to lang page

function getRedirectPage(lang) { 

                var ufile = $.url.attr("file");
                cpage = getPageFromCookie();

                if(cpage == "") {

                                str = cpage.split(",");

                                page = str[0];

                                id = str[2];

                                rfile = ufile+"#"+page+","+lang+","+id;

                } else {

                                rfile = "index.html#home,"+lang+",0";   

                } 

                window.location.href = rfile;

                location.reload(); 

}



// get the lanauge
function getLang() {

	return $.cookie('langcookie');

}


// build the top dropdown language
function getLangDropdown() {

//var a=getlang();
var getla=$.cookie('langcookie');
$.ajax(

{

		type: "GET",
                url: "data/"+getla+"/langdrop.xml",
                //url="data/"+getLang()+"/langdrop.xml",
		dataType: "xml",
		success: function(xml) {

                  var name = $(xml).find("head").text();

		$("#langname").html(name);

		// build the dropdown
		var opts = "";
		$('name',xml).each(function(i) {
			var selectit;
			var lname = $(this).text();
			var langval = $(this).attr("val");
			if(getLang()==langval) {
				selectit = "selected=\"selected\"";
			} else {
				selectit = "";
			}
			opts += "<option value=\""+langval+"\" "+selectit+">"+lname+"</option>";

		});
                $("#lang").html(opts);

	}});
}

// get the downloads from XML and build the div for the accordion script
function showDownloads() {

	TopLogos();

	$.get("data/"+getLang()+"/download.xml",function(xml) {
		page = $(xml).find("page").text();
		$('group',xml).each(function(i) {
			name = $(this).find("head").text();
			fileobj = $(this).find("files");
			$("#groups").append("<a class='head'><h2>"+name+"</h2></a>");
			dwfiles = "";
			$('name',fileobj).each(function(x) {
				name = $(this).text();
				path = $(this).attr("path");
				//if path is a relative path
				if(path.toLowerCase().indexOf("http://")== -1){
					//dwfiles += "<a href='data/"+getLang()+"/downloads/"+path+"' target=\"_new\">"+name+"</a>";
					dwfiles += "<a href='data/"+getLang()+"/downloads/"+path+"' target=\"_new\"  onclick=' googleTracker(" + path + ")'    >"+name+"</a>";
				//path is full url
				}else{
					//dwfiles += "<a href='"+path+"' target=\"_new\">"+name+"</a>";
					dwfiles += "<a href='"+path+"' target=\"_new\" onclick=' googleTracker(" + path + ")'     >"+name+"</a>";
					
				}
			});
			$("#groups").append("<div><p>"+dwfiles+"</p></div>");
		});
		$(".downloadtext").html(page);
		$('#groups').accordion({
			active:false,
			header:'.head',
			navigation:true,
			animated:'easeslide'
		});

		renderMenu('7');

	});

}


// build the left menu
function buildMenu() {

	$.get("data/"+getLang()+"/menu.xml",function(xml) {
		$('menu',xml).each(function(i) {
			var nameobj = $(this).find("name");
			var name = $(this).find("name").text();
			var url = $(nameobj).attr("url");
			var page = $(nameobj).attr("page");
			$("#menu").append(BuildLink(i,name,url,page)+"<ul id="+i+"></ul>");
		});
	});

	$("#left").append("<br /><br /><a href=\"http://www.ichotelsgroup.com\"><img src=\"images/btn-rez-"+getLang()+".jpg\" border=\"0\" alt=\"\" /></a>");

}


// underline current link from menu
function renderMenu(id) {

	id = id.substring(0,2);

	$("a").removeClass("current");
	$("a").removeClass("currentroot");

	$("#lmenu"+id).addClass("current");

	if(id.length>1) {
		$("#lmenu"+id.substring(0,1)).addClass("currentroot");
	}

}


// build the slide show for homepage
function showHome() {

	$.get("data/"+getLang()+"/home.xml",function(xml) {

		var title = $(xml).find("title").text();
		var mkey = $(xml).find("meta_key").text();
		var mdesc = $(xml).find("meta_desc").text();

		$(document).attr("title", title);
		$('meta[name=keywords]').attr('content', mkey);
		$('meta[name=description]').attr('content', mdesc);

		var img = "";
		var namediv = "";
		$('image',xml).each(function(i) {
			var name = $(this).text();
			var path = $(this).attr("path");
			var alt = $(this).attr("alt");
			img += "<img src=\""+path+"\" id=\"img"+i+"\" alt=\""+alt+"\" width=\"755\" height=\"378\" />";
			namediv += "<div class=\"name\" id=\"nameimg"+i+"\">"+name+"</div>";
		});
		$("#home").html(img+""+namediv+"<div id=\"nav\"></div>");
		$("#homecont").html($(xml).find("cont").text());

		$('#home').cycle({
			fx:'fade',
			speed:500,
			timeout:4000,
			pager:'#nav',
			pagerAnchorBuilder: function(idx, slide) {
				return '<a href="#"></a>';
			},
			before:showNextTopLogo,
			slideExpr:'img'
		});

		renderMenu('0');

	});

}


// show the top logo tied with the image from the slide
function showNextTopLogo() {

	$(".name").hide();
	$("#name"+$(this).attr("id")).show();
	TopLogos($(this).attr("id"));

}


// show the content for the page.html template
function showcont(id) {

	removeSubMenus();
	setPageCookie(id);

	if(id==null) {
		page = "";
		id = 1;
	} else {
		str = id.split(",");
		page = str[0];
		id = str[2];
	}

	$.get("data/"+getLang()+"/page.xml",function(xml) {

		var pg = $(xml).find("page").filter("[id="+id+"]");
		var title = $(pg).find("title").text();
		var mkey = $(pg).find("meta_key").text();
		var mdesc = $(pg).find("meta_desc").text();
		var cont = $(pg).find("content").text();
		$("#cont").html(cont);
		$("#cont").animate({scrollTop:0}, 'fast');

		$(document).attr("title", "IHG Hotel Franchise - "+title);
//		$('title').text("IHG Hotel Franchise - "+title);
		$('meta[name=keywords]').attr('content', mkey);
		$('meta[name=description]').attr('content', mdesc);

		var imgs = "";
		var img = $(pg).find("images");
		var x = 0;
		$("image",img).each(function(i) {

			var imgname = $(this).find("name").text();
			var imgpath = $(this).find("path").text();
			imgs += "<img src='"+imgpath+"' alt='"+imgname+"' />";
			x++;

		});
		$("#img").html(imgs);

		// rotate the images
		if(x > 1) {
			$("#img").cycle({
				fx:'fade'
			});
		}

		renderMenu(id);

	});

	getSubMenu(id.substring(0,1),id);

}


// show the regions
function showRegion(id,ishome) {

	TopLogos();
	removeSubMenus();
	setPageCookie(id);

	if(id==null) {
		page = "";
		id = 50;
	} else {
		str = id.split(",");
		page = str[0];
		id = str[2];
	}

	getRegionTopMenu(id.substring(0,2),id);

	$.get("data/"+getLang()+"/page.xml",function(xml) {

		var pg = $(xml).find("page").filter("[id="+id+"]");
		var title = $(pg).find("title").text();
		var mkey = $(pg).find("meta_key").text();
		var mdesc = $(pg).find("meta_desc").text();
		var cont = $(pg).find("content").text();

		if(ishome==1) {
			$("#region").html(cont);
		} else {
			$("#cont").html(cont);
		}

		$(document).attr("title", "IHG Hotel Franchise - "+title);
		$('meta[name=keywords]').attr('content', mkey);
		$('meta[name=description]').attr('content', mdesc);

		var imgs = "";
		var img = $(pg).find("images");
		var x = 0;
		$("image",img).each(function(i) {

			var imgname = $(this).find("name").text();
			var imgpath = $(this).find("path").text();
			imgs += "<img src='"+imgpath+"' alt='"+imgname+"' />";
			x++;

		});
		$("#img").html(imgs);

		// rotate the images
		if(x > 1) {
			$("#img").cycle({
				fx:'fade'
			});
		}

		renderMenu(id);

	});

	getSubMenu(id.substring(0,1),id);

}


// show the content for the portfolio.html template
function showportfolio(id) {

	TopLogosSel(id);
	removeSubMenus();
	setPageCookie(id);

	if(id==null) {
		page = "";
		id = 20;
	} else {
		str = id.split(",");
		page = str[0];
		id = str[2];
	}

	getTopMenu(id.substring(0,2),id);

	$.get("data/"+getLang()+"/portfolio.xml",function(xml) {

		var pg = $(xml).find("portfolio").filter("[id="+id+"]");
		var title = $(pg).find("title").text();
		var mkey = $(pg).find("meta_key").text();
		var mdesc = $(pg).find("meta_desc").text();
		var cont = $(pg).find("content").text();
		$("#cont").html(cont);
		$("#cont").animate({scrollTop:0}, 'fast');

		$(document).attr("title", "IHG Hotel Franchise - "+title);
		$('meta[name=keywords]').attr('content', mkey);
		$('meta[name=description]').attr('content', mdesc);

		var imgs = "";
		var img = $(pg).find("images");
		var x = 0;
		$("image",img).each(function(i) {

			imgname = $(this).find("name").text();
			imgpath = $(this).find("path").text();
			imgs += "<img src='"+imgpath+"' alt='"+imgname+"' />";
			x++;

		});
		$("#img").html(imgs);

		if(page!="gallery") {
			// rotate the images
			if(x > 1) {
				$("#img").cycle({
					fx:'fade'
				});
			}
		}

		renderMenu(id);

	});

	getSubMenu(id.substring(0,1),id);

}


// show gallery page
function showportfoliog(id) {

	TopLogosSel(id);
	removeSubMenus();
	setPageCookie(id);

	if(id==null) {
		page = "";
		id = 20;
	} else {
		str = id.split(",");
		page = str[0];
		id = str[2];
	}

	getTopMenu(id.substring(0,2),id);

	$.get("data/"+getLang()+"/portfolio.xml",function(xml) {

		imgs = "";
		pg = $(xml).find("portfolio").filter("[id="+id+"]");
		img = $(pg).find("images");

		title = $(pg).find("title").text();
		mkey = $(pg).find("meta_key").text();
		mdesc = $(pg).find("meta_desc").text();

		$(document).attr("title", "IHG Hotel Franchise - "+title);
//		$('title').text("IHG Hotel Franchise - "+title);
		$('meta[name=keywords]').attr('content', mkey);
		$('meta[name=description]').attr('content', mdesc);

		$("image",img).each(function(i) {

			imgname = $(this).find("name").text();
			imgpath = $(this).find("path").text();
			imgs += "<li><a href=\"javascript:showgimg('"+imgpath+"','"+imgname+"');\"><img src=\""+imgpath+"\" width=\"95\" height=\"40\" border=\"0\" alt=\""+imgname+"\" /></a></li>";
			if(i==0) {
				$("#gallery").css('background-image', 'url('+imgpath+')');
				$("#gimgname").html(imgname);
			}

		});
		$("#grot").html(imgs);

		$('#grot').jcarousel({
			vertical:true,
			scroll:1
		});

		renderMenu(id);

	});

	getSubMenu(id.substring(0,1),id);

}


// show prototypes page
function showportfoliop(id) {

	TopLogosSel(id);
	removeSubMenus();
	setPageCookie(id);

	if(id==null) {
		page = "";
		id = 20;
	} else {
		str = id.split(",");
		page = str[0];
		id = str[2];
	}

	getTopMenu(id.substring(0,2),id);

	$.get("data/"+getLang()+"/portfolio.xml",function(xml) {

		var pg = $(xml).find("portfolio").filter("[id="+id+"]");
		var cont = $(pg).find("content").text();
		$("#cont").html(cont);

		var title = $(pg).find("title").text();
		var mkey = $(pg).find("meta_key").text();
		var mdesc = $(pg).find("meta_desc").text();

		$(document).attr("title", "IHG Hotel Franchise - "+title);
//		$('title').text("IHG Hotel Franchise - "+title);
		$('meta[name=keywords]').attr('content', mkey);
		$('meta[name=description]').attr('content', mdesc);

		var snr = "";
		var img = $(pg).find("images");
		var x = 1;
		$("image",img).each(function(i) {

			imgname = $(this).find("name").text();
			imgpath = $(this).find("path").text();
			snr += "<li><a href=\"javascript:showpimg('"+imgpath+"','"+imgname+"');\">"+x+"</a></li>";

			if(x==1) {
				simg = "<img src=\""+imgpath+"\" alt=\""+imgname+"\" />";
				protoname = imgname;
			}

			x++;

		});
		$("#img").html(simg);
		if(x > 2) {
			$(".redbox").html("<ul>"+snr+"<li id=\"protoname\"></li></ul>");
		}
		$("#protoname").html(protoname);

		renderMenu(id);

	});

	getSubMenu(id.substring(0,1),id);

}


// show contact form
function showContact() {

	TopLogos();
	//previous
	//$.get("data/"+getLang()+"/contact.xml",function(xml) {
	//end of previous
	//new code by rajesh
	var getla = $.cookie('langcookie');

	$.ajax({

		type: "GET",
			url: "data/"+getla+"/contact.xml",
			dataType: "xml",
			success: function(xml) {
				$("set",xml).each(function(i) {
					var sel = $(this).find("selects");
					var selid = $(sel).attr("name");
					var label = $(this).find("label").text();
					var id = $(this).attr("name");
					$("#"+id).html(label);
					
					//Alain - 7/31/2011
					//handle button
					if(id=="button"){
						document.form_contact.button.value=label;
					}
					
					
					
					if(selid!=undefined) {
						var opts = "";
						$("name",sel).each(function(i) {
							if(i==0) {
								opts += "<option value=\"\"></option>";
							}
							var selectit;
							optname = $(this).text();
							selectit = "";
							//opts += "<option value=\""+selid+"\" "+selectit+">"+optname+"</option>";
							opts += "<option value='"+optname+"' "+selectit+">"+optname+"</option>";
							//previous
							//$("#"+selid).append(new Option(optname, optname, true, true));
							//end of previous
						});
						$("#"+selid).html(opts);
					}

		});

		renderMenu('6');

		}});//end of $.get

}


// show the image for prototype page
function showpimg(img,name) {

	img = "<img src=\""+img+"\" alt=\"\" />";
	$("#img").html(img);
	$("#protoname").html(name);

}


// show the image for gallery page
function showgimg(img,name) {

	$("#gallery").css('background-image', 'url('+img+')');
	$("#gimgname").html(name);

}


// get top menu for portfolio pages
function getTopMenu(id,cid) {

	$.get("data/"+getLang()+"/menu.xml",function(xml) {
		sb = $(xml).find("topsubmenu").filter("[id="+id+"]");
		color = $(sb).attr("background");
		tm = "<ul>";
		$("tsmenu",sb).each(function(i) {
			name = $(this).text();
			url = $(this).attr("url");
			id = $(this).attr("id");
			page = $(this).attr("page");
			tm += BuildTLink(id,cid,name,url,page);
		});
		tm += "</ul>";
		$("#topmenu").css('background-color', '#'+color+'');
		$("#topmenu").html(tm);
	});

}


// get regions top menu
function getRegionTopMenu(id,cid) {

	$.get("data/"+getLang()+"/menu.xml",function(xml) {
		sb = $(xml).find("topsubmenu").filter("[id="+id+"]");
		tm = "<ul>";
		$("tsmenu",sb).each(function(i) {
			name = $(this).text();
			url = $(this).attr("url");
			id = $(this).attr("id");
			page = $(this).attr("page");
			tm += BuildTLink(id,cid,name,url,page,'region');
		});
		tm += "</ul>";
		$("#rtopmenu").html(tm);
	});

}


// build the submenu function
function getSubMenu(x,sid) {

	$.get("data/"+getLang()+"/menu.xml",function(xml) {
		sb = $(xml).find("submenu").filter("[id="+x+"]");
		$("sname",sb).each(function(i) {
			name = $(this).text();
			url = $(this).attr("url");
			id = $(this).attr("id");
			page = $(this).attr("page");
			$("#menu").find("ul").filter("[id="+x+"]").append(BuildLink(id,name,url,page));
		});
		renderMenu(sid);
	});

}


// show footer menu
function getFooterMenu() {

	$.get("data/"+getLang()+"/menu-footer.xml",function(xml) {
		var bmenu = "<div>";
		$("menu",xml).each(function(i) {
			var name = $(this).text();
			var url = $(this).attr("url");
			if(i%3==0) {
				bmenu += "</div><div class='box'>"+BuildFLink(name,url);
			} else {
				bmenu += BuildFLink(name,url);
			}
		});
		bmenu += "</div><div class='clear'></div><br /><br />&copy; InterContinental Hotels Group 2010";
		$("#footer").append(bmenu);
	});

}


// remove all submenus function
function removeSubMenus() {

	for(i=0;i<=6;i++) {
		$("#menu").find("ul").filter("[id="+i+"]").empty();
	}

}


// top logos for inner pages
function TopLogos(id) {

	$.get("data/"+getLang()+"/toplogos.xml",function(xml) {
		tl = "";
		$("logo",xml).each(function(i) {
			on = $(this).find("on").text();
			off = $(this).find("off").text();
			homel = $(this).find("home").text();
			uname = $(this).find("uname").text();
			pid = $(this).find("id").text();
			if(id=="img"+i) {
				tl += "<a href=\"portfolio.html#"+uname+","+getLang()+","+pid+"\"><img src=\""+homel+"\" border=\"0\" alt=\"\" /></a>";
			} else {
				tl += "<a id=\"limg"+i+"\" href=\"portfolio.html#"+uname+","+getLang()+","+pid+"\" onmouseout=\"MM_swapImgRestore()\" onmouseover=\"MM_swapImage('img"+i+"','','"+on+"',1)\"><img src=\""+off+"\" name=\"img"+i+"\" alt=\"\" border=\"0\" id=\"img"+i+"\" /></a>";
			}
		});
		$("#hotel-logos").html(tl);
	});

}


// top logos for inner pages
function TopLogosSel(id) {

	str = id.split(",");
	page = str[0];
	id = str[2];
	id = id.substring(1,2);

	$.get("data/"+getLang()+"/toplogos.xml",function(xml) {
		var tl = "";
		$("logo",xml).each(function(i) {
			on = $(this).find("on").text();
			off = $(this).find("off").text();
			homel = $(this).find("home").text();
			uname = $(this).find("uname").text();
			pid = $(this).find("id").text();
			if(id==i) {
				tl += "<a href=\"portfolio.html#"+uname+","+getLang()+","+pid+"\"><img src=\""+on+"\" border=\"0\" alt=\"\" /></a>";
			} else {
				if(page=="gallery" || page=="prototypes" || page=="development") {
					tl += "<a id=\"limg"+i+"\" href=\"portfolio.html#"+uname+","+getLang()+","+pid+"\" onmouseout=\"MM_swapImgRestore();\" onmouseover=\"MM_swapImage('img"+i+"','','"+on+"',1);\"><img src=\""+off+"\" name=\"img"+i+"\" border=\"0\" id=\"img"+i+"\" alt=\"\" /></a>";
				} else {
					tl += "<a id=\"limg"+i+"\" href=\"portfolio.html#"+uname+","+getLang()+","+pid+"\" onclick=\"showportfolio('"+uname+","+getLang()+","+pid+"');\" onmouseout=\"MM_swapImgRestore();\" onmouseover=\"MM_swapImage('img"+i+"','','"+on+"',1);\"><img src=\""+off+"\" name=\"img"+i+"\" border=\"0\" id=\"img"+i+"\" alt=\"\" /></a>";
				}
			}
		});
		$("#hotel-logos").html(tl);
	});

}


// build footer link function
function BuildFLink(name,url){

	return "<a href=\""+url+"\">"+name+"</a><br />";

}


// build top link function
function BuildTLink(i,cid,name,url,page,cat){

	if(cat=="region") {

		if(i==cid) {
			return "<li><a href=\""+url+"#"+page+","+getLang()+","+i+"\" onclick=\"javascript:showRegion('"+page+","+getLang()+","+i+"');\">&bull; "+name+"</a></li>";
		} else {
			return "<li><a href=\""+url+"#"+page+","+getLang()+","+i+"\" onclick=\"javascript:showRegion('"+page+","+getLang()+","+i+"');\">"+name+"</a></li>";
		}

	} else {

		if(i==cid) {
			return "<li><a href=\""+url+"#"+page+","+getLang()+","+i+"\" onclick=\"javascript:showportfolio('"+page+","+getLang()+","+i+"');\">&bull; "+name+"</a></li>";
		} else {
			return "<li><a href=\""+url+"#"+page+","+getLang()+","+i+"\" onclick=\"javascript:showportfolio('"+page+","+getLang()+","+i+"');\">"+name+"</a></li>";			
		}

	}

}


// build link function
function BuildLink(i,name,url,page){

	var pid;
	if(i.length>1) {
		pid = i.substring(0,1);
	}

	if(pid==2) {
		return "<li><a id=\"lmenu"+i+"\" href=\""+url+"#"+page+","+getLang()+","+i+"\" onclick=\"javascript:showportfolio('"+page+","+getLang()+","+i+"');\">"+name+"</a></li>";
	} else if(pid==5) {
		return "<li><a id=\"lmenu"+i+"\" href=\""+url+"#"+page+","+getLang()+","+i+"\" onclick=\"javascript:showRegion('"+page+","+getLang()+","+i+"');\">"+name+"</a></li>";
	} else {
		return "<li><a id=\"lmenu"+i+"\" href=\""+url+"#"+page+","+getLang()+","+i+"\" onclick=\"javascript:showcont('"+page+","+getLang()+","+i+"');\">"+name+"</a></li>";
	}

}


// mousover script
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}

// google analytics
var _gaq = _gaq || [];
_gaq.push(['_setAccount', 'UA-18836206-1']);
_gaq.push(['_trackPageview']);

(function() {
var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
})();


function googleTracker(virtual_link){
	//alert("Tracking Google" + virtual_link);
	  _gaq.push(['_trackPageview', virtual_link]); 
}
