function sizetoprice(id,price)
{
	document.getElementById('price'+id).innerHTML=price+' руб.';
	document.getElementById('pricev'+id).value=price;
}

function pictload (type)
{
	alert(type);
	if (type==1)
		document.getElementById('show').innerHTML='Идет обработка и загрузка изображения...';
	else
		document.getElementById('show').innerHTML='Для предварительного просмотра результата нажмите - <input type="Image" src="/pict/view.gif" align="middle">';
}

function changecolor(id,colorindex)
{
	var massivcvetov = ["white","yellow","lightred","lightviolet","violet","darkblue","skyblue","green","nutbrown","lightbrown","beige","lightgray","black"];
	var re = /(.[^_]+_)(\w+)(\.jpg)/;
	var str = document.getElementById('pict'+id).src;
	fromcolor=(str.replace(re, "$1"+massivcvetov[colorindex]+"$3"));
	document.getElementById('pict'+id).src=fromcolor;
}

function explode( delimiter, string )
{
	var emptyArray = { 0: '' };
	if ( arguments.length != 2	|| typeof arguments[0] == 'undefined' || typeof arguments[1] == 'undefined' )
		return null;
	if ( delimiter === '' || delimiter === false || delimiter === null )
		return false;
	if ( typeof delimiter == 'function'	|| typeof delimiter == 'object'	|| typeof string == 'function'	|| typeof string == 'object' )
		return emptyArray;
	if ( delimiter === true ) { delimiter = '1';}
		return string.toString().split ( delimiter.toString() );
}

function getIframeContent(iFrame){
    var linkedFrame = document.getElementById(iFrame).body.innerHTML;
    document.getElementById('image').innerHTML = content;
}

function resize()
{
	var maxwidth=document.getElementById('maxwidth').value;
	var maxheight=document.getElementById('maxheight').value;
	maxwidth=maxwidth.replace(',','.');
	maxheight=maxheight.replace(',','.');
	var pictwidth=document.getElementById('eximage').width;
	var pictheight=document.getElementById('eximage').height;
	var sootn=pictwidth/pictheight;

	if (sootn>(maxwidth/maxheight)) document.getElementById('maxheight').value=Math.ceil(maxwidth/sootn);
	else document.getElementById('maxwidth').value=Math.ceil(maxheight*sootn);
}



