/* Copyright 2000-2007 SiteClarity software, a product of Cheetahmail, an Experian Company */
/* Last Mod: 06262007 1-off pages fall into Main-default*/
/* Last Mod: 06272007 Integrated the custom promo tag top*/
/* Last Mod: 07092007 1-off pages fall into Main-default for Intl sites*/
/* Last Mod: 07126007 Made changes to treat .net like an intl site*/

<!--
var division = "Main";
var property = "sonypictures";
var url =  _proxy_jslib_handle(document, 'URL', '', 0, 0).toLowerCase();

if (document.pgOvr)
{ url =  _proxy_jslib_handle(document.pgOvr.pgNm, 'value', '', 0, 0);}
else if ( _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('pgOvr'))
{url =  _proxy_jslib_handle( _proxy_jslib_handle(document, 'getElementById', '', 1, 0)('pgOvr').pgNm, 'value', '', 0, 0); }

var useTitleTag = "";
var prettyPageName = "";
var startDir4Property = 2;
var site = "";

	if (url.match(/^https?:\/\/.*/)) {
	site =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/^(https?:\/\/)([^\/]+\.)([^\.\/]+)(\.?(:8080)?\/.*)$/,"$3");
	} else {
	site =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/^([^\/]*\/?\/?[^\/]+\.)([^\.\/]+)(\.?(:8080)?\/.*)$/,"$2");
	}

  url =  _proxy_jslib_handle(url, 'replace', '', 1, 0) ("/m2/ftp",   "http://www.sonypictures.com");
  url =  _proxy_jslib_handle(url, 'replace', '', 1, 0) ("/m2/review","http://www.sonypictures.com");
  url =  _proxy_jslib_handle(url, 'replace', '', 1, 0) ("/m2/prmo",  "http://www.sonypictures.com");

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 =  _proxy_jslib_handle(site, 'replace', '', 1, 0)(/:8080/, "");
	site =  _proxy_jslib_handle(site, 'replace', '', 1, 0)(/:8081/, "");
	site =  _proxy_jslib_handle(site, 'replace', '', 1, 0)(/\./, "");
		
	if (site.match(/^\d+$/)) 
	{site = "us";}
	if(dom == 'com'||dom == 'org'||dom =='info')
	{site = "us";}
	
	if(site.length > 2){
	site = "us";}
}

  
  intl = url.indexOf("intl");  
  if (intl != -1) {
   intl = url.substring(intl + 5);
   slash = intl.indexOf("/");
   site = intl.substring(0,slash);
   
   if (site == "uk"){  
   	  url =  _proxy_jslib_handle(url, 'replace', '', 1, 0) ("http://www.sonypictures.com","http://www.sonypictures.co.uk");
   }else if(site == "jp"){
      url =  _proxy_jslib_handle(url, 'replace', '', 1, 0) ("http://www.sonypictures.com","http://www.sonypictures.jp");
   }else if(site == "au"){
      url =  _proxy_jslib_handle(url, 'replace', '', 1, 0) ("http://www.sonypictures.com","http://www.sonypictures.com.au");
	}else if(site == "global"){
      url =  _proxy_jslib_handle(url, 'replace', '', 1, 0) ("http://www.sonypictures.com","http://www.sonypictures.net");
    }
	
   if (site != "us")
   {   
    url =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/\/intl\/\w+/, "");} 
  } 


