<!--
var division = "Main";
var property = "sonypictures";
var url = document.URL.toLowerCase();


var useTitleTag = "";
var prettyPageName = "";
var startDir4Property = 2;
var site = "";


	if (url.match(/^https?:\/\/.*/)) {
	site = url.replace(/^(https?:\/\/)([^\/]+\.)([^\.\/]+)(\.?(:8080)?\/.*)$/,"$3");
	} else {
	site = url.replace(/^([^\/]*\/?\/?[^\/]+\.)([^\.\/]+)(\.?(:8080)?\/.*)$/,"$2");
	}

var QI = url.indexOf("//");
if(QI != -1){
	dom = url.substring(QI+2);
	TI = dom.indexOf("/");
	if(TI != -1){
	dom = dom.substring(0,TI);
	}
	QI = dom.indexOf(".")
	while(QI >= 0)
	{
	dom = dom.substring(QI+1);
	QI = dom.indexOf(".");
	site = dom;
	}
    site = site.replace(/:8080/, "");
	site = site.replace(/:8081/, "");
	site = site.replace(/\./, "");
		
	if (site.match(/^\d+$/)) 
	{site = "us";}
	if(dom == 'com'||dom == 'net'||dom == 'org'||dom =='info')
	{site = "us";}
	
	if(site.length > 2){
	site = "us";}


}


if (document.pgOvr && document.pgOvr.pgNm)
{
  url = document.pgOvr.pgNm.value;
  url = url.replace ("/m2/ftp","http://www.sonypictures.com");
  url = url.replace ("/m2/review","http://www.sonypictures.com");
  
  
  intl = url.indexOf("intl");  
  if (intl != -1) {
   intl = url.substring(intl + 5);
   slash = intl.indexOf("/");
   site = intl.substring(0,slash);
   
   if (site == "uk"){  
   	  url = url.replace ("http://www.sonypictures.com","http://www.sonypictures.co.uk");
   }else if(site == "jp"){
      url = url.replace ("http://www.sonypictures.com","http://www.sonypictures.jp");
   }else if(site == "au"){
      url = url.replace ("http://www.sonypictures.com","http://www.sonypictures.com.au");
   }

   if (site == "global")
   {   
   	division = "Sonypictures.net";
        global = url.indexOf("global");
	if (global != -1) {
   	global = url.substring(global + 7);
   	slash = global.indexOf("/");
	if(slash != -1){
   	site = global.substring(0,slash);
	if(site == "cn"){
      	  division = "Movies";
	  property = "kungfuhustle";
	  startDir4Property = 0;}
	else if(site.length > 2 ){
	  site = "global";
	  startDir4Property = 4;
	}	
	else{
	  startDir4Property = 0;
	  property = "Sonypictures.net";
	}
	}
	else{startDir4Property = 0;
	property = division + "-Home";}
	}	
   }else{ url = url.replace(/\/intl\/\w+/, "");}
  } 
 }


 
  
function getData()
{
    
    var foundSectionName = true;
    var foundPropertyVariable = false;
    if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/movies\/.*/i)) {
        division = "Movies";
        startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/tv\/.*/i)) {
        division = "Television";
        startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/homevideo\/.*/i)) {
        division = "Home+Video";
	startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/[^\/]+\/homevideo\/.*/i)) {
        division = "Television";
        startDir4Property = 4;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/music\/.*/i)) {
        division = "Music";
        startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/games\/.*/i)) {
        division = "Games";
	startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/mobile\/.*/i)) {
        division = "Mobile";
        startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/intl\/.*/i)) {
        division = "International";
	startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/employment\/.*/i)) {
        division = "Employment";
        startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/corporate\/.*/i)) {
        division = "Corporate Main";
	startDir4Property = 3;
    } else {
	foundSectionName = false;
    }

    if (startDir4Property == 1) {
        if (url.match(/(^https?:\/\/[^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property = url.replace(/(^https?:\/\/[^\/]+\/)([^\/]+)(\/.*$)/i, "$2");
            foundPropertyVariable = true;
        }
    } else if (startDir4Property == 2) {
        if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property = url.replace(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+)(\/.*$)/i, "$2");
            foundPropertyVariable = true;
        }
    } else if (startDir4Property == 3) {
        if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property = url.replace(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i, "$3");
            foundPropertyVariable = true;
        }
    } else if (startDir4Property == 4) {
        if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property = url.replace(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i, "$4");
            foundPropertyVariable = true;
        }
    }

    if (foundPropertyVariable == true) {
        property = property.replace(/[^\w\d_\-]/g, "");
    }
}

