var trigger = function (el, type) {
var event;
if (document.createEvent) {
event=document.createEvent('HTMLEvents');
event.initEvent(type,true,true);
} else {
event=document.createEventObject();
event.eventType=type;
}
event.eventName=type;
if (document.createEvent) {
el.dispatchEvent(event);
} else {
el.fireEvent('on'+event.eventType,event);
}
};