// JavaScript Document
// requires /include/commonDbs.js

var eventCode = new Array();
eventCode['DSCC'] = 'DSCC 2010';
eventCode['DSECC'] = 'European Customer Forum 2010';
eventCode['EPTC'] = 'Electronics Packaging Technology Conference';
eventCode['EUROM'] = 'Euromold';
eventCode['FABTECH'] = 'FABTECH International & Welding Show';
eventCode['IEMT'] = 'International Electronics Manufacturing Technology Conference';
eventCode['INFATS'] = 'INFATS (International Forum of Auto Traffic Safety)';
eventCode['LSAE'] = 'Life Science Alley Expo';
eventCode['NAF10'] = 'NAFEMS 2010 Virtual Conference';
eventCode['NAFEUR'] = 'NAFEMS Germany SDM';
eventCode['ORSAM11'] = 'Orthopedic Research Society Annual Meeting';
eventCode['ORSRM10'] = 'Orthopedic Research Society Regional Meeting';
eventCode['SCC4P'] = 'SIMULIA Customer Conference - Call for Papers';
eventCode['SCM10'] = 'Symposium on Computational Methods in Orthopedic Biomechanics (pre-ORS)';
eventCode['SIM'] = 'SIMVEC';
eventCode['SWW'] = 'SolidWorks World';
eventCode['TTE'] = '2011 Tire Technology Expo';
eventCode['AAOG'] = '2011 Annual Australian Oil & Gas';
eventCode['PDDS'] = '2011 Packaging Design & Development Summit';
eventCode['CSBE11'] = 'Computer Simulations in Bioengineering (IMechE event)';
eventCode['STAREC'] = '2011 STAR European Conference';
eventCode['DMDC'] = '2011 Design of Medical Devices Conference';
eventCode['MATWC'] = '2011 Materialise Worldwide Conference';
eventCode['ISB11'] = '2011 International Symposium on Biomechanics in Vascular Biology and Cardiovascular Disease';
eventCode['ACAE11'] = '2011 Automotive CAE Grand Challenge';
eventCode['IOPP'] = '2011 Institute of Packaging Professionals Conference (IoPP)';
eventCode['NAFWC'] = 'NAFEMS World Congress 2011';
eventCode['SW11'] = 'SafetyWeek 2011';
eventCode['OT11'] = 'OrthoTec 2011';
eventCode['ASME'] = 'ASME TurboExpo';
eventCode['SLV'] = 'Spacecraft & Launch Vehicles';
eventCode['OMAE11'] = 'OMAE 2011';
eventCode['ROMAC'] = 'ROMAC Annual Meeting';
eventCode['ASMEBC'] = 'ASME Summer Bioengineering Conference';
eventCode['ICME'] = 'World Congress on Integrated Computational Materials Engineering (ICME)';
eventCode['USNCCM'] = 'US National Congress on Computational Mechanics 2011 (USNCCM)';
eventCode['USNA11'] = 'Unmanned Systems North America 2011';
eventCode['OE11'] = 'Offshore Europe 2011';
eventCode['SAE11'] = 'SAE 2011 Commercial Vehicle Engineering Congress and Exhibition';


var urls = new Array();
urls['DSCC'] = 'http://www.dscc2010.com/ms_home.htm';
urls['DSECC'] = 'http://www.3ds.com/company/events/ecf-2010/welcome/';
urls['EPTC'] = 'http://eptc.elite.sg/2010/';
urls['EUROM'] = 'http://www.euromold.com/';
urls['FABTECH'] = 'http://www.fmafabtech.com/';
urls['IEMT'] = 'http://www.ewh.ieee.org/r10/malaysia/cpmt/iemt.htm';
urls['INFATS'] = 'http://infats.hnu.cn/';
urls['LSAE'] = 'http://www.lifesciencealleyconference.org/';
urls['NAF10'] = 'http://www.nafems.org/events/nafems/2010/na2010/';
urls['NAFEUR'] = 'http://www.nafems.org/events/nafems/2010/europesdpm2010/';
urls['ORSAM11'] = 'http://www.ors.org/annual_meeting.html';
urls['SCC4P'] = 'http://www.3ds.com/company/events/scc-2011/call-for-papers/';
urls['SCM10'] = 'http://www.pre-ors.org/';
urls['SIM'] = 'http://www.vdi-wissensforum.de/index.php?id=1226';
urls['SWW'] = 'http://www.solidworks.com/swworld2011/';
urls['TTE'] = 'http://www.tiretechnology-expo.com/';
urls['AAOG'] = 'http://www.aogexpo.com.au/';
urls['PDDS'] = 'http://www.packagedesignanddevelopment.com/';
urls['CSBE11'] = 'http://events.imeche.org/EventView.aspx?code=s1557';
urls['STAREC'] = 'http://www.cd-adapco.com/events/workshops/70140000000Kq23AAC';
urls['DMDC'] = 'http://www.dmd.umn.edu/index.html';
urls['MATWC'] = '#';
urls['ISB11'] = 'http://www.shearstresssymposium.nl/';
urls['ACAE11'] = 'http://www.carhs.de/de/training/seminar_functions.php?sem_code=1669';
urls['IOPP'] = 'http://www.iopp.org';
urls['NAFWC'] = 'http://www.nafems.org/congress';
urls['SW11'] = 'http://www.safetyweek.de/103-1-Besucher.html';
urls['OT11'] = 'http://www.canontradeshows.com/expo/ortho10/index.html';
urls['ASME'] = 'http://www.asmeconferences.org/TE2011/';
urls['SLV'] = 'http://www.aero.org/conferences/sclv/';
urls['OMAE'] = 'http://www.asmeconferences.org/OMAE2011/';
urls['ROMAC'] = 'http://www.virginia.edu/romac/annual_meetings.htm';
urls['ASMEBC'] = 'http://asmeconferences.org/SBC2011/ExhibitsSponsorship.cfm';
urls['ICME'] = 'http://www.tms.org/Meetings/Specialty/ICME2011/home.aspx';
urls['USNCCM'] = 'http://www.usnccm.org/';
urls['USNA11'] = 'http://symposium.auvsi.org/auvsi11/public/enter.aspx';
urls['OE11'] = 'http://www.offshore-europe.co.uk/page.cfm/Link=1/t=m/goSection=1';
urls['SAE11'] = 'http://www.sae.org/events/cve/';



