1 function CorrectWWW(theUrl)
2 {
3 // The current page has a www address
4 // The AJAX requested page has an absolute, not relative, address
5 // The AJAX requested page does not have a www address
6 if (window.location.href.indexOf("www.") != -1 &&
7 theUrl.indexOf("http://") != -1 &&
8 theUrl.indexOf("www.") == -1)
9 {
10 theUrl = theUrl.replace("http://", "http://www.");
11 }
12
13 // The current page does not have a www address
14 // The AJAX requested page has an absolute, not relative, address
15 // The AJAX requested page has a www address
16 else if (window.location.href.indexOf("www.") == -1 &&
17 theUrl.indexOf("http://") != -1 &&
18 theUrl.indexOf("www.") != -1)
19 {
20 theUrl = theUrl.replace("http://www.", "http://");
21 }
22
23 return theUrl;
24 }