//Download document URLs

/*
var cybersupplychain = '/news/resources/Cyber_Supply_Chain.pdf';
var endtoendpharma = '/news/resources/Digital-End-to-End-Pharma.pdf';
var clinicalinfofusion = '/news/resources/Clinical-Info-Fusion.pdf';
var digitalsignatureassurance = '/news/resources/Digital-Signature-Assurance.pdf';
var industrytrends = '/news/resources/IndustryTrendsandIssues.pdf';
var enterprisecontentmgmt = '/news/resources/EnterpriseContentMgmt.pdf';
var nucleardoccontrol = '/news/resources/NuclearDocumentationControl.pdf';
var saicemcframework = '/news/resources/SAICandEMCFramework.pdf';
var smartgrid = '/news/resources/10-0304-SmartGrid.pdf';
*/
// JavaScript for Resource Library registration
//Return the value of the cookie specified by "name".
function GetCookie (name) {
	var nameEQ = name + "=";
	var ca = document.cookie.split(';');
	for(var i=0;i < ca.length;i++) {
		var c = ca[i];
		while (c.charAt(0)==' ') c = c.substring(1,c.length);
		if (c.indexOf(nameEQ) == 0)
			if (c.indexOf(nameEQ) == 0) return c.substring(nameEQ.length,c.length);
	}//end for
	return null;
}

//Create or update a cookie.
function SetCookie (name, value) {
	//alert(name + " : " + value);
	var exdate=new Date();
	exdate.setDate(exdate.getDate()+365);
	document.cookie=name+ "=" +escape(value)+ ";path=/;expires="+exdate.toGMTString();
}

//user is registered or cookie registered is not null
var isRegistered;
if(GetCookie('cookieUserRegistered')=='yes' || GetCookie('cookieUserRegistered')!=null){
	isRegistered = 'yes';
}else{
	isRegistered = 'no';
}