///////////////////////////////////////////////////////////////////////////////////////////
///                    MAIN ARRAY WITH  ALL EVENTS                                      ///
///  format:                                                                            ///
///  startDate : endDate : s/e : eventCode : urls : target : location : country : image ///
///  location and country are specified under: /include/commonDbs.js                    ///
///  image: add full path. The image size must be 56px width and 47px height            ///
///  (The image is ONLY displayed in the Industry Events page)                          ///
///////////////////////////////////////////////////////////////////////////////////////////

var indEVENTS = new Array();
indEVENTS.push("10/11/02:10/11/04:e:FABTECH:FABTECH:_blank:ATL::");
indEVENTS.push("10/11/08:10/11/08::SCC4P:SCC4P:_blank:BARC:SP:");
indEVENTS.push("10/11/09:10/11/10:e:DSCC:DSCC:_blank:ORLAN::");
indEVENTS.push("10/11/15:10/11/16:e:NAF10:NAF10:_blank::");
indEVENTS.push("10/11/16:10/11/17:e:SIM:SIM:_blank:BAD:GER:");
indEVENTS.push("10/11/23:10/11/24:e:DSECC:DSECC:_blank:PARI:FR:");
indEVENTS.push("10/11/24:10/11/25:e:NAFEUR:NAFEUR:_blank:FRAN:GER:");
indEVENTS.push("10/11/30:10/12/02:e:IEMT:IEMT:_blank:MELAK:MAL:");
indEVENTS.push("10/12/01:10/12/04:e:EUROM:EUROM:_blank:FRAN:GER:");
indEVENTS.push("10/12/02:10/12/04:e:INFATS:INFATS:_blank:WUHU:CHI:");
indEVENTS.push("10/12/08:10/12/08:e:LSAE:LSAE:_blank:MINN:USA:");
indEVENTS.push("10/12/08:10/12/10:e:EPTC:EPTC:_blank::SG:");
indEVENTS.push("11/01/12:11/01/12:e:SCM10:SCM10:_blank:LONG::");
indEVENTS.push("11/01/13:11/01/15:e:ORSAM11:ORSAM11:_blank:LONG::");
indEVENTS.push("11/01/23:11/01/26:e:SWW:SWW:_blank:SANA::");
indEVENTS.push("11/02/15:11/02/17:e:TTE:TTE:_blank:CG:GER:");
indEVENTS.push("11/02/23:11/02/24:e:AAOG:AAOG:_blank:PERTH:AST:");
indEVENTS.push("11/03/01:11/03/03:e:PDDS:PDDS:_blank:STPB::");
indEVENTS.push("11/03/16:11/03/16:e:CSBE11:CSBE11:_blank:LOND:UK:"); 
indEVENTS.push("11/03/22:11/03/23:e:STAREC:STAREC:_blank:HUIS:NET:");
indEVENTS.push("11/04/12:11/04/14:e:DMDC:DMDC:_blank:MINN::");
indEVENTS.push("11/04/12:11/04/14:e:MATWC::_blank::NETH:");
indEVENTS.push("11/04/15:11/04/16:e:ISB11:ISB11:_blank:ROTT:NET:");
indEVENTS.push("11/04/19:11/04/21:e:ACAE11:ACAE11:_blank:CPH:GER:");
indEVENTS.push("11/05/10:11/05/11:e:IOPP:IOPP:_blank:ROSE::");
indEVENTS.push("11/05/23:11/05/26:e:NAFWC:NAFWC:_blank:BOS::");
indEVENTS.push("11/05/23:11/05/27:e:SW11:SW11:_blank::GER:");
indEVENTS.push("11/05/24:11/05/25:e:OT11:OT11:_blank:WARIN::");
indEVENTS.push("11/06/06:11/06/10:e:ASME:ASME:_blank:VANC:CAN:");
indEVENTS.push("11/06/07:11/06/09:e:SLV:SLV:_blank:LOSA::");
indEVENTS.push("11/06/19:11/06/24:e:OMAE11:OMAE11:_blank:ROTT:NET:");
indEVENTS.push("11/06/20:11/06/24:e:ROMAC:ROMAC:_blank:SAND::");
indEVENTS.push("11/06/22:11/06/25:e:ASMEBC:ASMEBC:_blank:FARM::");
indEVENTS.push("11/07/10:11/07/14:e:ICME:ICME:_blank:SEVSP::");
indEVENTS.push("11/07/25:11/07/27:e:USNCCM:USNCCM:_blank:MINN::");
indEVENTS.push("11/08/16:11/08/19:e:USNA11:USNA11:_blank:WADC::");
indEVENTS.push("11/09/06:11/09/08:e:OE11:OE11:_blank:ABER:UK:");
indEVENTS.push("11/09/13:11/09/14:e:SAE11:SAE11:_blank:ROSE::");


