// JavaScript Document

/* jquery check html ready  */
$("document").ready(function(){
	if($('.sectionCopy').html() == ''){
		$('.sectionCopy').remove();
	}
	
	$('.slideshow').hover(
		function() { $('#controls').fadeIn(); },
		function() { $('#controls').fadeOut(); }
	);
	
	$('.pics').cycle({
		fx:     'fade',
		speed:   400,
		timeout: 4000,
		slideExpr: 'img'
	});

});

/* change contact form item*/
function changeFormType(formType){
	if(formType == 'iphone'){
		$("form").attr("action","iphone-default.php");
		$('#send').remove();
	}else{
		$('#iphoneSend').remove();
	}
}


function changeLanguage(language){
	DeleteCookie('xml-language');
	createCookie('xml-language',language);
	alert(language);
	window.location = window.location.href;
}


/*create cookie*/
function createCookie(name,value,days) {
 if (days) {
  var date = new Date();
  date.setTime(date.getTime()+(days*24*60*60*1000));
  var expires = ""; 
  expires=""+date.toGMTString();
 }
 else var expires = "";
 document.cookie = name + "=" + value + "; expires=" + expires;  

}
/*get cookie*/
function GetCookie(name)
{
    var arg = name + "=";
    var alen = arg.length;
    var clen = document.cookie.length;
    var i = 0;
    while (i < clen) {
        var j = i + alen;
        if (document.cookie.substring(i, j) == arg)
            return GetCookieVal(j);
        i = document.cookie.indexOf(" ", i) + 1;
        if (i == 0) break;
    }
    return null;
}

function GetCookieVal(offset)
{
    var endstr = document.cookie.indexOf(";", offset);
    if (endstr == -1)
        endstr = document.cookie.length;
    return unescape(document.cookie.substring(offset, endstr));
}

/*delete cookie*/
function DeleteCookie(name) {
 createCookie(name,"",-1);
}