//form validation and focus
$(function() {
	$('.error').hide();   
	$(".buttonNew").click(function() {	
		// validate and process form here
		$('.error').hide();   
		var name = $("input#name").val();   
		if (name == "") {   
		  $("label#nameError").show();   
		  $("input#name").focus();   
		  return false;   
		}   
		var email = $("input#email").val();
		var reEmailTest = /^([a-zA-Z0-9_\-\.]+)@((\[[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.)|(([a-zA-Z0-9\-]+\.)+))([a-zA-Z]{2,4}|[0-9]{1,3})(\]?)$/i;
		if (email == "") {   
		  $("label#emailError").show();   
		  $("input#email").focus();   
		  return false;   
		}
		if(!email.match(reEmailTest)){
			$("label#emailFormatError").show();
			$("input#email").select();
			return false; 
		}
		var phone = $("input#phone").val();   
		if (phone == "") {   
		  $("label#phoneError").show();   
		  $("input#phone").focus();   
		  return false;   
		}
		SetCookie('cookieUserRegistered','yes');
		//alert('cookie set?  '+GetCookie(cookieUserRegistered));	
	});
});

//add options to country select list
function addOption(selectbox,text,value ) {
	var optn = document.createElement("option");
	optn.text = text;
	optn.value = value;
	selectbox.options.add(optn);
}

function writeCountryOpts(theSelectObj){
	//multidimensional array
	var countryList = new Array();
countryList[0] = new Array("Afghanistan","Afghanistan");
countryList[1] = new Array("Albania","Albania");
countryList[2] = new Array("Algeria","Algeria");
countryList[3] = new Array("American Samoa","American Samoa");
countryList[4] = new Array("Andorra","Andorra");
countryList[5] = new Array("Angola","Angola");
countryList[6] = new Array("Anguilla","Anguilla");
countryList[7] = new Array("Antarctica","Antarctica");
countryList[8] = new Array("Antigua and Barbuda","Antigua and Barbuda");
countryList[9] = new Array("Argentina","Argentina");
countryList[10] = new Array("Armenia","Armenia");
countryList[11] = new Array("Aruba","Aruba");
countryList[12] = new Array("Australia","Australia");
countryList[13] = new Array("Austria","Austria");
countryList[14] = new Array("Azerbaijan","Azerbaijan");
countryList[15] = new Array("Bahamas","Bahamas");
countryList[16] = new Array("Bahrain","Bahrain");
countryList[17] = new Array("Bangladesh","Bangladesh");
countryList[18] = new Array("Barbados","Barbados");
countryList[19] = new Array("Belarus","Belarus");
countryList[20] = new Array("Belgium","Belgium");
countryList[21] = new Array("Belize","Belize");
countryList[22] = new Array("Benin","Benin");
countryList[23] = new Array("Bhutan","Bhutan");
countryList[24] = new Array("Bolivia","Bolivia");
countryList[25] = new Array("Bosnia and Herzegovina","Bosnia and Herzegovina");
countryList[26] = new Array("Botswana","Botswana");
countryList[27] = new Array("Brazil","Brazil");
countryList[28] = new Array("Brunei","Brunei");
countryList[29] = new Array("Bulgaria","Bulgaria");
countryList[30] = new Array("Burkina Faso","Burkina Faso");
countryList[31] = new Array("Burma","Burma");
countryList[32] = new Array("Burundi","Burundi");
countryList[33] = new Array("Cambodia","Cambodia");
countryList[34] = new Array("Cameroon","Cameroon");
countryList[35] = new Array("Canada","Canada");
countryList[36] = new Array("Cape Verde","Cape Verde");
countryList[37] = new Array("Central African Republic","Central African Republic");
countryList[38] = new Array("Chad","Chad");
countryList[39] = new Array("Chile","Chile");
countryList[40] = new Array("China","China");
countryList[41] = new Array("Colombia","Colombia");
countryList[42] = new Array("Comoros","Comoros");
countryList[43] = new Array("Congo DRC","Congo DRC");
countryList[44] = new Array("Congo ROC","Congo ROC");
countryList[45] = new Array("Costa Rica","Costa Rica");
countryList[46] = new Array("Cote d'Ivoire","Cote d'Ivoire");
countryList[47] = new Array("Croatia","Croatia");
countryList[48] = new Array("Cuba","Cuba");
countryList[49] = new Array("Cyprus","Cyprus");
countryList[50] = new Array("Czech Republic","Czech Republic");
countryList[51] = new Array("Denmark","Denmark");
countryList[52] = new Array("Djibouti","Djibouti");
countryList[53] = new Array("Dominica","Dominica");
countryList[54] = new Array("Dominican Republic","Dominican Republic");
countryList[55] = new Array("East Timor","East Timor");
countryList[56] = new Array("Ecuador","Ecuador");
countryList[57] = new Array("Egypt","Egypt");
countryList[58] = new Array("El Salvador","El Salvador");
countryList[59] = new Array("Equatorial Guinea","Equatorial Guinea");
countryList[60] = new Array("Eritrea","Eritrea");
countryList[61] = new Array("Estonia","Estonia");
countryList[62] = new Array("Ethiopia","Ethiopia");
countryList[63] = new Array("Fiji","Fiji");
countryList[64] = new Array("Finland","Finland");
countryList[65] = new Array("France","France");
countryList[66] = new Array("French Guiana","French Guiana");
countryList[67] = new Array("Gabon","Gabon");
countryList[68] = new Array("Gambia","Gambia");
countryList[69] = new Array("Georgia","Georgia");
countryList[70] = new Array("Germany","Germany");
countryList[71] = new Array("Ghana","Ghana");
countryList[72] = new Array("Greece","Greece");
countryList[73] = new Array("Grenada","Grenada");
countryList[74] = new Array("Guam","Guam");
countryList[75] = new Array("Guatemala","Guatemala");
countryList[76] = new Array("Guinea","Guinea");
countryList[77] = new Array("Guinea-Bissau","Guinea-Bissau");
countryList[78] = new Array("Guyana","Guyana");
countryList[79] = new Array("Haiti","Haiti");
countryList[80] = new Array("Honduras","Honduras");
countryList[81] = new Array("Hungary","Hungary");
countryList[82] = new Array("Iceland","Iceland");
countryList[83] = new Array("India","India");
countryList[84] = new Array("Indonesia","Indonesia");
countryList[85] = new Array("Iran","Iran");
countryList[86] = new Array("Iraq","Iraq");
countryList[87] = new Array("Ireland","Ireland");
countryList[88] = new Array("Israel","Israel");
countryList[89] = new Array("Italy","Italy");
countryList[90] = new Array("Jamaica","Jamaica");
countryList[91] = new Array("Japan","Japan");
countryList[92] = new Array("Jordan","Jordan");
countryList[93] = new Array("Kazakhstan","Kazakhstan");
countryList[94] = new Array("Kenya","Kenya");
countryList[95] = new Array("Kiribati","Kiribati");
countryList[96] = new Array("Korea, North","North Korea");
countryList[97] = new Array("Korea, South","South Korea");
countryList[98] = new Array("Kuwait","Kuwait");
countryList[99] = new Array("Kyrgyzstan","Kyrgyzstan");
countryList[100] = new Array("Laos","Laos");
countryList[101] = new Array("Latvia","Latvia");
countryList[102] = new Array("Lebanon","Lebanon");
countryList[103] = new Array("Lesotho","Lesotho");
countryList[104] = new Array("Liberia","Liberia");
countryList[105] = new Array("Libya","Libya");
countryList[106] = new Array("Liechtenstein","Liechtenstein");
countryList[107] = new Array("Lithuania","Lithuania");
countryList[108] = new Array("Luxembourg","Luxembourg");
countryList[109] = new Array("Macau","Macau");
countryList[110] = new Array("Macedonia","Macedonia");
countryList[111] = new Array("Madagascar","Madagascar");
countryList[112] = new Array("Malawi","Malawi");
countryList[113] = new Array("Malaysia","Malaysia");
countryList[114] = new Array("Maldives","Maldives");
countryList[115] = new Array("Mali","Mali");
countryList[116] = new Array("Malta","Malta");
countryList[117] = new Array("Marshall Islands","Marshall Islands");
countryList[118] = new Array("Mauritania","Mauritania");
countryList[119] = new Array("Mauritius","Mauritius");
countryList[120] = new Array("Mexico","Mexico");
countryList[121] = new Array("Micronesia","Micronesia");
countryList[122] = new Array("Moldova","Moldova");
countryList[123] = new Array("Monaco","Monaco");
countryList[124] = new Array("Mongolia","Mongolia");
countryList[125] = new Array("Montenegro","Montenegro");
countryList[126] = new Array("Morocco","Morocco");
countryList[127] = new Array("Mozambique","Mozambique");
countryList[128] = new Array("Namibia","Namibia");
countryList[129] = new Array("Nauru","Nauru");
countryList[130] = new Array("Nepal","Nepal");
countryList[131] = new Array("Netherlands","Netherlands");
countryList[132] = new Array("New Zealand","New Zealand");
countryList[133] = new Array("Nicaragua","Nicaragua");
countryList[134] = new Array("Niger","Niger");
countryList[135] = new Array("Nigeria","Nigeria");
countryList[136] = new Array("Northern Mariana Islands","Northern Mariana Islands");
countryList[137] = new Array("Norway","Norway");
countryList[138] = new Array("Oman","Oman");
countryList[139] = new Array("Pakistan","Pakistan");
countryList[140] = new Array("Palau","Palau");
countryList[141] = new Array("Panama","Panama");
countryList[142] = new Array("Papua New Guinea","Papua New Guinea");
countryList[143] = new Array("Paraguay","Paraguay");
countryList[144] = new Array("Peru","Peru");
countryList[145] = new Array("Philippines","Philippines");
countryList[146] = new Array("Poland","Poland");
countryList[147] = new Array("Portugal","Portugal");
countryList[148] = new Array("Puerto Rico","Puerto Rico");
countryList[149] = new Array("Qatar","Qatar");
countryList[150] = new Array("Romania","Romania");
countryList[151] = new Array("Russia","Russia");
countryList[152] = new Array("Rwanda","Rwanda");
countryList[153] = new Array("Saint Kitts and Nevis","Saint Kitts and Nevis");
countryList[154] = new Array("Saint Lucia","Saint Lucia");
countryList[155] = new Array("Saint Vincent and the Grenadines","Saint Vincent and the Grenadines");
countryList[156] = new Array("Samoa","Samoa");
countryList[157] = new Array("San Marino","San Marino");
countryList[158] = new Array("Sao Tome and Principe","Sao Tome and Principe");
countryList[159] = new Array("Saudi Arabia","Saudi Arabia");
countryList[160] = new Array("Senegal","Senegal");
countryList[161] = new Array("Serbia","Serbia");
countryList[162] = new Array("Seychelles","Seychelles");
countryList[163] = new Array("Sierra Leone","Sierra Leone");
countryList[164] = new Array("Singapore","Singapore");
countryList[165] = new Array("Slovakia","Slovakia");
countryList[166] = new Array("Slovenia","Slovenia");
countryList[167] = new Array("Solomon Islands","Solomon Islands");
countryList[168] = new Array("Somalia","Somalia");
countryList[169] = new Array("South Africa","South Africa");
countryList[170] = new Array("Spain","Spain");
countryList[171] = new Array("Sri Lanka","Sri Lanka");
countryList[172] = new Array("Sudan","Sudan");
countryList[173] = new Array("Suriname","Suriname");
countryList[174] = new Array("Swaziland","Swaziland");
countryList[175] = new Array("Sweden","Sweden");
countryList[176] = new Array("Switzerland","Switzerland");
countryList[177] = new Array("Syria","Syria");
countryList[178] = new Array("Tajikistan","Tajikistan");
countryList[179] = new Array("Taiwan","Taiwan");
countryList[180] = new Array("Tanzania","Tanzania");
countryList[181] = new Array("Thailand","Thailand");
countryList[182] = new Array("Togo","Togo");
countryList[183] = new Array("Tonga","Tonga");
countryList[184] = new Array("Trinidad and Tobago","Trinidad and Tobago");
countryList[185] = new Array("Tunisia","Tunisia");
countryList[186] = new Array("Turkey","Turkey");
countryList[187] = new Array("Turkmenistan","Turkmenistan");
countryList[188] = new Array("Tuvalu","Tuvalu");
countryList[189] = new Array("Uganda","Uganda");
countryList[190] = new Array("Ukraine","Ukraine");
countryList[191] = new Array("United Arab Emirates","United Arab Emirates");
countryList[192] = new Array("United Kingdom","United Kingdom");
countryList[193] = new Array("United States","United States");
countryList[194] = new Array("United States Virgin Islands","United States Virgin Islands");
countryList[195] = new Array("Uruguay","Uruguay");
countryList[196] = new Array("Uzbekistan","Uzbekistan");
countryList[197] = new Array("Vanuatu","Vanuatu");
countryList[198] = new Array("Vatican City","Vatican City");
countryList[199] = new Array("Venezuela","Venezuela");
countryList[200] = new Array("Vietnam","Vietnam");
countryList[201] = new Array("Yemen","Yemen");
countryList[202] = new Array("Zambia","Zambia");
countryList[203] = new Array("Zimbabwe","Zimbabwe");

	for (var i=0; i < countryList.length; ++i){
		addOption(theSelectObj, countryList[i][0], countryList[i][1]);
	}
}