function getData() {
    var startDir4Section = 0;
	var days_yr = 0;
	
	// Soap Opera property change for sections
	if(url.match("theyoungandtherestless") || url.match("daysofourlives")){
		startDir4Section = 1;
		days_yr = 1;
	}

    var foundSectionName = true;
    var foundPropertyVariable = false;
    if (url.match(/https?:\/\/[^\/]+\/movies\/.*/i))
    {   division = "Movies";
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/movies\/.*/i)) {
        division = "Movies";
        startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/tv\/shows\/[^\/]+\/specials\/.*/i) && days_yr==0 ) {	
	division = "Television";
	startDir4Property = 5;
    } else if (url.match(/https?:\/\/[^\/]+\/tv\/.*/i)) {
        division = "Television";
		startDir4Property = 3;		
    } else if (url.match(/https?:\/\/[^\/]+\/cthe\/tv\/.*/i)) {
        division = "Television";
        startDir4Property = 0;
	property = "dvdontv";
    } else if (url.match(/https?:\/\/[^\/]+\/[^\/]+\/tv\/.*/i)) {
        division = "Television";
    } else if (url.match(/https?:\/\/[^\/]+\/homevideo\/promotions.html/i)) {
        division = "Home+Video";
    } else if (url.match(/https?:\/\/[^\/]+\/homevideo\/.*/i)) {
        division = "Home+Video";
    } else if (url.match(/https?:\/\/[^\/]+\/mobile\/.*/i)) {
        division = "Mobile";
		if(!url.match(/https?:\/\/[^\/]+\/mobile\/index.html/)){
			startDir4Property = 1;	
		}		
    } else if (url.match(/https?:\/\/[^\/]+\/digent\/games\/.*/i)) {
        division = "Digent+Games";
		startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/digent\/mediasoftware\/.*/i)) {
        division = "Media+Software";
		startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/digent\/.*/i)) {
        division = "Digital+Entertainment";
		startDir4Property = 1;
	} else if (url.match(/https?:\/\/[^\/]+\/previews\/.*/i)) {
        division = "Previews+and+Clips";
        startDir4Property = 4;
    } else if (url.match(/https?:\/\/[^\/]+\/shop\/.*/i)) {
        division = "Shop";
		startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/corp\/.*/i)) {
        division = "Corporate";
		startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/win\/.*/i)) {
        division = "Win";
		startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/jspin2\/jsp\/spn\/.*/i)) {
        division = "SPN";
		startDir4Property = 3;
    } else if (url.match(/https?:\/\/[^\/]+\/spnet\/.*/i)){
        division = "SPN";
		startDir4Property = 0;
		property = "spn";
    } else if (url.match(/https?:\/\/[^\/]+\/cgi\/cgi-bin\/templates\/.*/i)) {
	    division = "SPN";
		startDir4Property = 0;
		property = "spn";
    } else if (url.match(/https?:\/\/[^\/]+\/classics\/.*/i)) {
        division = "Classics";
    } else if (url.match(/https?:\/\/[^\/]+\/cthe\/.*/i)) {
        division = "Home+Video";
    } else if (url.match(/https?:\/\/[^\/]+\/cthv\/.*/i)) {
        division = "Home+Video";
    } else if (url.match(/https?:\/\/[^\/]+\/metreon\/walkofgame\/.*/i)) {
        division = "Metreon"; 
        startDir4Property = 2;
    } else if (url.match(/https?:\/\/[^\/]+\/metreon\/.*/i)) {
        division = "Metreon"; 
        startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/imageworks\/.*/i)) {
        division = "Imageworks";
        startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/games\/.*/i)) {
	division = "Games";
    } else if (url.match(/https?:\/\/[^\/]+\/fordfocus\/.*/i)) {
	startDir4Property = 1;
    } else if (url.match(/https?:\/\/[^\/]+\/partners\/.*/i)) {
	division = "Partners";
    } else if (url.match(/https?:\/\/[^\/]+\/psp\/.*/i)) {
	division = "PSP";
	startDir4Property = 1;
	}else if (url.match(/https?:\/\/(www\.)?sonypictures.(.*)(\/)(.*)(\/)(index(.*))?$/i)){
			division = "Main";
			property = "Main-default";	
			startDir4Property = 0;
	}else if (url.match(/https?:\/\/(www\.)?sonypictures.(.*)(\/)?(index(.*))?$/i)){
			division = "Main";
			property = "Main-Home";	
			startDir4Property = 0;
    } else {
	foundSectionName = false;
    }

    if (startDir4Property == 1) {
        if (url.match(/(^https?:\/\/[^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/(^https?:\/\/[^\/]+\/)([^\/]+)(\/.*$)/i, "$2");
            foundPropertyVariable = true;
        }
    } else if (startDir4Property == 2) {
        if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+)(\/.*$)/i, "$2");
            foundPropertyVariable = true;
        }
    } else if (startDir4Property == 3) {
        if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i, "$3");
            foundPropertyVariable = true;
        }
    } else if (startDir4Property == 4) {
        if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i, "$4");
            foundPropertyVariable = true;
        }
    } else if (startDir4Property == 5) {
        if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i)) {
            property =  _proxy_jslib_handle(url, 'replace', '', 1, 0)(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i, "$5");
            foundPropertyVariable = true;
        }
    }
	section = ""

  

 if(startDir4Section == 1){
		if (url.match(/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+\/.*$)/i)){
			section =  _proxy_jslib_handle(url, 'replace', '', 1, 0)((/(^https?:\/\/[^\/]+\/[^\/]+\/)([^\/]+\/)([^\/]+\/)([^\/]+)(\/.*$)/i),"$4");
		} else {
			if(url.match("index")){
				section = "home";
			} else {
				section = "other";
			}			
		}
	}
	
	
    if (foundPropertyVariable == true) {
        property =  _proxy_jslib_handle(property, 'replace', '', 1, 0)(/[^\w\d_\-]/g, "");
    }
}

