

//Event tag handler for form events

//Declare constants
var SCROLLED = false;

//Handle pair call for special parameter to the NetInsight event tag call
function handlePair(key, value, command) {
	if (command == null) {
		//Do nothing
	} else {
		if (command == 'A')
			ntptAddPair(key, value);
		if (command == 'D')
			ntptDropPair(key, value);
	}
	return true;
}
 
//Handle form event for NetInsight
function ntptEvent(eventText, key, value, command){
	handlePair(key,value,command);
	return ntptEventTag(eventText);    
}

//Handle Link event for NetInsight
function ntptLink(linkObj,querymod,time){
    return ntptLinkTag(linkObj,querymod,time);    
}

//Handle Submit event for NetInsight
function ntptSubmit(formObj,querymod, time, key, value, command){ 
    handlePair(key,value,command);  
	return ntptSubmitTag(formObj,querymod, time);   
}

//Handle scroll event for NetInsight
function ntptScrollEvent(eventText, key, value, command){
    if (SCROLLED) {
        //do nothing.  Suppress event
    } else {
        ntptEvent(eventText, key, value, command);
        SCROLLED = true;
    }
    return true;	
}



// Calls NetInsight ntptEvent() based on parameters passed in. Format of ntptEvent call is: 
// - Internal Links: ntptEvent('ev=internal_link&section=<Section>','link','<name of the link>','A');
// - External Links in new window: ntptEvent('ev=extlink_nofollow&section=<Section>','link’,'<name of the link>','A');
function callNtptEvent(myLink, section, isInternal)
{ 
	if (typeof isInternal == 'undefined' ) 
	{
		isInternal = true;
	}

	var internalExternal = (isInternal) ? 'internal_link' : 'extlink_nofollow';

	ntptEvent('ev=' + internalExternal + '&section=' + section, 'link', myLink.innerHTML, 'A');
}

