initQwanzWidgetTags = function(caller){

	var title = this.document.title;
	if (title != 'undefined'){
		caller.title = title;
	}
	var description = getParentMetaContents('description');
	if(description != 'undefined')
	{
		setMetaContents(caller,'description',description)
	}
	var keywords = getParentMetaContents('keywords');
	if(keywords != 'undefined')
	{
		setMetaContents(caller,'keywords',keywords)
	}
}

function initWidget(id,width,height,color1,color2,showVotes)
{
    if (height == '' || !/^\d*$/.test(height))
    {
		height = '455';
    }
    if (width == '' || !/^\d*$/.test(width))
    {
		width = '200';
    }
	document.writeln('<iframe id="qwanzWidget" width="348" height="'+height+'" scrolling="auto" allowtransparency="1" frameborder="0"  src="http://qwanz.dev055.zfort.net/wigets/poll/'+id+'/color1/'+color1+'/color2/'+color2+'/vts/'+showVotes+'/" style="border:0; overflow:auto;"></iframe>'); 

}


function initWidget_v2(id,width,height,color1,color2,showVotes,font,color3,color4,color5)
{
    if (height == '' || !/^\d*$/.test(height))
    {
		height = '455';
    }
    if (width == '' || !/^\d*$/.test(width))
    {
		width = '200';
    }
	document.writeln('<iframe id="qwanzWidget" width="348" height="'+height+'" scrolling="auto" allowtransparency="1" frameborder="0"  src="http://qwanz.dev055.zfort.net/wigets/poll/'+id+'/color1/'+color1+'/color2/'+color2+'/vts/'+showVotes+'/font/'+font+'/color3/'+color3+'/color4/'+color4+'/color5/'+color5+'/" style="border:0; overflow:auto;"></iframe>'); 

}

function initWidget_v3(id,width,height,color1,color2,showVotes,font,color3,color4,color5,corners)
{
    if (height == '' || !/^\d*$/.test(height))
    {
		height = '455';
    }
    if (width == '' || !/^\d*$/.test(width))
    {
		width = '200';
    }
	var addCorners = (corners > 0) ? 'corners/1/' : '';
	document.writeln('<iframe id="qwanzWidget" width="348" height="'+height+'" scrolling="auto" allowtransparency="1" frameborder="0"  src="http://qwanz.dev055.zfort.net/wigets/poll/'+id+'/color1/'+color1+'/color2/'+color2+'/vts/'+showVotes+'/font/'+font+'/color3/'+color3+'/color4/'+color4+'/color5/'+color5+'/'+addCorners+'" style="border:0; overflow:auto;"></iframe>'); 
}

function pollWidget(argV)
{

	var TWidget = JSON.parse(argV);
	
    if (TWidget.height == '' || !/^\d*$/.test(TWidget.height))
    {
		TWidget.height = '455';
    }
    if (TWidget.width == '' || !/^\d*$/.test(TWidget.width))
    {
		TWidget.width = '348';
    }
    var pollID = 0;
    if(TWidget.itemID != undefined)
    {
		pollID = TWidget.itemID;
    }else 
    if(TWidget.pollID != undefined)
    {
		pollID = TWidget.pollID;
	}
	var url = TWidget.rootUrl+'/wigets/poll/'+pollID+'/color1/'+TWidget.mainColor+'/color2/'+TWidget.backgroundColor+'/vts/'+TWidget.showVotes+'/font/'+TWidget.font+'/color3/'+TWidget.bordersColor+'/color4/'+TWidget.headerFooterTextColor+'/color5/'+TWidget.headerFooterBackgroundColor+'/corners/'+TWidget.roundedCorners+'/';
	url += 'width/'+TWidget.width+'/height/'+TWidget.height+'/';
	if(TWidget.skin != '') url += 'skin/'+escape(TWidget.skin)+'/';
	if(TWidget.voteButtonCaption != '') url += 'voteBtnCpt/'+escape(TWidget.voteButtonCaption)+'/';
	if(TWidget.readmoreLinkCaption != '') url += 'readLnCpt/'+escape(TWidget.readmoreLinkCaption)+'/';
	document.writeln('<iframe id="qwanzWidget" width="'+TWidget.width+'" height="'+TWidget.height+'" scrolling="auto" allowtransparency="1" frameborder="0"  src="'+url+'" style="border:0; overflow:auto;"></iframe>'); 
}

