function isTouchEnabled(){
return (('ontouchstart' in window)
|| (navigator.MaxTouchPoints > 0)
|| (navigator.msMaxTouchPoints > 0));
}
jQuery(function(){
jQuery("path[id^=\"us_ri_\"]").each(function (i, e){
addEvent(jQuery(e).attr('id'));
});
})
function addEvent(id,relationId){
var _obj=jQuery('#'+id);
var _Textobj=jQuery('#'+id+','+'#'+us_ri_config[id]['visnames']);
var _h=jQuery('#map').height();
jQuery('#'+['visnames']).attr({'fill':us_ri_config['default']['visnames']});
_obj.attr({'fill':us_ri_config[id]['upclr'],'stroke':us_ri_config['default']['borderclr']});
_Textobj.attr({'cursor':'default'});
if(us_ri_config[id]['enbl']==true){
if(isTouchEnabled()){
_Textobj.on('touchstart', function(e){
var touch=e.originalEvent.touches[0];
var x=touch.pageX-10, y=touch.pageY+(-15);
var maptipw=jQuery('#tipusri').outerWidth(), maptiph=jQuery('#tipusri').outerHeight(),
x=(x+maptipw>jQuery(document).scrollLeft()+jQuery(window).width())? x-maptipw-(20*2):x
y=(y+maptiph>jQuery(document).scrollTop()+jQuery(window).height())? jQuery(document).scrollTop()+jQuery(window).height()-maptiph-10:y
if(us_ri_config[id]['targt']!='none'){
jQuery('#'+id).css({'fill':us_ri_config[id]['dwnclr']});
}
jQuery('#tipusri').show().html(us_ri_config[id]['hover']);
jQuery('#tipusri').css({left:x, top:y})
})
_Textobj.on('touchend', function(){
jQuery('#'+id).css({'fill':us_ri_config[id]['upclr']});
if(us_ri_config[id]['targt']=='_blank'){
window.open(us_ri_config[id]['url']);
}else if(us_ri_config[id]['targt']=='_self'){
window.parent.location.href=us_ri_config[id]['url'];
}
jQuery('#tipusri').hide();
})
}
_Textobj.attr({'cursor':'pointer'});
_Textobj.hover(function(){
jQuery('#tipusri').show().html(us_ri_config[id]['hover']);
_obj.css({'fill':us_ri_config[id]['ovrclr']})
},function(){
jQuery('#tipusri').hide();
jQuery('#'+id).css({'fill':us_ri_config[id]['upclr']});
})
if(us_ri_config[id]['targt']!='none'){
_Textobj.mousedown(function(){
jQuery('#'+id).css({'fill':us_ri_config[id]['dwnclr']});
})
}
_Textobj.mouseup(function(){
jQuery('#'+id).css({'fill':us_ri_config[id]['ovrclr']});
if(us_ri_config[id]['targt']=='_blank'){
window.open(us_ri_config[id]['url']);
}else if(us_ri_config[id]['targt']=='_self'){
window.parent.location.href=us_ri_config[id]['url'];
}})
_Textobj.mousemove(function(e){
var x=e.pageX+10, y=e.pageY+15;
var maptipw=jQuery('#tipusri').outerWidth(), maptiph=jQuery('#tipusri').outerHeight(),
x=(x+maptipw>jQuery(document).scrollLeft()+jQuery(window).width())? x-maptipw-(20*2):x
y=(y+maptiph>jQuery(document).scrollTop()+jQuery(window).height())? jQuery(document).scrollTop()+jQuery(window).height()-maptiph-10:y
jQuery('#tipusri').css({left:x, top:y})
})
}};