// to obtain the channel 
var url = unescape(location.href);
var url1= unescape(location.href);

// *****************************
// Get the start and end
// expecting to obtain channel betn the 3rd and 4th occurrence of slash
// http://www.straitstimes.com/xxx/
// *****************************
var slashno = 3;
var nxtslash= url.indexOf("/");
for (i=0;i<slashno;i++)
{
    url  = url.substr(nxtslash+1);
    nxtslash= url.indexOf("/");
};

var vertical = url.substring(0,nxtslash);
var pv       = getCounter(pvCookie);
var catimpressions = GetCookie(catCookie);


    
   


if (catimpressions == null) 
{
	catimpressions = 0;
}
//SM added on 31/01/2008 to exclude Home from displaying CATS and include Home to display TVC instead
if ( (catimpressions < catMax) && (pv % 2 == 1) && (url1 != 'http://www.straitstimes.com/Home.html') ) 
{
	getCounter(catCookie);
	if (!document.phpAds_used) document.phpAds_used = ',';phpAds_random = new String (Math.random());
	phpAds_random = phpAds_random.substring(2,11);
	
	if ( (url1 != 'http://www.straitstimes.com/') && (url1 != 'http://www.straitstimes.com') && (url1 != 'http://www.straitstimes.com/Home.html')) {


	document.write ("<" + "script language='JavaScript' type='text/javascript' src='");
	document.write ("http://streamit.hardwarezone.com/adjs.php?n=" + phpAds_random);
	document.write ("&amp;what=zone:1086&amp;target=_blank");
	document.write ("&amp;exclude=" + document.phpAds_used);

	if (document.referrer)
		document.write ("&amp;referer=" + escape(document.referrer));
	document.write ("'><" + "/script>");
	document.write ("<noscript><a href='http://streamit.hardwarezone.com/adclick.php?n=a4d04947' target='_blank'>							");
	document.write ("<img src='http://streamit.hardwarezone.com/adview.php?what=zone:1086&amp;n=a4d04947' border='0' alt=''></a></noscript>	");
	document.write ("<!-- AD TAGGING FOR HARDWAREZONE CATFISH : END -->	");
	
	}

} 
else 
{
	document.write ("<!-- AD TAGGING FOR MEDIAONE TVC - SPECIFIC : START -->	");
	document.write ("<!-- BEGIN: SectionID -->									");
	document.write ("<script language='javascript' type='text/javascript'>		");

	if ( (url1 == 'http://www.straitstimes.com/') || (url1 == 'http://www.straitstimes.com') || (url1 == 'http://www.straitstimes.com/Home.html')) {
	   
	   document.write ("_m1SecID='000000556-001';									");
 	} else if ((vertical == 'Latest%2BNews') ||  (vertical == 'Latest+News') ) {
		document.write ("_m1SecID='000000556-002';									");
	} else if (vertical == '') {
		document.write ("_m1SecID='000000556-001';									");
	} else if (vertical == 'Free') {
		document.write ("_m1SecID='000000556-003';									");
	} else if ((vertical == 'Prime%2BNews') || (vertical == 'Prime+News')){
		document.write ("_m1SecID='000000556-004';									");
	} else if (vertical == 'Singapore') {
		document.write ("_m1SecID='000000556-005';									");
	} else if (vertical == 'Asia') {
		document.write ("_m1SecID='000000556-006';									");
	} else if (vertical == 'Money') {
		document.write ("_m1SecID='000000556-007';									");
	} else if (vertical == 'World') {
		document.write ("_m1SecID='000000556-008';									");
	} else if (vertical == 'Review') {
		document.write ("_m1SecID='000000556-009';									");
	} else if (vertical == 'Insight') {
		document.write ("_m1SecID='000000556-010';									");
	} else if (vertical == 'Sports') {
		document.write ("_m1SecID='000000556-011';									");
	} else if ((vertical == 'ST%2BForum') || (vertical == 'ST+Forum') ){
		document.write ("_m1SecID='000000556-012';									");
	} else if (vertical == 'Life%2521') {
		document.write ("_m1SecID='000000556-013';									");
	} else if (vertical == 'Podcast') {
		document.write ("_m1SecID='000000556-014';									");
	} else if ((vertical == 'Video%2BNews') || (vertical == 'Video+News') ){
		document.write ("_m1SecID='000000556-015';									");
	} else if ((vertical == 'Our%2BColumnists') || (vertical == 'Our+Columnists') ){
		document.write ("_m1SecID='000000556-016';									");
	} else if ((vertical == 'Saturday%2BSpecial%2BReport') ||(vertical == 'Saturday+Special+Report')) {
		document.write ("_m1SecID='000000556-017';									");
	} else if ((vertical == 'Mind%2BYour%2BBody') || (vertical == 'Mind+Your+Body')) {
		document.write ("_m1SecID='000000556-019';									");
	} else if ((vertical == 'Digital%2BLife')|| (vertical == 'Digital+Life') ){
		document.write ("_m1SecID='000000556-020';									");
	} else if (vertical == 'Urban') {
		document.write ("_m1SecID='000000556-021';									");
	} else if ((vertical == 'From%2BOur%2BCorrespondents') || (vertical == 'From+Our+Correspondents')){
		document.write ("_m1SecID='000000556-022';									");
	} else if (vertical == 'News%2BIn%2BPictures') {
		document.write ("_m1SecID='000000556-023';									");
	} else if ((vertical == 'Photo%2BEssays') || (vertical == 'Photo+Essays') ){
		document.write ("_m1SecID='000000556-024';									");
	} else if ((vertical == 'The%2BPrint%2BEdition') || (vertical == 'The+Print+Edition') ){
	
		document.write ("_m1SecID='000000556-025';									");
	} else {
		//comments
		
		document.write ("_m1SecID='000000556-999';									");
	}	
	
	document.write ("_m1IsActive=1;												");
	document.write ("_m1PosV=3;													");
	document.write ("_m1PosH=1;													");
	document.write ("_m1PosX=0;													");
	document.write ("_m1PosY=20;												");
	document.write ("<" + "/" + "script>										");
	document.write ("<!-- END: SectionID -->									");
	document.write ("<!-- AD TAGGING FOR MEDIAONE TVC - SPECIFIC : END -->		");

}