function initWidget_v3demo(id,width,height,color1,color2,showVotes,font,color3,color4,color5)
{
    if (height == '' || !/^\d*$/.test(height))
    {
		height = '455';
    }
    if (width == '' || !/^\d*$/.test(width))
    {
		width = '200';
    }
	document.writeln('<iframe id="qwanzWidget" width="348" height="'+height+'" scrolling="auto" allowtransparency="1" frameborder="0"  src="http://qwanz.dev055.zfort.net/wigets/poll/'+id+'/color1/'+color1+'/color2/'+color2+'/vts/'+showVotes+'/font/'+font+'/color3/'+color3+'/color4/'+color4+'/color5/'+color5+'/skin/1/" style="border:0; overflow:auto;"></iframe>'); 

}

function initLPWidget(id)
{
	document.writeln('<iframe width="500" height="800" scrolling="auto" allowtransparency="1" frameborder="0"  src="http://qwanz.dev055.zfort.net/wigets/lpw/'+id+'" style="border:0; overflow:auto;"></iframe>'); 
}


function initLPWidget_v2(argV)
{
	var TWidget = JSON.parse(argV);
	
    if (TWidget.height == '' || !/^\d*$/.test(TWidget.height))
    {
		TWidget.height = '455';
    }
    if (TWidget.width == '' || !/^\d*$/.test(TWidget.width))
    {
		TWidget.width = '348';
    }
	var url = TWidget.rootUrl+'/wigets/lpw/'+TWidget.itemID+'/color1/'+TWidget.mainColor+'/color2/'+TWidget.backgroundColor+'/vts/'+TWidget.showVotes+'/font/'+TWidget.font+'/color3/'+TWidget.bordersColor+'/color4/'+TWidget.headerFooterTextColor+'/color5/'+TWidget.headerFooterBackgroundColor+'/corners/'+TWidget.roundedCorners+'/';
	url += 'width/'+TWidget.width+'/height/'+TWidget.height+'/';
	if(TWidget.skin != '') url += 'skin/'+escape(TWidget.skin)+'/';
	if(TWidget.voteButtonCaption != '') url += 'voteBtnCpt/'+escape(TWidget.voteButtonCaption)+'/';
	if(TWidget.readmoreLinkCaption != '') url += 'readLnCpt/'+escape(TWidget.readmoreLinkCaption)+'/';
	document.writeln('<iframe id="qwanzWidget" width="'+TWidget.width+'" height="'+TWidget.height+'" scrolling="auto" allowtransparency="1" frameborder="0"  src="'+url+'" style="border:0; overflow:auto;"></iframe>'); 
}



function initAutoupdatedLPWidget(id)
{
	document.writeln('<iframe width="500" height="800" scrolling="auto" allowtransparency="1" frameborder="0"  src="http://qwanz.dev055.zfort.net/wigets/autoupdated-lpw/'+id+'" style="border:0; overflow:auto;"></iframe>'); 
}


function getParentMetaContents(name){ 
  var m = parent.document.getElementsByTagName('meta'); 
  for(var i in m){ 
   if(m[i].name == name){ 
     return m[i].content; 
   } 
  } 
}

function setMetaContents(caller, name,value){ 
  var m = caller.getElementsByTagName('meta'); 
  for(var i in m){ 
   if(m[i].name == name){ 
     m[i].content = value;
	 return true; 
   } 
  } 
}

