
function SetCPSetting(UserRef, SrvSID, $strUrlCruiseportalModul)
{	
	var arrSetting 			= new Array(); 	
	if(document.getElementById('Wrapperi')) {
		arrSetting['Width']				= $('#Wrapperi').width();
		arrSetting['Height']			= $('#Wrapperi').height();
	}
	if(document.getElementById('wrapperi')) {
		arrSetting['Width']				= $('#wrapperi').width();
		arrSetting['Height']			= $('#wrapperi').height();
	}
	arrSetting['UserRef']	= UserRef;
	//alert('&ref='+ref+'&SrvSID='+SrvSID+'&CPHeight='+arrSetting['Height']);
	//$('head meta[name=slzSettingCruiseportal]').attr('content', ConvArray2JSON(arrSetting));
	if($strUrlCruiseportalModul == '') $strUrlCruiseportalModul = 'http://www.cruiseportal.de/modul/';
	//StartAjax SETScaleFrame
		ajax_transition(	{   'Prio': '3', 'div_id':'ActionAX', 'Action':'SET', 
								'link':$strUrlCruiseportalModul+'Export/CPIFrameScale.php', 
								'para_get':'&ref='+ref+'&SrvSID='+SrvSID+'&CPHeight='+arrSetting['Height']});
	
	return false;
}

function ConvArray2JSON(arr) {
    var parts = [];

    for(var key in arr) {
    	var value = arr[key];
        if(typeof value == "array") { //Custom handling for arrays
            parts[key] = ConvArray2JSON(value); /* :RECURSION: */
        } else {
            var str = "";
             str = '"' + key + '":';

            //Custom handling for multiple data types
            if(typeof value == "number") str += value; //Numbers
            else if(value === false) str += 'false'; //The booleans
            else if(value === true) str += 'true';
            else str += '"' + value + '"'; //All other things
            // :TODO: Is there any more datatype we should be in the lookout for? (Functions?)

            parts.push(str);
        }
    }
    var json = parts.join(",");
    
    return '{' + json + '}';//Return associative JSON
}


