var showtvc = 0;
var url = unescape(location.href);
//var a = url.indexOf("/") + 2;
//var b = url.indexOf(".");
//var vertical = url.substring(a,b);

var vertical = "others";
if ( (url == 'http://newpaper.asia1.com.sg/') || (url=='http://www.tnp.sg/') || (url.indexOf("4138") != -1) || (url.indexOf("6386") != -1) ) {
	vertical = 'tnphome';
} else if (url.indexOf("happenings") != -1) {
	vertical = 'tnphappenings'
} else if (url.indexOf("news") != -1) {
	vertical = 'tnpnews'
} else if (url.indexOf("show") != -1) {
	vertical = 'tnpshow'
} else if (url.indexOf("sports") != -1) {
	vertical = 'tnpsports'
} else if (url.indexOf("tech") != -1 ) {
	vertical = 'tnptech'
} else if (url.indexOf("guide") != -1) {
	vertical = 'tnpguide'
}
var pv = getCounter(pvCookie);
var catimpressions = GetCookie(catCookie);
if (catimpressions == null) {
	catimpressions = 0;
}

// pv1 - cat; pv2 - tvc; pv3 - cat (if catMax not reached); pv4 - tvc
//alert("pv="+pv);
if ( (catimpressions < catMax) && (pv % 2 == 1) && (vertical != 'tnphome')) {
	getCounter(catCookie);

	showtvc = 0;
	if (vertical != 'tnphome') {
		document.write('<script language="JavaScript1.1" src="http://ads.asia1.com.sg/js.ng/site=ttnp&pagepos=40&cat1=main&cat2=tnpsec&size=10X10"></script>');
		document.write('<NOSCRIPT><a href="http://ads.asia1.com.sg/click.ng/site=ttnp&pagepos=40&cat1=main&cat2=tnpsec&size=10X10"><img src="http://ads.asia1.com.sg/image.ng/site=ttnp&pagepos=40&cat1=main&cat2=tnpsec&size=10X10" border="0"></a></NOSCRIPT>');
	}

} else {

	//alert(catimpressions);
	//alert('Show TVC');
	showtvc = 1;
	document.write ("<!-- AD TAGGING FOR MEDIAONE TVC - SPECIFIC : START -->	");
	document.write ("<!-- BEGIN: SectionID -->									");
	document.write ("<script language='javascript' type='text/javascript'>		");
	
	if (vertical == 'tnphome') {
		document.write ("_m1SecID='000000566-001';									");		
	} else if (vertical == 'tnphappenings') {
		document.write ("_m1SecID='000000566-002';									");		
	} else if (vertical == 'tnpnews') {
		document.write ("_m1SecID='000000566-003';									");		
	} else if (vertical == 'tnpshow') {
		document.write ("_m1SecID='000000566-004';									");		
	} else if (vertical == 'tnpsports') {
		document.write ("_m1SecID='000000566-005';									");		
	} else if (vertical == 'tnptech') {
		document.write ("_m1SecID='000000566-006';									");		
	} else if (vertical == 'tnpguide') {
		document.write ("_m1SecID='000000566-007';									");		
	} else {
		document.write ("_m1SecID='000000566-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 -->		");
	
}