var vanityURL = url;
var domainCut= vanityURL.indexOf("//");
var endString = vanityURL.substring (domainCut+2);
    domainCut= endString.indexOf("/");
    if (domainCut== -1) { endString = "Home-index.html"; }
    else { endString = endString.substring (domainCut+1);
    domainCut= endString.indexOf ("?");}
    if ( endString == "" ) { endString = "Home-index.html"; }

//Updates tag for Movie and Tv Show Names
getData();
//changes digent for UK to Mobile
if(property == "digent" && site == "uk")
{ division = "Mobile";
  property = "mobile";}
  
//clarification for games

if(division == "Games"){
  property = property + "game";
}

//Creates HomePage Traffic

var homepage = 0;
var OT = url.indexOf("//");
if (OT != -1){
	checkindex = url.substring(OT+2);
	OU = checkindex.indexOf("/");
	if(OU == -1)
	{property = division + "-Home";
	 homepage = 1;
	}
	if(OU != -1){
	checkindex = checkindex.substring(OU);
	}
	OT = checkindex.indexOf("/");
	while(OT >= 0)
	{
	checkindex = checkindex.substring(OT+1);
	OT = checkindex.indexOf("/");
	}
    var checkhome = checkindex.indexOf("index");
	if(property == "sonypictures"){
	if(checkindex == ""||checkhome != -1 ){
	property = division + "-Home";}
	else if(homepage != 1)
	{ property = division + "-default";}
	}
}

  
var subdivision = division.toLowerCase();
//Dynamic variables passed to the Global Include
var title = escape (document.title.toLowerCase());
var affiliate = property + "-" + site;

if (document.flag && document.flag.useTitleTag.value == "true" && !document.pageName){
	useTitleTag = document.flag.useTitleTag.value;
	document.write("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + escape (endString) + "~232~" + division + "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + title + "~5~" + title + "~295~~'></form>");
  } else if (document.pageName && document.pageName.prettyPageName){
	 prettyPageName = document.pageName.prettyPageName.value;
	 if(prettyPageName == ""){
	  document.write("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~"  + escape (endString) + "~5~" + escape (url) + "~232~" + division + "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + escape (endString) + "~295~~'></form>");
     	 }else{
	 if(!document.flag){	 
	  document.write("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + escape (endString) + "~232~" + division + "~28~" + affiliate + "~5~" + escape (prettyPageName) + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + escape (prettyPageName) + "~295~~'></form>");
  	 } else if(document.flag.useTitleTag.value == "false"){
	  document.write("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + escape (endString) + "~232~" + division + "~28~" + affiliate + "~5~" + escape (prettyPageName) + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + escape (prettyPageName) + "~295~~'></form>");
  	 } else{ 
	  document.write("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~"  + escape (endString) + "~5~" + escape (url) + "~232~" + division + "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + escape (endString) + "~295~~'></form>");
  	 }}
  } else{
     document.write("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~"  + escape (endString) + "~5~" + escape (url) + "~232~" + division + "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + escape (endString) + "~295~~'></form>");
  }

  function tracklink(landingpage)
  {
  var cutoffhttp = landingpage.indexOf("//");
	if(cutoffhttp != -1){
	linkname = landingpage.substring(cutoffhttp+2);}
  buildurl = "http://wvw.sonypictures.com/spacer.gif?event=28~" + affiliate + "~242~" + escape (linkname) + "~98~" + escape (landingpage);
  document.location = buildurl;
  }

//-->
