function swapLanguage(p_sType, p_aArgs, lang) {
    var tempUrl = location.toString();

    var startpos = tempUrl.indexOf("/", 8);
    var endpos = tempUrl.indexOf("/", startpos + 1);

    var re = new RegExp("/" + tempUrl.substring(startpos + 1, endpos) + "/");

    //alert(startpos+":"+endpos+":"+tempUrl+":"+tempUrl.substring(startpos+1,endpos)+":"+lang);
    var url = tempUrl.replace(re, "/" + lang + "/");
    window.open(url, "_self");
}

function popup(p_sType, p_aArgs, link) {
    if (link != '') {
        window.open(link, "_blank");
    }
}


function openPrivacyDlg(p_sType, p_aArgs, p_sValue) {
    _init_privacydlg();
}



// for home banner start
var current_home_banner = 0;

function change_home_banner(image_array) {
    if (image_array.length > 1) {
        var current_image = image_array[current_home_banner][0];
        var current_image_url = image_array[current_home_banner][1];
        var current_image_duration = image_array[current_home_banner][2];
        
        var next_index = current_home_banner+1;
        if (next_index > image_array.length-1) {
            next_index = 0;
        }
        var next_image = image_array[next_index][0];
        var next_image_url = image_array[next_index][1];
        var next_image_duration = image_array[next_index][2];
        
        window.setTimeout(function(){current_home_banner=next_index;change_blend_img('bannerNav',next_image,true);change_home_banner(image_array);},parseInt(current_image_duration,10)*1000);
    }
}

var isf = { 'clock' : null, 'fade' : true, 'count' : 1 , 'speed' : 50}
function change_blend_img(target_id,pic,new_start) {

    if (new_start == true) {
        clearInterval(isf.clock);
        isf.clock=null;
        isf.fade = true;
    }
    
    c_img = document.getElementById(target_id);

	if(isf.clock == null)
	{
		if(typeof c_img.style.opacity != 'undefined')
		{
			isf.type = 'w3c';
		}
		else if(typeof c_img.style.MozOpacity != 'undefined')
		{
			isf.type = 'moz';
		}
		else if(typeof c_img.style.KhtmlOpacity != 'undefined')
		{
			isf.type = 'khtml';
		}
		else if(typeof c_img.filters == 'object')
		{
			isf.type = (c_img.filters.length > 0 && typeof c_img.filters.alpha == 'object' && typeof c_img.filters.alpha.opacity == 'number') ? 'ie' : 'none';
		}
		else
		{
			isf.type = 'none';
		}
		

		//if any kind of opacity is supported
		if(isf.type != 'none')
		{
			isf.length = isf.speed * 10;
			
			isf.resolution = 5;

			//start the timer
			isf.clock = setInterval("change_blend_img('"+target_id+"','"+pic+"',false)", isf.length/isf.resolution);
		}
		
		//otherwise if opacity is not supported
		else
		{
            c_img.src = pic;
		}
		
	} // if clock
	else 
	{
	    //increase or reduce the counter on an exponential scale
	    isf.count = (isf.fade) ? isf.count * 0.8 : (isf.count * (1/0.8)); 
	

	    //if the counter has reached the bottom
	    if(isf.count < (1 / isf.resolution))
	    {
    		//clear the timer
		    clearInterval(isf.clock);
		    isf.clock = null;
    
    	    c_img.src = pic;

		    //reverse the fade direction flag
		    isf.fade = false;

		    //restart the timer
		    isf.clock = setInterval("change_blend_img('"+target_id+"','"+pic+"',false)", isf.length/isf.resolution);

	    }
	
	    //if the counter has reached the top
	    if(isf.count > (1 - (1 / isf.resolution)))
	    {
    		//clear the timer
		    clearInterval(isf.clock);
		    isf.clock = null;
    
		    //reset the fade direction flag
		    isf.fade = true;
    		
		    //reset the counter
		    isf.count = 1;
	    }

	    //set new opacity value on element
	    //using whatever method is supported

	    switch(isf.type)
	    {
    		case 'ie' :
			    c_img.filters.alpha.opacity = isf.count * 100;
			    break;
    			
		    case 'khtml' :
    			c_img.style.KhtmlOpacity = isf.count;
			    break;
    			
		    case 'moz' : 
    			//restrict max opacity to prevent a visual popping effect in firefox
			    c_img.style.MozOpacity = (isf.count == 1 ? 1.0 : isf.count);
			    break;
    			
		    default : 
    			//restrict max opacity to prevent a visual popping effect in firefox
			    c_img.style.opacity = (isf.count == 1 ? 1.0 : isf.count);
	    }
	}
    
} // end change
// for home banner end