/**
* Method to get the Javascript for switching images
* @param string $waitImage Image which will be displayed as while loading
* @return string Switch image javascript
*/
public static function switchImage($waitImage)
{
$js = "\t" . '<script language="javascript" type="text/javascript">' . "\n" . 'var pcid = 0;' . "\n" . 'var waitImage = new Image();' . "\n" . 'waitImage.src = \'' . $waitImage . '\';' . "\n";
/*
if ((int)$customWidth > 0) {
$js .= 'waitImage.width = '.$customWidth.';' . "\n";
}
if ((int)$customHeight > 0) {
$js .= 'waitImage.height = '.$customHeight.';' . "\n";
}*/
$js .= 'function PhocaGallerySwitchImage(imageElementId, imageSrcUrl, width, height)' . "\n" . '{ ' . "\n" . "\t" . 'var imageElement = document.getElementById(imageElementId);' . "\t" . 'var imageElement2 = document.getElementById(imageElementId);' . "\t" . 'if (imageElement && imageElement.src)' . "\n" . "\t" . '{' . "\n" . "\t" . "\t" . 'imageElement.src = \'\';' . "\n" . "\t" . '}' . "\n" . "\t" . 'if (imageElement2 && imageElement2.src)' . "\n" . "\t" . "\t" . 'imageElement2.src = imageSrcUrl;' . "\n" . "\t" . "\t" . 'if (width > 0) {imageElement2.width = width;}' . "\n" . "\t" . "\t" . 'if (height > 0) {imageElement2.height = height;}' . "\n" . '}' . "\n" . 'function _PhocaGalleryVoid(){}' . "\n" . '</script>' . "\n";
return $js;
}