/////////////////////////////////////////////////////////////////////////////////////

// MAIN FUNCTION
function displayEvents(num,style1) {
	
	var frag = document.createDocumentFragment();
	var span = document.createElement('span');

	var numbEvents = indEVENTS.length;
	var withSTYLE = (style1!='')?true:false;
	
	// sort table
	indEVENTS.sort();
	
	// counts # of displayed events
	var counts = 0;
	
	//MAIN LOOP
	for (i = 0; i < numbEvents; i++) {
	
	  var line_array = indEVENTS[i].split(":");
	  var sEvent = line_array[0];
	  var eEvent = line_array[1];
	  var remSE = line_array[2];
	  var indEvent = line_array[3];
	  var URL = line_array[4];
	  var target = line_array[5];
	  var location = line_array[6];
	  var country = line_array[7];
	  var image = line_array[8];

	  if (indEvent) {
		  if (remSE == 'e') {
			var thisDate = eEvent.split("/");
		  } else {
			var thisDate = sEvent.split("/");
		  }
		  var anual = thisDate[0]*1 + 2000;
		  var mes = thisDate[1]*1 - 1;
		  var dia = thisDate[2]*1;
		  
		  var myEVENTDate = new Date(anual, mes, dia);
		  var today = new Date();
		  if (country) var eventLoc = locations[location] + ", " + countries[country]; else var eventLoc = locations[location];
		  
		  var eventDate = formatDate(sEvent, eEvent,"long");
		  var txt = document.createTextNode(eventDate);
		  var txt2 = document.createTextNode(eventCode[indEvent]);
		  var strong = document.createElement('strong');
		  var span4 = document.createTextNode(eventLoc);
		  if (URL) {
			  var aURL = document.createElement('a');
			  aURL.setAttribute("href", urls[URL]);
			  aURL.setAttribute("target", target);
		  }
		  var br = document.createElement('br');
		  var br1 = document.createElement('br');
		  var br2 = document.createElement('br');
		  var br3 = document.createElement('br');
		  
		  // displays only active events
		  if (myEVENTDate > today) {
			if (withSTYLE) { //display for HOME PAGE
				strong.appendChild(txt);
				span.appendChild(strong);
				var img = document.createElement('img');
				img.setAttribute("src", "/all_images/spacer.gif");
				img.setAttribute("width", "10");
				img.setAttribute("height", "7");
				span.appendChild(br);
				if (URL) {
					aURL.appendChild(txt2);
					span.appendChild(aURL);
				} else {
					span.appendChild(txt2);
				}
				span.appendChild(br1);
				span.appendChild(span4);
				span.appendChild(br2);
				span.appendChild(img);
				span.appendChild(br3);
			} else { // display for INDUSTRY EVENT page
				//alert(style1+'-');
				var div = document.createElement('p');
                        if (image) {
				  var imgE = document.createElement('img');
				  imgE.setAttribute("src", image);
				  imgE.setAttribute("align", "left");
				  imgE.setAttribute("hspace", "10");
				  div.appendChild(imgE);
                        }
				strong.appendChild(txt2);
				if (URL) { 
					aURL.appendChild(strong);
					div.appendChild(aURL);
				} else {
					div.appendChild(strong);
				}
				div.appendChild(br);
				div.appendChild(txt);
				div.appendChild(br1);
				div.appendChild(span4);
				span.appendChild(div);
			}
			counts++;
			frag.appendChild(span);
			if ((counts >= num) && (num != 0)) i = numbEvents;
		  }
		}
	
		document.getElementById("indEvents").appendChild(frag);
	}
}

