/* ************************
**  Keycode Handling
***************************/

// Grab keycode 
var urlEnd = document.URL.indexOf('?');
var paramstring = "";
var defaultstrSid = "";
var topic_code = "";
if (urlEnd != -1) {
 
paramstring = "?" + document.URL.substring(urlEnd+1, document.URL.length);
  }
else {
paramstring = "noquerystring";
}		
		// Extracts the values from the url
		function getQueryString(){
			var urlEnd = document.URL.indexOf('?');
			var values = new Array();
			var names;
			
		
			if (urlEnd != -1){
				var params = document.URL.substring(urlEnd+1, document.URL.length).split('&');
				for(i=0; i<params.length; i++) {
					names = params[i].split('=');
					values[names[0]] = names[1];
				
				}
			}
			return values;
		}
		values = getQueryString();
		
		
		//Check to see if sid is Defined.  If not, assign default and append to parameters
		var strSid = unescape(values["sid"]);
		
		if (strSid == 'undefined') {
		    // Check to see if PR_CODE Parameter Exists if Sid not found.
		//strSid = unescape(values["PR_CODE"]);PRIORITY_CODE
			strSid = unescape(values["PRIORITY_CODE"]);

		// Default value for strSid when there is no PR_CODE or sid value found
			if (strSid == 'undefined')  {
            strSid = defaultstrSid;
	
			}
			
		// Append Sid to Paramstring
		    defaultstrSid = strSid;
			if (paramstring == 'noquerystring') {
			paramstring = "?sid=" + strSid;
			
			} else {
			paramstring = paramstring + "&sid=" + strSid;
		    
      }
	 }
	 
// 	Attach keycode to internal link	

// 	Attach keycode to popup link for SMS Private
function SMSprivate(topic_code)
{
//var url = "http://www.cisco.com/pcgi-bin/sreg2/register/regdetail_private.pl?LANGUAGE=E&METHOD=E&TOPIC_CODE=" + topic_code + "&PRIORITY_CODE=" + strSid;
var url = "http://www.cisco.com/pcgi-bin/sreg2/register/postcookie.pl?SESSION_ID=&USER_TYPE=&LANGUAGE_ID=E&PAGE_NO=SEMINARDETAIL&SEMINAR_TYPE=T&DETAIL_ID_AND_LOCATION=34438:-:8436:-:OPEN&SEMINAR_ID=7580&SESSION_KEY=&METHOD=E&PRIORITY_CODE=" + strSid + "&BANNER_FLAG=&COUNTRY_ID=&CITY_ID=&STATE_ID=&START_DATE=&END_DATE=&TOPIC_CODE=" + topic_code;
window.open(url,'SMSform').focus();
}


// 	Home browsing to pass the sid within the landing page
function link1(topic_code)
{
var url = "http://www.cisco.com/pcgi-bin/sreg2/register/postcookie.pl?SEMINAR_TYPE=O&LANGUAGE_ID=E&PAGE_NO=SEMINARDETAIL&SEMINAR_ID=9442&EXT_REG_URL=1&METHOD=E&BANNER_FLAG=N&PRIORITY_CODE=" + strSid;
window.open(url,'SMSform').focus();
}
function link2(topic_code)
{
var url = "http://www.cisco.com/pcgi-bin/sreg2/register/postcookie.pl?SEMINAR_TYPE=O&LANGUAGE_ID=E&PAGE_NO=SEMINARDETAIL&SEMINAR_ID=9443&EXT_REG_URL=1&METHOD=E&BANNER_FLAG=N&PRIORITY_CODE=" + strSid;
window.open(url,'SMSform').focus();
}

function link3(topic_code)
{
var url = "http://www.cisco.com/pcgi-bin/sreg2/register/postcookie.pl?SEMINAR_TYPE=O&LANGUAGE_ID=E&PAGE_NO=SEMINARDETAIL&SEMINAR_ID=9445&EXT_REG_URL=1&METHOD=E&BANNER_FLAG=N&PRIORITY_CODE=" + strSid;
window.open(url,'SMSform').focus();
}

function link4(topic_code)
{
var url = "http://www.cisco.com/pcgi-bin/sreg2/register/postcookie.pl?SEMINAR_TYPE=O&LANGUAGE_ID=E&PAGE_NO=SEMINARDETAIL&SEMINAR_ID=9446&EXT_REG_URL=1&METHOD=E&BANNER_FLAG=N&PRIORITY_CODE=" + strSid;
window.open(url,'SMSform').focus();
}

function index1(topic_code)
{
var url = "index.htm?PRIORITY_CODE=" + strSid;
window.open(url,'SMSform').focus();
}
//  Home browsing to pass the sid through the landing pages


// 	Attach keycode to popup link for SMS Public
function SMSpublic(topic_code)
{
var url = "http://www.cisco.com/pcgi-bin/sreg2/register/banner.pl?LANGUAGE=E&METHOD=E&TOPIC_CODE=" + topic_code + "&PRIORITY_CODE=" + strSid;

window.open(url,'SMSform').focus();
}





function bufferkcNW(target)
{
var url = target + paramstring;
window.open(url,'form').focus();
}