var vanityURL = url;
var domainCut= vanityURL.indexOf("//");
var endString = escape(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 &&  _proxy_jslib_handle(document.flag.useTitleTag, 'value', '', 0, 0) == "true" && !document.pageName){
	useTitleTag =  _proxy_jslib_handle(document.flag.useTitleTag, 'value', '', 0, 0);
	 _proxy_jslib_handle(document, 'write', '', 1, 0)("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + endString + "~232~" + division + "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + title + "~5~" + title +"~255~"+section+"~'></form>");
  } else if (document.pageName && document.pageName.prettyPageName){
	 prettyPageName =  _proxy_jslib_handle(document.pageName.prettyPageName, 'value', '', 0, 0);
	 if(prettyPageName == ""){
	   _proxy_jslib_handle(document, 'write', '', 1, 0)("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + endString + "~5~" + url + "~232~" + division +"~255~"+section+ "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + endString + "~'></form>");
     	 }else{
	 if(!document.flag){	 
	   _proxy_jslib_handle(document, 'write', '', 1, 0)("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + endString + "~232~" + division + "~28~" + affiliate +"~255~"+section+ "~5~" + prettyPageName + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + prettyPageName + "~'></form>");
  	 } else if( _proxy_jslib_handle(document.flag.useTitleTag, 'value', '', 0, 0) == "false"){
	   _proxy_jslib_handle(document, 'write', '', 1, 0)("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + endString + "~232~" + division +"~255~"+section+ "~28~" + affiliate + "~5~" + prettyPageName + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + prettyPageName + "~'></form>");
  	 } else{ 
	   _proxy_jslib_handle(document, 'write', '', 1, 0)("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + endString + "~5~" + url + "~232~" + division +"~255~"+section+ "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + endString + "~'></form>");
  	 }}
  } else{
      _proxy_jslib_handle(document, 'write', '', 1, 0)("<form style='display:inline' name='h_xes_ao'><input type=hidden name='x_ao' value='53~" + endString + "~5~" + url + "~232~" + division +"~255~"+section+ "~28~" + affiliate + "~221~" + site + "~" + "225~" + site + "^" + property + "^" + subdivision + "^" + endString + "~'></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);
   _proxy_jslib_assign('', document, 'location', '=', ( buildurl));
  }

var hs_aOE = "344~"+division+"^"+affiliate+"~345~"+site+"^"+division+"~";

//-->
 ;
_proxy_jslib_flush_write_buffers() ;